Split classes for individual surfaces
authorJan Vrany <jan.vrany@fit.cvut.cz>
Sun, 14 Feb 2016 00:15:15 +0000
changeset 38 9c94e463018a
parent 37 5b0ad652d45f
child 39 8af34937e1ec
Split classes for individual surfaces
Cairo__CPrimitives.st
Cairo__Surface.st
Cairo__SurfaceImage.st
Cairo__SurfacePDF.st
Cairo__SurfaceXlib.st
Make.proto
Make.spec
abbrev.stc
bc.mak
extensions.st
libInit.cc
stx_goodies_libcairo.st
--- a/Cairo__CPrimitives.st	Sat Feb 13 23:24:38 2016 +0000
+++ b/Cairo__CPrimitives.st	Sun Feb 14 00:15:15 2016 +0000
@@ -599,8 +599,10 @@
 
 cairo_image_surface_create: format _: width _: height
 
-    <cdecl: Cairo::Surface "cairo_image_surface_create" ( int32 int32 int32 ) >
+    <cdecl: Cairo::SurfaceImage "cairo_image_surface_create" ( int32 int32 int32 ) >
     self primitiveFailed
+
+    "Modified (format): / 14-02-2016 / 00:03:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 cairo_image_surface_create_for_data: data _: format _: width _: height _: stride
@@ -1049,8 +1051,10 @@
 
 cairo_pdf_surface_create: filename _: width_in_points _: height_in_points
 
-    <cdecl: Cairo::Surface "cairo_pdf_surface_create" ( charPointer double double ) >
+    <cdecl: Cairo::SurfacePDF "cairo_pdf_surface_create" ( charPointer double double ) >
     self primitiveFailed
+
+    "Modified (format): / 14-02-2016 / 00:03:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 cairo_pdf_surface_create_for_stream: write_func _: closure _: width_in_points _: height_in_points
@@ -2081,8 +2085,10 @@
 
 cairo_xlib_surface_create: dpy _: drawable _: visual _: width _: height
 
-    <cdecl: Cairo::Surface "cairo_xlib_surface_create" ( pointer long pointer int32 int32 ) >
+    <cdecl: Cairo::SurfaceXlib "cairo_xlib_surface_create" ( pointer long pointer int32 int32 ) >
     self primitiveFailed
+
+    "Modified (format): / 13-02-2016 / 23:52:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 cairo_xlib_surface_create_for_bitmap: dpy _: bitmap _: screen _: width _: height
--- a/Cairo__Surface.st	Sat Feb 13 23:24:38 2016 +0000
+++ b/Cairo__Surface.st	Sun Feb 14 00:15:15 2016 +0000
@@ -12,45 +12,69 @@
 
 !Surface class methodsFor:'instance creation'!
 
-forImageFormat: format width: width height: height 
+forView: aView
+    ^ self onView: aView
 
-    ^CPrimitives cairo_image_surface_create: format _: width _: height
+    "Created: / 10-07-2008 / 10:15:04 / Jan Vrany <vranyj1@fel.cvut.cz>"
+    "Modified: / 14-02-2016 / 00:01:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+newImageWithFormat:format width:width height:height 
+    ^ CPrimitives 
+        cairo_image_surface_create:format
+        _:width
+        _:height
 
     "Created: / 24-12-2014 / 23:43:48 / Jan Vrany <jan.vrany@fit.cvut.cz>"
     "Modified: / 28-12-2014 / 22:03:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
-forImageFormatARGB32width: width height: height 
-
-    ^self forImageFormat: CAIRO_FORMAT_ARGB32 width: width height: height
+newImageWithFormatARGB32width:width height:height 
+    ^ self 
+        newImageWithFormat:CAIRO_FORMAT_ARGB32
+        width:width
+        height:height
 
     "Created: / 24-12-2014 / 23:44:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
     "Modified: / 28-12-2014 / 22:04:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
