- Cairo::Surface
authorJan Vrany <jan.vrany@fit.cvut.cz>
Sun, 17 Jun 2012 14:49:30 +0000
changeset 16 a810555a635c
parent 15 c1db2c8aa2ed
child 17 5f943c05c028
- Cairo::Surface class definition added:6 methods changed: #update:with:from: - Cairo::ClockView changed: #redraw - extensions ...
Cairo__ClockView.st
Cairo__Surface.st
Make.proto
bc.mak
extensions.st
libcairo.rc
--- a/Cairo__ClockView.st	Sun Jun 17 07:04:40 2012 +0000
+++ b/Cairo__ClockView.st	Sun Jun 17 14:49:30 2012 +0000
@@ -22,20 +22,25 @@
 
 redraw
 
+    |area oldClip|
+
+    area := Smalltalk::Rectangle left:1 top:1 width:self width height:self height.
+    oldClip := clipRect.
+    self clippingRectangle:area.
+
+    self clearView.
+    self displayLineFromX:1 y:1 toX:self width y: self height.
+
     cr isNil ifTrue:[cr := self cairo].
 
-    cr paint: Color black.
-    cr moveToX: 30 y: 50.
-    cr fontFaceFamily: 'Times' slant: (Cairo::FontSlant FONT_SLANT_ITALIC) weight: 2.
-    cr fontSize: 30.
-    cr showText: 'Cairo in Smalltalk/X'.
-    cr paint: (Color red alpha: 0.5).
-    cr rectangleX: 10 y: 15 width: 150 height: 60.
-    cr fill.
-    cr paint: (Color red alpha: 0.75).
-    cr rectangleX: 10 y: 15 width: 150 height: 60.
+
+
+    cr paint: (Color red alpha: 1.0).
+    cr rectangleX: 1 y: 1 width: (self width) height: (self height).
     cr stroke.
 
+    self clippingRectangle:oldClip.
+
     "Created: / 16-06-2012 / 23:25:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
--- a/Cairo__Surface.st	Sun Jun 17 07:04:40 2012 +0000
+++ b/Cairo__Surface.st	Sun Jun 17 14:49:30 2012 +0000
@@ -3,9 +3,9 @@
 "{ NameSpace: Cairo }"
 
 RefCountedStructure subclass:#Surface
-	instanceVariableNames:''
+	instanceVariableNames:'view'
 	classVariableNames:''
-	poolDictionaries:''
+	poolDictionaries:'Cairo::SurfaceType'
 	category:'Cairo-Objects'
 !
 
@@ -493,6 +493,17 @@
     "Created: / 09-09-2008 / 22:19:44 / Jan Vrany <vranyj1@fel.cvut.cz>"
 !
 
+height
+
+    self type == SURFACE_TYPE_XLIB ifTrue:[
+        ^self class primXlibSurfaceGetHeight: self 
+    ].
+
+    self error:'Operation not supported'
+
+    "Created: / 17-06-2012 / 15:37:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
 type
 
     ^self class primGetType: self
@@ -500,6 +511,17 @@
     "Created: / 10-07-2008 / 10:34:36 / Jan Vrany <vranyj1@fel.cvut.cz>"
 !
 
+width
+
+    self type == SURFACE_TYPE_XLIB ifTrue:[
+        ^self class primXlibSurfaceGetWidth: self 
+    ].
+
+    self error:'Operation not supported'
+
+    "Created: / 17-06-2012 / 15:37:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
 width: w height: h
 
     self class primXlibSurfaceSetSize: self width: w height: h
@@ -511,12 +533,17 @@
 
 update: aspect with: param from: sender
 
-    (aspect = #sizeOfView and:[self type = SurfaceType SURFACE_TYPE_XLIB])
-        ifTrue:[^self width: sender width height: sender height].
+    (sender == view) ifTrue:[
+        aspect == #sizeOfView  ifTrue:[
+            self width: sender width height: sender height.
+            ^self.
+        ]
+    ].
 
     super update: aspect with: param from: sender
 
     "Created: / 10-07-2008 / 19:33:39 / Jan Vrany <vranyj1@fel.cvut.cz>"
+    "Modified: / 17-06-2012 / 15:05:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !Surface methodsFor:'initialization & release'!
@@ -533,6 +560,41 @@
     ^self class primFlush: self
 
     "Created: / 10-07-2008 / 10:32:50 / Jan Vrany <vranyj1@fel.cvut.cz>"
