class: GraphicsMedium
authorClaus Gittinger <cg@exept.de>
Tue, 23 Apr 2013 14:23:08 +0200
changeset 6045 0e3df803d990
parent 6044 c763be7599ad
child 6046 66cadbdbe9cf
class: GraphicsMedium gc setup & comment
GraphicsMedium.st
--- a/GraphicsMedium.st	Fri Apr 19 11:38:11 2013 +0200
+++ b/GraphicsMedium.st	Tue Apr 23 14:23:08 2013 +0200
@@ -9,7 +9,6 @@
  other person.  No title to or ownership of the software is
  hereby transferred.
 "
-
 "{ Package: 'stx:libview' }"
 
 DeviceGraphicsContext subclass:#GraphicsMedium
@@ -115,9 +114,9 @@
     |oldPaint|
 
     oldPaint := paint.
-    self paint:aColor.
-    self fillRectangleX:aRectangle left y:aRectangle top width:aRectangle width height:aRectangle height.
-    self paint:oldPaint
+    gc paint:aColor.
+    gc fillRectangleX:aRectangle left y:aRectangle top width:aRectangle width height:aRectangle height.
+    gc paint:oldPaint
 !
 
 fillBlack:aRectangle
@@ -346,9 +345,9 @@
     |oldPaint|
 
     oldPaint := paint.
-    self paint:bgPaint.
-    self fillRectangleX:left y:top width:w height:h.
-    self paint:oldPaint
+    gc paint:bgPaint.
+    gc fillRectangleX:left y:top width:w height:h.
+    gc paint:oldPaint
 
     "Modified: 28.5.1996 / 20:14:11 / cg"
 !
@@ -371,9 +370,9 @@
     |oldPaint|
 
     oldPaint := paint.
-    self paint:something.
-    self fillRectangleX:0 y:0 width:width height:height.
-    self paint:oldPaint
+    gc paint:something.
+    gc fillRectangleX:0 y:0 width:width height:height.
+    gc paint:oldPaint
 
     "Modified: 28.5.1996 / 20:13:29 / cg"
 !
@@ -381,15 +380,15 @@
 invertRectangle:aRectangle
     "invert a rectangle in the receiver"
 
-    self xoring:[
-	self fillRectangle:aRectangle
+    gc xoring:[
+        gc fillRectangle:aRectangle
     ]
 !
 
 white
     "fill the receiver with white"
 
-    self fill:White
+    gc fill:White
 ! !
 
 !GraphicsMedium methodsFor:'initialization'!
@@ -402,6 +401,15 @@
     width := 0.
     height := 0.
     realized := false.
+
+    "/ in the future, gc will be set to some object which really does
+    "/ all the graphics work, and the drawXXX drawing operation methods 
+    "/ will be changed to forward to it. Then, GraphicsMedium will no longer inherit
+    "/ from DeviceGraphicsContext.
+    "/ In the meantime (the intermediate migration phase), gc is set to alias self,
+    "/ so we are backward compatible.
+    "/ During the migration, all self drawXXX operations should be changed to gc drawXXX
+    gc := self.
 !
 
 setRealized:aBoolean
@@ -415,5 +423,6 @@
 !GraphicsMedium class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/GraphicsMedium.st,v 1.19 2009-08-07 10:52:03 sr Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/GraphicsMedium.st,v 1.20 2013-04-23 12:23:08 cg Exp $'
 ! !
+