-forPdfFile: aStringOrFilename width: w height: h
-
-    ^CPrimitives cairo_pdf_surface_create: aStringOrFilename asFilename asString
-        _: w asDouble 
-        _: h asDouble
+newPDFWithFile:aStringOrFilename width:w height:h 
+    ^ CPrimitives 
+        cairo_pdf_surface_create:aStringOrFilename asFilename asString
+        _:w asDouble
+        _:h asDouble
 
     "Created: / 10-07-2008 / 09:35:34 / Jan Vrany <vranyj1@fel.cvut.cz>"
     "Modified: / 28-12-2014 / 22:05:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
-forView: view
-
-    ^view device cairoSurfaceFor: view
-
-    "Created: / 10-07-2008 / 10:15:04 / Jan Vrany <vranyj1@fel.cvut.cz>"
-!
-
-forXlib: dpy drawable: drawable visual: visual width: width height: height 
-
-    ^CPrimitives cairo_xlib_surface_create: dpy _: drawable _: visual _: width _: height
+newXlibWithDisplay:dpy drawable:drawable visual:visual width:width height:height 
+    ^ CPrimitives 
+        cairo_xlib_surface_create:dpy
+        _:drawable
+        _:visual
+        _:width
+        _:height
 
     "Created: / 10-07-2008 / 11:06:22 / Jan Vrany <vranyj1@fel.cvut.cz>"
     "Modified: / 28-12-2014 / 22:06:28 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+onView: aView
+    aView device platformName == #X11 ifTrue:[
+        | surface |
+        surface := self newXlibWithDisplay:aView device displayId
+                                  drawable:aView drawableId address
+                                    visual:aView device queryDefaultVisual
+                                     width:aView width
+                                    height:aView height.  
+        surface setView: aView.
+        ^ surface.
+    ].
+    self error: 'Unsupported plarform'
+
+    "Created: / 13-02-2016 / 23:47:50 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !Surface class methodsFor:'accessing'!
@@ -110,35 +134,6 @@
 
 !Surface methodsFor:'accessing'!
 
-device
-    ^ view graphicsDevice
-
-    "Created: / 29-12-2014 / 18:44:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-drawable
-    drawable isNil ifTrue:[
-        self type == CAIRO_SURFACE_TYPE_XLIB ifTrue:[ 
-            drawable := CPrimitives cairo_xlib_surface_get_drawable: self
-        ].
-    ].
-    ^ drawable
-
-    "Created: / 02-01-2015 / 12:41:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-height
-
-    self type == CAIRO_SURFACE_TYPE_XLIB ifTrue:[
-        ^ CPrimitives cairo_xlib_surface_get_height: self 
-    ].
-
-    self error:'Operation not supported'
-
-    "Created: / 17-06-2012 / 15:37:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 28-12-2014 / 21:50:12 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
 referenceCount
     "Return value or reference counter"
 
@@ -152,53 +147,6 @@
 
     "Created: / 10-07-2008 / 10:34:36 / Jan Vrany <vranyj1@fel.cvut.cz>"
     "Modified: / 28-12-2014 / 21:46:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-view