+!
+
+setView: aView
+
+    view notNil ifTrue:[
+        self error: 'Trying to set view twice'
+    ].
+    view := aView.
+    view addDependent: self.
+
+    "Created: / 17-06-2012 / 15:04:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!Surface methodsFor:'queries'!
+
+isViewSurface
+    "Return true, if this sufrace if for a kind of a View"
+
+    ^self isXLibSurface or:[ self isWin32Surface ]
+
+    "Created: / 17-06-2012 / 15:02:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+isWin32Surface
+
+    ^self type == SURFACE_TYPE_WIN32
+
+    "Created: / 17-06-2012 / 15:01:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+isXLibSurface
+
+    ^self type == SURFACE_TYPE_XLIB
+
+    "Created: / 17-06-2012 / 14:58:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !Surface class methodsFor:'documentation'!
--- a/Make.proto	Sun Jun 17 07:04:40 2012 +0000
+++ b/Make.proto	Sun Jun 17 14:49:30 2012 +0000
@@ -159,7 +159,7 @@
 $(OUTDIR)Cairo__GraphicsContext.$(O) Cairo__GraphicsContext.$(H): Cairo__GraphicsContext.st $(INCLUDE_TOP)/stx/goodies/libcairo/Cairo__RefCountedStructure.$(H) $(INCLUDE_TOP)/stx/libbasic/ExternalStructure.$(H) $(INCLUDE_TOP)/stx/libbasic/ExternalBytes.$(H) $(INCLUDE_TOP)/stx/libbasic/UninterpretedBytes.$(H) $(INCLUDE_TOP)/stx/libbasic/ArrayedCollection.$(H) $(INCLUDE_TOP)/stx/libbasic/SequenceableCollection.$(H) $(INCLUDE_TOP)/stx/libbasic/Collection.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
 $(OUTDIR)Cairo__Pattern.$(O) Cairo__Pattern.$(H): Cairo__Pattern.st $(INCLUDE_TOP)/stx/goodies/libcairo/Cairo__RefCountedStructure.$(H) $(INCLUDE_TOP)/stx/libbasic/ExternalStructure.$(H) $(INCLUDE_TOP)/stx/libbasic/ExternalBytes.$(H) $(INCLUDE_TOP)/stx/libbasic/UninterpretedBytes.$(H) $(INCLUDE_TOP)/stx/libbasic/ArrayedCollection.$(H) $(INCLUDE_TOP)/stx/libbasic/SequenceableCollection.$(H) $(INCLUDE_TOP)/stx/libbasic/Collection.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
 $(OUTDIR)Cairo__ScaledFont.$(O) Cairo__ScaledFont.$(H): Cairo__ScaledFont.st $(INCLUDE_TOP)/stx/goodies/libcairo/Cairo__RefCountedStructure.$(H) $(INCLUDE_TOP)/stx/libbasic/ExternalStructure.$(H) $(INCLUDE_TOP)/stx/libbasic/ExternalBytes.$(H) $(INCLUDE_TOP)/stx/libbasic/UninterpretedBytes.$(H) $(INCLUDE_TOP)/stx/libbasic/ArrayedCollection.$(H) $(INCLUDE_TOP)/stx/libbasic/SequenceableCollection.$(H) $(INCLUDE_TOP)/stx/libbasic/Collection.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
