--- a/Cairo__Surface.st Mon Dec 29 00:14:00 2014 +0100
+++ b/Cairo__Surface.st Fri Jan 02 12:46:59 2015 +0100
@@ -3,7 +3,7 @@
"{ NameSpace: Cairo }"
CObject subclass:#Surface
- instanceVariableNames:'view'
+ instanceVariableNames:'view drawable'
classVariableNames:''
poolDictionaries:'Cairo::SurfaceType Cairo::Format'
category:'Cairo-Objects'
@@ -110,6 +110,23 @@
!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:[
@@ -137,6 +154,13 @@
"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:[
@@ -179,6 +203,17 @@
!Surface methodsFor:'initialization & release'!
+destroy
+ "Tell Cairo library to destroy the corresponding C object.
+ Remember that object is physically destroyed only if internal
+ refcounter goes to zero. However, after calling destroy,
+ this instance should be treated as invalid."
+
+ ^ CPrimitives cairo_surface_destroy: self
+
+ "Created: / 28-12-2014 / 22:10:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
finish
^CPrimitives cairo_surface_finish: self
@@ -195,6 +230,16 @@
"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:[
@@ -206,19 +251,6 @@
"Created: / 17-06-2012 / 15:04:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
-!Surface methodsFor:'private'!
-
-destroy
- "Tell Cairo library to destroy the corresponding C object.
- Remember that object is physically destroyed only if internal
- refcounter goes to zero. However, after calling destroy,
- this instance should be treated as invalid."
-
- ^ CPrimitives cairo_surface_destroy: self
-
- "Created: / 28-12-2014 / 22:10:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-! !
-
!Surface methodsFor:'queries'!
isViewSurface