-    "Return underlying view or nil if none"
-    ^ view
-
-    "Modified (comment): / 29-12-2014 / 00:57:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-width
-
-    self type == CAIRO_SURFACE_TYPE_XLIB ifTrue:[
-        ^ CPrimitives cairo_xlib_surface_get_width: self 
-    ].
- 
-    self error:'Operation not supported'
-
-    "Created: / 17-06-2012 / 15:37:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 28-12-2014 / 21:50:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-width: w height: h
-    self type == CAIRO_SURFACE_TYPE_XLIB ifTrue:[
-        ^ CPrimitives cairo_xlib_surface_set_size: self _: w _: h 
-    ].
-
-    self error:'Operation not supported'
-
-    "Created: / 10-07-2008 / 19:36:39 / Jan Vrany <vranyj1@fel.cvut.cz>"
-    "Modified: / 28-12-2014 / 21:52:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-! !
-
-!Surface methodsFor:'change & update'!
-
-update: aspect with: param from: sender
-
-    (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'!
@@ -230,27 +178,6 @@
 
     "Created: / 10-07-2008 / 10:32:50 / Jan Vrany <vranyj1@fel.cvut.cz>"
     "Modified: / 28-12-2014 / 21:48:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-release
-    view notNil ifTrue:[  
-        view removeDependent: self.
-        view := nil.
-    ].
-    super release
-
-    "Created: / 29-12-2014 / 12:09:18 / Jan Vrany <jan.vrany@fit.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'!
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Cairo__SurfaceImage.st	Sun Feb 14 00:15:15 2016 +0000
@@ -0,0 +1,11 @@
+"{ Package: 'stx:goodies/libcairo' }"
+
+"{ NameSpace: Cairo }"
+
+Surface subclass:#SurfaceImage
+	instanceVariableNames:''
+	classVariableNames:''
+	poolDictionaries:''
+	category:'Cairo-Objects'
+!
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Cairo__SurfacePDF.st	Sun Feb 14 00:15:15 2016 +0000
@@ -0,0 +1,11 @@
+"{ Package: 'stx:goodies/libcairo' }"
+
+"{ NameSpace: Cairo }"
+
+Surface subclass:#SurfacePDF
+	instanceVariableNames:''
+	classVariableNames:''
+	poolDictionaries:''
+	category:'Cairo-Objects'
+!
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Cairo__SurfaceXlib.st	Sun Feb 14 00:15:15 2016 +0000
@@ -0,0 +1,112 @@
+"{ Package: 'stx:goodies/libcairo' }"
+
+"{ NameSpace: Cairo }"
+
+Surface subclass:#SurfaceXlib
+	instanceVariableNames:''
+	classVariableNames:''
+	poolDictionaries:''
+	category:'Cairo-Objects'
+!
+
+!SurfaceXlib methodsFor:'accessing'!
+
+device
+    ^ view graphicsDevice
+
+    "Created: / 29-12-2014 / 18:44:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+drawable
+    drawable isNil ifTrue:[
+        self type == CAIRO_SURFACE_TYPE_XLIB ifTrue:[ 
+            drawable := CPrimitives cairo_xlib_surface_get_drawable: self
+        ].
+    ].
+    ^ drawable
+
+    "Created: / 02-01-2015 / 12:41:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+height
+
+    self type == CAIRO_SURFACE_TYPE_XLIB ifTrue:[
+        ^ CPrimitives cairo_xlib_surface_get_height: self 
+    ].
+
+    self error:'Operation not supported'
+
+    "Created: / 17-06-2012 / 15:37:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 28-12-2014 / 21:50:12 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+view
+    "Return underlying view or nil if none"
+    ^ view
+
+    "Modified (comment): / 29-12-2014 / 00:57:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+width
+
+    self type == CAIRO_SURFACE_TYPE_XLIB ifTrue:[
+        ^ CPrimitives cairo_xlib_surface_get_width: self 
+    ].
+ 
+    self error:'Operation not supported'
+
+    "Created: / 17-06-2012 / 15:37:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 28-12-2014 / 21:50:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+width: w height: h
+    self type == CAIRO_SURFACE_TYPE_XLIB ifTrue:[
+        ^ CPrimitives cairo_xlib_surface_set_size: self _: w _: h 
+    ].
+
+    self error:'Operation not supported'
+
+    "Created: / 10-07-2008 / 19:36:39 / Jan Vrany <vranyj1@fel.cvut.cz>"
+    "Modified: / 28-12-2014 / 21:52:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!SurfaceXlib methodsFor:'change & update'!
+
+update: aspect with: param from: sender
+
+    (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>"
+! !
+
+!SurfaceXlib methodsFor:'initialization & release'!
+
+release
+    view notNil ifTrue:[  
+        view removeDependent: self.
+        view := nil.
+    ].
+    super release
+
+    "Created: / 29-12-2014 / 12:09:18 / Jan Vrany <jan.vrany@fit.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>"
+! !
+
--- a/Make.proto	Sat Feb 13 23:24:38 2016 +0000
+++ b/Make.proto	Sun Feb 14 00:15:15 2016 +0000
@@ -193,7 +193,10 @@
 $(OUTDIR)Cairo__Pattern.$(O) Cairo__Pattern.$(H): Cairo__Pattern.st $(INCLUDE_TOP)/stx/goodies/libcairo/Cairo__CObject.$(H) $(INCLUDE_TOP)/stx/libbasic/ExternalAddress.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
 $(OUTDIR)Cairo__Surface.$(O) Cairo__Surface.$(H): Cairo__Surface.st $(INCLUDE_TOP)/stx/goodies/libcairo/Cairo__CObject.$(H) $(INCLUDE_TOP)/stx/goodies/libcairo/Cairo__Format.$(H) $(INCLUDE_TOP)/stx/goodies/libcairo/Cairo__SurfaceType.$(H) $(INCLUDE_TOP)/stx/libbasic/ExternalAddress.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
 $(OUTDIR)CairoGraphicsContext.$(O) CairoGraphicsContext.$(H): CairoGraphicsContext.st $(INCLUDE_TOP)/stx/goodies/libcairo/Cairo__FontSlant.$(H) $(INCLUDE_TOP)/stx/goodies/libcairo/Cairo__FontWeight.$(H) $(INCLUDE_TOP)/stx/goodies/libcairo/Cairo__Format.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(INCLUDE_TOP)/stx/libview/DeviceGraphicsContext.$(H) $(INCLUDE_TOP)/stx/libview/GraphicsContext.$(H) $(STCHDR)
-$(OUTDIR)extensions.$(O): extensions.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(INCLUDE_TOP)/stx/libview/DeviceGraphicsContext.$(H) $(INCLUDE_TOP)/stx/libview/DeviceWorkstation.$(H) $(INCLUDE_TOP)/stx/libview/DisplaySurface.$(H) $(INCLUDE_TOP)/stx/libview/GraphicsContext.$(H) $(INCLUDE_TOP)/stx/libview/GraphicsDevice.$(H) $(INCLUDE_TOP)/stx/libview/GraphicsMedium.$(H) $(INCLUDE_TOP)/stx/libview/HostGraphicsDevice.$(H) $(INCLUDE_TOP)/stx/libview/Image.$(H) $(INCLUDE_TOP)/stx/libview/SimpleView.$(H) $(INCLUDE_TOP)/stx/libview/XGraphicsContext.$(H) $(INCLUDE_TOP)/stx/libview/XWorkstation.$(H) $(STCHDR)
+$(OUTDIR)Cairo__SurfaceImage.$(O) Cairo__SurfaceImage.$(H): Cairo__SurfaceImage.st $(INCLUDE_TOP)/stx/goodies/libcairo/Cairo__CObject.$(H) $(INCLUDE_TOP)/stx/goodies/libcairo/Cairo__Surface.$(H) $(INCLUDE_TOP)/stx/libbasic/ExternalAddress.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)Cairo__SurfacePDF.$(O) Cairo__SurfacePDF.$(H): Cairo__SurfacePDF.st $(INCLUDE_TOP)/stx/goodies/libcairo/Cairo__CObject.$(H) $(INCLUDE_TOP)/stx/goodies/libcairo/Cairo__Surface.$(H) $(INCLUDE_TOP)/stx/libbasic/ExternalAddress.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)Cairo__SurfaceXlib.$(O) Cairo__SurfaceXlib.$(H): Cairo__SurfaceXlib.st $(INCLUDE_TOP)/stx/goodies/libcairo/Cairo__CObject.$(H) $(INCLUDE_TOP)/stx/goodies/libcairo/Cairo__Surface.$(H) $(INCLUDE_TOP)/stx/libbasic/ExternalAddress.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)extensions.$(O): extensions.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(INCLUDE_TOP)/stx/libview/DeviceGraphicsContext.$(H) $(INCLUDE_TOP)/stx/libview/DisplaySurface.$(H) $(INCLUDE_TOP)/stx/libview/GraphicsContext.$(H) $(INCLUDE_TOP)/stx/libview/GraphicsDevice.$(H) $(INCLUDE_TOP)/stx/libview/GraphicsMedium.$(H) $(INCLUDE_TOP)/stx/libview/Image.$(H) $(INCLUDE_TOP)/stx/libview/SimpleView.$(H) $(STCHDR)
 
 # ENDMAKEDEPEND --- do not remove this line
 