-$(OUTDIR)Cairo__Surface.$(O) Cairo__Surface.$(H): Cairo__Surface.st $(INCLUDE_TOP)/stx/goodies/libcairo/Cairo__RefCountedStructure.$(H) $(INCLUDE_TOP)/stx/libbasic/ExternalStructure.$(H) $(INCLUDE_TOP)/stx/libbasic/ExternalBytes.$(H) $(INCLUDE_TOP)/stx/libbasic/UninterpretedBytes.$(H) $(INCLUDE_TOP)/stx/libbasic/ArrayedCollection.$(H) $(INCLUDE_TOP)/stx/libbasic/SequenceableCollection.$(H) $(INCLUDE_TOP)/stx/libbasic/Collection.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)Cairo__Surface.$(O) Cairo__Surface.$(H): Cairo__Surface.st $(INCLUDE_TOP)/stx/goodies/libcairo/Cairo__SurfaceType.$(H) $(INCLUDE_TOP)/stx/goodies/libcairo/Cairo__RefCountedStructure.$(H) $(INCLUDE_TOP)/stx/libbasic/ExternalStructure.$(H) $(INCLUDE_TOP)/stx/libbasic/ExternalBytes.$(H) $(INCLUDE_TOP)/stx/libbasic/UninterpretedBytes.$(H) $(INCLUDE_TOP)/stx/libbasic/ArrayedCollection.$(H) $(INCLUDE_TOP)/stx/libbasic/SequenceableCollection.$(H) $(INCLUDE_TOP)/stx/libbasic/Collection.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
 $(OUTDIR)extensions.$(O): extensions.st $(INCLUDE_TOP)/stx/libview/DeviceGraphicsContext.$(H) $(INCLUDE_TOP)/stx/libview/GraphicsContext.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(INCLUDE_TOP)/stx/libview/GraphicsDevice.$(H) $(INCLUDE_TOP)/stx/libview/SimpleView.$(H) $(INCLUDE_TOP)/stx/libview/DisplaySurface.$(H) $(INCLUDE_TOP)/stx/libview/GraphicsMedium.$(H) $(INCLUDE_TOP)/stx/libview/XWorkstation.$(H) $(INCLUDE_TOP)/stx/libview/DeviceWorkstation.$(H) $(INCLUDE_TOP)/stx/libview/HostGraphicsDevice.$(H) $(INCLUDE_TOP)/nil/Cairo.$(H) $(INCLUDE_TOP)/stx/libbasic/NameSpace.$(H) $(STCHDR)
 
 # ENDMAKEDEPEND --- do not remove this line
--- a/bc.mak	Sun Jun 17 07:04:40 2012 +0000
+++ b/bc.mak	Sun Jun 17 14:49:30 2012 +0000
@@ -98,7 +98,7 @@
 $(OUTDIR)Cairo__GraphicsContext.$(O) Cairo__GraphicsContext.$(H): Cairo__GraphicsContext.st $(INCLUDE_TOP)\stx\goodies\libcairo\Cairo__RefCountedStructure.$(H) $(INCLUDE_TOP)\stx\libbasic\ExternalStructure.$(H) $(INCLUDE_TOP)\stx\libbasic\ExternalBytes.$(H) $(INCLUDE_TOP)\stx\libbasic\UninterpretedBytes.$(H) $(INCLUDE_TOP)\stx\libbasic\ArrayedCollection.$(H) $(INCLUDE_TOP)\stx\libbasic\SequenceableCollection.$(H) $(INCLUDE_TOP)\stx\libbasic\Collection.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
 $(OUTDIR)Cairo__Pattern.$(O) Cairo__Pattern.$(H): Cairo__Pattern.st $(INCLUDE_TOP)\stx\goodies\libcairo\Cairo__RefCountedStructure.$(H) $(INCLUDE_TOP)\stx\libbasic\ExternalStructure.$(H) $(INCLUDE_TOP)\stx\libbasic\ExternalBytes.$(H) $(INCLUDE_TOP)\stx\libbasic\UninterpretedBytes.$(H) $(INCLUDE_TOP)\stx\libbasic\ArrayedCollection.$(H) $(INCLUDE_TOP)\stx\libbasic\SequenceableCollection.$(H) $(INCLUDE_TOP)\stx\libbasic\Collection.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
 $(OUTDIR)Cairo__ScaledFont.$(O) Cairo__ScaledFont.$(H): Cairo__ScaledFont.st $(INCLUDE_TOP)\stx\goodies\libcairo\Cairo__RefCountedStructure.$(H) $(INCLUDE_TOP)\stx\libbasic\ExternalStructure.$(H) $(INCLUDE_TOP)\stx\libbasic\ExternalBytes.$(H) $(INCLUDE_TOP)\stx\libbasic\UninterpretedBytes.$(H) $(INCLUDE_TOP)\stx\libbasic\ArrayedCollection.$(H) $(INCLUDE_TOP)\stx\libbasic\SequenceableCollection.$(H) $(INCLUDE_TOP)\stx\libbasic\Collection.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
