--- a/Cairo__Surface.st Sat Mar 05 20:22:21 2016 +0000
+++ b/Cairo__Surface.st Mon Mar 21 22:28:05 2016 +0000
@@ -157,6 +157,12 @@
!Surface methodsFor:'accessing'!
+cairo
+ ^ GraphicsContext onSurface: self
+
+ "Created: / 05-03-2016 / 22:25:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
referenceCount
"Return value or reference counter"
@@ -229,6 +235,36 @@
"Created: / 24-02-2016 / 17:14:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
+!Surface methodsFor:'initialization'!
+
+initialize
+ super initialize.
+ self class == Cairo::Surface ifTrue:[
+ | type |
+
+ type := self type.
+ type == CAIRO_SURFACE_TYPE_IMAGE ifTrue:[
+ self changeClassTo: SurfaceImage.
+ ^ self.
+ ].
+ type == CAIRO_SURFACE_TYPE_XLIB ifTrue:[
+ self changeClassTo: SurfaceXlib.
+ ^ self.
+ ].
+ type == CAIRO_SURFACE_TYPE_WIN32 ifTrue:[
+ self changeClassTo: SurfaceWin32.
+ ^ self.
+ ].
+ type == CAIRO_SURFACE_TYPE_PDF ifTrue:[
+ self changeClassTo: SurfacePDF.
+ ^ self.
+ ].
+ ].
+
+ "Created: / 04-03-2016 / 00:45:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 05-03-2016 / 22:21:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
!Surface methodsFor:'private'!
destroy
@@ -242,6 +278,18 @@
"Created: / 28-12-2014 / 22:10:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 13-02-2016 / 16:10:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+reference
+ "Increases the reference count on the receiver by one. This prevents the
+ receiver from being destroyed until a matching call to #destroy is made.
+
+ This method must be called whenever Cairo documentation says so,
+ check comment on return value for methods returning a Cairo object"
+
+ CPrimitives cairo_surface_reference: self
+
+ "Modified: / 05-03-2016 / 10:33:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!Surface methodsFor:'queries'!