--- a/Make.spec	Sat Feb 13 23:24:38 2016 +0000
+++ b/Make.spec	Sun Feb 14 00:15:15 2016 +0000
@@ -100,6 +100,9 @@
 	Cairo::Pattern \
 	Cairo::Surface \
 	CairoGraphicsContext \
+	Cairo::SurfaceImage \
+	Cairo::SurfacePDF \
+	Cairo::SurfaceXlib \
 
 
 
@@ -154,6 +157,9 @@
     $(OUTDIR_SLASH)Cairo__Pattern.$(O) \
     $(OUTDIR_SLASH)Cairo__Surface.$(O) \
     $(OUTDIR_SLASH)CairoGraphicsContext.$(O) \
+    $(OUTDIR_SLASH)Cairo__SurfaceImage.$(O) \
+    $(OUTDIR_SLASH)Cairo__SurfacePDF.$(O) \
+    $(OUTDIR_SLASH)Cairo__SurfaceXlib.$(O) \
     $(OUTDIR_SLASH)extensions.$(O) \
 
 
--- a/abbrev.stc	Sat Feb 13 23:24:38 2016 +0000
+++ b/abbrev.stc	Sun Feb 14 00:15:15 2016 +0000
@@ -50,3 +50,6 @@
 Cairo::Pattern Cairo__Pattern stx:goodies/libcairo 'Cairo-Objects' 0
 Cairo::Surface Cairo__Surface stx:goodies/libcairo 'Cairo-Objects' 0
 CairoGraphicsContext CairoGraphicsContext stx:goodies/libcairo 'Cairo-Compatibility' 0