-$(OUTDIR)Cairo__Surface.$(O) Cairo__Surface.$(H): Cairo__Surface.st $(INCLUDE_TOP)\stx\goodies\libcairo\Cairo__RefCountedStructure.$(H) $(INCLUDE_TOP)\stx\libbasic\ExternalStructure.$(H) $(INCLUDE_TOP)\stx\libbasic\ExternalBytes.$(H) $(INCLUDE_TOP)\stx\libbasic\UninterpretedBytes.$(H) $(INCLUDE_TOP)\stx\libbasic\ArrayedCollection.$(H) $(INCLUDE_TOP)\stx\libbasic\SequenceableCollection.$(H) $(INCLUDE_TOP)\stx\libbasic\Collection.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)Cairo__Surface.$(O) Cairo__Surface.$(H): Cairo__Surface.st $(INCLUDE_TOP)\stx\goodies\libcairo\Cairo__SurfaceType.$(H) $(INCLUDE_TOP)\stx\goodies\libcairo\Cairo__RefCountedStructure.$(H) $(INCLUDE_TOP)\stx\libbasic\ExternalStructure.$(H) $(INCLUDE_TOP)\stx\libbasic\ExternalBytes.$(H) $(INCLUDE_TOP)\stx\libbasic\UninterpretedBytes.$(H) $(INCLUDE_TOP)\stx\libbasic\ArrayedCollection.$(H) $(INCLUDE_TOP)\stx\libbasic\SequenceableCollection.$(H) $(INCLUDE_TOP)\stx\libbasic\Collection.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
 $(OUTDIR)extensions.$(O): extensions.st $(INCLUDE_TOP)\stx\libview\DeviceGraphicsContext.$(H) $(INCLUDE_TOP)\stx\libview\GraphicsContext.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(INCLUDE_TOP)\stx\libview\GraphicsDevice.$(H) $(INCLUDE_TOP)\stx\libview\SimpleView.$(H) $(INCLUDE_TOP)\stx\libview\DisplaySurface.$(H) $(INCLUDE_TOP)\stx\libview\GraphicsMedium.$(H) $(INCLUDE_TOP)\stx\libview\XWorkstation.$(H) $(INCLUDE_TOP)\stx\libview\DeviceWorkstation.$(H) $(INCLUDE_TOP)\stx\libview\HostGraphicsDevice.$(H) $(INCLUDE_TOP)\nil\Cairo.$(H) $(INCLUDE_TOP)\stx\libbasic\NameSpace.$(H) $(STCHDR)
 
 # ENDMAKEDEPEND --- do not remove this line
--- a/extensions.st	Sun Jun 17 07:04:40 2012 +0000
+++ b/extensions.st	Sun Jun 17 14:49:30 2012 +0000
@@ -139,16 +139,18 @@
 
     | surface |
     surface := Cairo::Surface
-		forXlib: displayId
-		drawable: view drawableId address
-		visual: self defaultVisual
-		width: view width
-		height: view height.
+                forXlib: displayId
+                drawable: view drawableId address
+                visual: self defaultVisual
+                width: view width
+                height: view height.
+    surface setView: view.
     "/view addDependent: surface.
     ^surface
 
     "Created: / 10-07-2008 / 10:16:36 / Jan Vrany <vranyj1@fel.cvut.cz>"
     "Modified: / 09-09-2008 / 22:57:22 / Jan Vrany <vranyj1@fel.cvut.cz>"
+    "Modified: / 17-06-2012 / 15:05:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !stx_goodies_libcairo class methodsFor:'documentation'!
--- a/libcairo.rc	Sun Jun 17 07:04:40 2012 +0000
+++ b/libcairo.rc	Sun Jun 17 14:49:30 2012 +0000
@@ -3,7 +3,7 @@
 // automagically generated from the projectDefinition: stx_goodies_libcairo.
 //
 VS_VERSION_INFO VERSIONINFO
-  FILEVERSION     6,2,16,16
+  FILEVERSION     6,2,17,17
   PRODUCTVERSION  6,2,1,1
 #if (__BORLANDC__)
   FILEFLAGSMASK   VS_FF_DEBUG | VS_FF_PRERELEASE
@@ -20,12 +20,12 @@
     BEGIN
       VALUE "CompanyName", "CTU FEI\0"
       VALUE "FileDescription", "Cairo bindings (http://www.cairographics.org) (LIB)\0"
-      VALUE "FileVersion", "6.2.16.16\0"
+      VALUE "FileVersion", "6.2.17.17\0"
       VALUE "InternalName", "stx:goodies/libcairo\0"
       VALUE "LegalCopyright", "Copyright Jan Vrany 2008\0"
       VALUE "ProductName", "Cairo\0"
       VALUE "ProductVersion", "6.2.1.1\0"
-      VALUE "ProductDate", "Sun, 17 Jun 2012 07:08:20 GMT\0"
+      VALUE "ProductDate", "Sun, 17 Jun 2012 13:54:51 GMT\0"
     END
 
   END