+Cairo::SurfaceImage Cairo__SurfaceImage stx:goodies/libcairo 'Cairo-Objects' 0
+Cairo::SurfacePDF Cairo__SurfacePDF stx:goodies/libcairo 'Cairo-Objects' 0
+Cairo::SurfaceXlib Cairo__SurfaceXlib stx:goodies/libcairo 'Cairo-Objects' 0
--- a/bc.mak	Sat Feb 13 23:24:38 2016 +0000
+++ b/bc.mak	Sun Feb 14 00:15:15 2016 +0000
@@ -118,7 +118,10 @@
 $(OUTDIR)Cairo__Pattern.$(O) Cairo__Pattern.$(H): Cairo__Pattern.st $(INCLUDE_TOP)\stx\goodies\libcairo\Cairo__CObject.$(H) $(INCLUDE_TOP)\stx\libbasic\ExternalAddress.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
 $(OUTDIR)Cairo__Surface.$(O) Cairo__Surface.$(H): Cairo__Surface.st $(INCLUDE_TOP)\stx\goodies\libcairo\Cairo__CObject.$(H) $(INCLUDE_TOP)\stx\goodies\libcairo\Cairo__Format.$(H) $(INCLUDE_TOP)\stx\goodies\libcairo\Cairo__SurfaceType.$(H) $(INCLUDE_TOP)\stx\libbasic\ExternalAddress.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
 $(OUTDIR)CairoGraphicsContext.$(O) CairoGraphicsContext.$(H): CairoGraphicsContext.st $(INCLUDE_TOP)\stx\goodies\libcairo\Cairo__FontSlant.$(H) $(INCLUDE_TOP)\stx\goodies\libcairo\Cairo__FontWeight.$(H) $(INCLUDE_TOP)\stx\goodies\libcairo\Cairo__Format.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(INCLUDE_TOP)\stx\libview\DeviceGraphicsContext.$(H) $(INCLUDE_TOP)\stx\libview\GraphicsContext.$(H) $(STCHDR)
-$(OUTDIR)extensions.$(O): extensions.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(INCLUDE_TOP)\stx\libview\DeviceGraphicsContext.$(H) $(INCLUDE_TOP)\stx\libview\DeviceWorkstation.$(H) $(INCLUDE_TOP)\stx\libview\DisplaySurface.$(H) $(INCLUDE_TOP)\stx\libview\GraphicsContext.$(H) $(INCLUDE_TOP)\stx\libview\GraphicsDevice.$(H) $(INCLUDE_TOP)\stx\libview\GraphicsMedium.$(H) $(INCLUDE_TOP)\stx\libview\HostGraphicsDevice.$(H) $(INCLUDE_TOP)\stx\libview\Image.$(H) $(INCLUDE_TOP)\stx\libview\SimpleView.$(H) $(INCLUDE_TOP)\stx\libview\XGraphicsContext.$(H) $(INCLUDE_TOP)\stx\libview\XWorkstation.$(H) $(STCHDR)
+$(OUTDIR)Cairo__SurfaceImage.$(O) Cairo__SurfaceImage.$(H): Cairo__SurfaceImage.st $(INCLUDE_TOP)\stx\goodies\libcairo\Cairo__CObject.$(H) $(INCLUDE_TOP)\stx\goodies\libcairo\Cairo__Surface.$(H) $(INCLUDE_TOP)\stx\libbasic\ExternalAddress.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)Cairo__SurfacePDF.$(O) Cairo__SurfacePDF.$(H): Cairo__SurfacePDF.st $(INCLUDE_TOP)\stx\goodies\libcairo\Cairo__CObject.$(H) $(INCLUDE_TOP)\stx\goodies\libcairo\Cairo__Surface.$(H) $(INCLUDE_TOP)\stx\libbasic\ExternalAddress.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)Cairo__SurfaceXlib.$(O) Cairo__SurfaceXlib.$(H): Cairo__SurfaceXlib.st $(INCLUDE_TOP)\stx\goodies\libcairo\Cairo__CObject.$(H) $(INCLUDE_TOP)\stx\goodies\libcairo\Cairo__Surface.$(H) $(INCLUDE_TOP)\stx\libbasic\ExternalAddress.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)extensions.$(O): extensions.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(INCLUDE_TOP)\stx\libview\DeviceGraphicsContext.$(H) $(INCLUDE_TOP)\stx\libview\DisplaySurface.$(H) $(INCLUDE_TOP)\stx\libview\GraphicsContext.$(H) $(INCLUDE_TOP)\stx\libview\GraphicsDevice.$(H) $(INCLUDE_TOP)\stx\libview\GraphicsMedium.$(H) $(INCLUDE_TOP)\stx\libview\Image.$(H) $(INCLUDE_TOP)\stx\libview\SimpleView.$(H) $(STCHDR)
 
 # ENDMAKEDEPEND --- do not remove this line
 
--- a/extensions.st	Sat Feb 13 23:24:38 2016 +0000
+++ b/extensions.st	Sun Feb 14 00:15:15 2016 +0000
@@ -17,6 +17,18 @@
     "Modified: / 13-02-2016 / 15:59:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
+!DeviceGraphicsContext methodsFor:'accessing'!
+
+cairoSurface
+    | view surface |
+
+    view := device viewFromId:drawableId.
+    surface := Cairo::Surface onView: view.
+    ^ surface
+
+    "Modified: / 14-02-2016 / 00:10:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
 !DeviceGraphicsContext methodsFor:'cairo support'!
 
 drawableId
@@ -218,8 +230,8 @@
     | image_surface image_cr |
 
     [     
-        image_surface := Cairo::Surface forImageFormatARGB32width: self width  height: self height.
-        image_surface setView: self.
+        image_surface := Cairo::Surface newImageWithFormatARGB32width:self width
+                               height:self height.
         image_cr := Cairo::GraphicsContext onSurface: image_surface. 
         self redrawWithCairo: image_cr.  
         view_cr setSourceSurface: image_surface. 
@@ -230,7 +242,7 @@
     ].
 
     "Created: / 27-12-2014 / 00:13:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 29-12-2014 / 11:29:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 14-02-2016 / 00:13:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !SimpleView methodsFor:'redrawing - cairo'!
@@ -240,8 +252,8 @@
     | image_surface image_cr |
 
     [     
-        image_surface := Cairo::Surface forImageFormatARGB32width: self width  height: self height.
-        image_surface setView: self.
+        image_surface := Cairo::Surface newImageWithFormatARGB32width:self width
+                               height:self height.
         image_cr := Cairo::GraphicsContext onSurface: image_surface. 
         image_cr rectangleX: x  y: y width: w height: h. 
         image_cr clip.
@@ -256,7 +268,7 @@
     ].
 
     "Created: / 27-12-2014 / 00:28:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 13-02-2016 / 17:02:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 14-02-2016 / 00:12:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !SimpleView methodsFor:'redrawing - cairo'!
@@ -291,45 +303,6 @@
     "Modified: / 12-02-2016 / 16:38:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
-!XGraphicsContext methodsFor:'accessing'!
-
-cairoSurface
-    | view |
-
-    view := device viewFromId:drawableId.
-    cairoSurfaceId isNil ifTrue:[
-        cairoSurfaceId := device cairoSurfaceFor:view.
-        ^ cairoSurfaceId
-    ].
-     
-    "/ Adjust width and height    
-    cairoSurfaceId width:view width height:view height.
-    ^ cairoSurfaceId
-
-    "Modified: / 26-12-2014 / 23:30:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified (comment): / 13-02-2016 / 16:20:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-! !
-
-!XWorkstation methodsFor:'cairo support'!
-
-cairoSurfaceFor: view
-
-    | surface |
-    surface := Cairo::Surface
-                forXlib: displayId
-                drawable: view drawableId address
-                visual: self queryDefaultVisual
-                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: / 21-09-2014 / 00:54:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-! !
-
 !stx_goodies_libcairo class methodsFor:'documentation'!
 
 extensionsVersion_HG
--- a/libInit.cc	Sat Feb 13 23:24:38 2016 +0000
+++ b/libInit.cc	Sun Feb 14 00:15:15 2016 +0000
@@ -76,6 +76,9 @@
 _Cairo__Pattern_Init(pass,__pRT__,snd);
 _Cairo__Surface_Init(pass,__pRT__,snd);
 _CairoGraphicsContext_Init(pass,__pRT__,snd);
+_Cairo__SurfaceImage_Init(pass,__pRT__,snd);
+_Cairo__SurfacePDF_Init(pass,__pRT__,snd);
+_Cairo__SurfaceXlib_Init(pass,__pRT__,snd);
 
 _stx_137goodies_137libcairo_extensions_Init(pass,__pRT__,snd);
 __END_PACKAGE__();
--- a/stx_goodies_libcairo.st	Sat Feb 13 23:24:38 2016 +0000
+++ b/stx_goodies_libcairo.st	Sun Feb 14 00:15:15 2016 +0000
@@ -166,6 +166,9 @@
         #'Cairo::Pattern'
         #'Cairo::Surface'
         CairoGraphicsContext
+        #'Cairo::SurfaceImage'
+        #'Cairo::SurfacePDF'
+        #'Cairo::SurfaceXlib'
     )
 !
 
@@ -178,7 +181,6 @@
         GraphicsDevice cairoSurfaceFor:
         GraphicsDevice displayId
         SimpleView cairo
-        XWorkstation cairoSurfaceFor:
         SimpleView redrawWithCairo
         SimpleView redrawWithCairo:x:y:width:height:
         SimpleView redrawWithCairoBuffered
@@ -187,15 +189,13 @@
         SimpleView redrawWithCairoBufferedX:y:width:height:
         SimpleView redrawWithCairoX:y:width:height:
         DeviceGraphicsContext cairo
-        XGraphicsContext cairoSurface
         Image bitsARGB32Into:stride:fg:bg:
         Image inspector2TabImageCairo
         GraphicsContext displayDeviceLineFromX:y:toX:y:
         GraphicsContext displayDeviceRectangleX:y:width:height:
         GraphicsContext fillDeviceRectangleX:y:width:height:
+        DeviceGraphicsContext cairoSurface
     )
-
-    "Modified: / 13-02-2016 / 17:05:28 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !stx_goodies_libcairo class methodsFor:'description - project information'!