#REFACTORING by stefan
class: GraphicsContext
removed:8 methods
remove obsolete methods (already defined in GraphicsMEdium)
comment/format in:
#blackColor
#whiteColor
changed:
#clippedTo:do: (send #clippingBounds: instead of #clippingRectangle:)
#displayHorizontalWavelineFromX:y:toX: (send #clippingBounds: instead of #clippingRectangle:, send #clippingBoundsOrNil instead of #clippingRectangleOrNil)
--- a/GraphicsContext.st Sat Jul 23 21:49:58 2016 +0200
+++ b/GraphicsContext.st Sat Jul 23 21:50:18 2016 +0200
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
"
COPYRIGHT (c) 1992 by Claus Gittinger
All Rights Reserved
@@ -692,6 +694,9 @@
!
blackColor
+ "return the black color on this device.
+ This is the same as 'Color black onDevice:self device', but much faster."
+
^ device blackColor
!
@@ -745,30 +750,6 @@
"Modified (comment): / 25-01-2012 / 00:29:37 / cg"
!
-clipRect
- "return the clip-rectangle for drawing (in logical coordinates).
- If there is currently no active clip, return the underlying
- displaySurfaces (i.e. views) bounds. Added for ST-80 compatibility."
-
- <resource:#obsolete>
-
- self obsoleteMethodWarning:'use #clippingBounds'.
- ^ self clippingBounds.
-
- "Modified: 28.5.1996 / 14:14:53 / cg"
-!
-
-clipRect:aRectangle
- "set the drawing clip-rectangle (in logical coordinates)"
-
- <resource:#obsolete>
-
- self obsoleteMethodWarning:'use #clippingBounds:'.
- ^ self clippingBounds:aRectangle
-
- "Modified: 28.5.1996 / 14:13:09 / cg"
-!
-
clippingBounds
"return the clip-rectangle for drawing (in logical coordinates).
If there is currently no active clip, return the underlying
@@ -820,27 +801,6 @@
"Modified: 28.5.1996 / 14:08:19 / cg"
!
-clippingRectangle:aRectangleOrNil
- <resource: #obsolete>
- "set the clipping rectangle for drawing (in logical coordinates);
- a nil argument turn off clipping (i.e. whole view is drawable)"
-
- self clippingBounds:aRectangleOrNil.
-
- "Modified: 22.5.1996 / 13:12:07 / cg"
- "Created: 28.5.1996 / 14:09:27 / cg"
-!
-
-clippingRectangleOrNil
- <resource: #obsolete>
- "return the clipping rectangle for drawing in logical coordinates, nil if there is none."
-
- ^ clipRect
-
- "Created: 10.4.1996 / 14:32:02 / cg"
- "Modified: 28.5.1996 / 14:08:19 / cg"
-!
-
createFontOnDevice
"make sure, that the font is a device font"
@@ -1025,26 +985,6 @@
"Modified: 12.5.1996 / 19:40:43 / cg"
!
-setMaskOrigin:aPoint
- <resource: #obsolete>
- "set the origin within the mask (used to draw with patterns).
- OBSOLETE: use #maskOrigin: or #phase:"
-
- self obsoleteMethodWarning:'use #maskOrigin:'.
- ^ self maskOriginX:aPoint x y:aPoint y
-
- "Modified: / 26.1.1998 / 18:54:14 / cg"
-!
-
-setMaskOriginX:x y:y
- <resource: #obsolete>
- "set the origin within the mask (used to draw with patterns).
- OBSOLETE: use #maskOriginX:y: or #phase:"
-
- self obsoleteMethodWarning:'use #maskOriginX:y:'.
- ^ self maskOriginX:x y:y
-!
-
viewOrigin
"return the drawables visible origin (for scrolling)"
@@ -1053,7 +993,7 @@
whiteColor
"return the white color on this device.
- This is the same as 'Color white on:self device', but much faster."
+ This is the same as 'Color white onDevice:self device', but much faster."
^ device whiteColor
! !
@@ -1129,27 +1069,6 @@
"Created: 27.4.1996 / 18:47:28 / cg"
! !
-!GraphicsContext methodsFor:'backward compatibility'!
-
-withPattern:aPattern do:aBlock
- <resource: #obsolete>
- |old|
-
- aPattern isColor ifTrue:[
- old := paint.
- self paint:aPattern.
- aBlock value.
- self paint:old
- ] ifFalse:[
- old := mask.
- self mask:aPattern.
- aBlock value.
- self mask:old
- ]
-
- "Modified: 28.5.1996 / 22:45:40 / cg"
-! !
-
!GraphicsContext methodsFor:'basic drawing'!
displayArcX:x y:y width:width height:height from:startAngle angle:angle
@@ -1250,9 +1169,9 @@
"/ w := 8.
pattern := #[
- 2r11001100 2r11001100 2r11001100 2r11001100
- 2r00110011 2r00110011 2r00110011 2r00110011
- ].
+ 2r11001100 2r11001100 2r11001100 2r11001100
+ 2r00110011 2r00110011 2r00110011 2r00110011
+ ].
h := 2.
w := 32.
@@ -1265,15 +1184,15 @@
form := Form width:w height:h fromArray:pattern.
- oldClip := self clippingRectangleOrNil.
- self clippingRectangle:((x0 @ y0) corner:(x1 @ (y0+h))).
+ oldClip := self clippingBoundsOrNil.
+ self clippingBounds:((x0 @ y0) corner:(x1 @ (y0+h))).
x := x0 truncateTo:w.
[x <= x1] whileTrue:[
- self displayForm:form x:x y:y0.
- x := x + w.
+ self displayForm:form x:x y:y0.
+ x := x + w.
].
- self clippingRectangle:oldClip
+ self clippingBounds:oldClip
"Created: / 28-10-1998 / 15:31:41 / cg"
"Modified: / 24-07-2011 / 21:12:24 / cg"
@@ -2266,17 +2185,6 @@
"Modified: 8.5.1996 / 08:42:23 / cg"
!
-fillArcX:x y:y w:w h:h from:startAngle angle:angle
- "draw a filled arc; apply transformation if nonNil"
-
- <resource:#obsolete>
-
- self obsoleteMethodWarning:'use #fillArcX:y:width:height:from:angle:'.
- self fillArcX:x y:y width:w height:h from:startAngle angle:angle
-
- "Modified: 8.5.1996 / 08:47:52 / cg"
-!
-
fillArcX:x y:y width:w height:h from:startAngle to:endAngle
"draw a filled arc in a box, given startAngle and endAngle."
@@ -2445,12 +2353,10 @@
|oldClip|
oldClip := clipRect.
- self clippingRectangle:aRectangle.
-
- aBlock
- ensure:[
- self clippingRectangle:oldClip
- ]
+ self clippingBounds:aRectangle.
+ aBlock ensure:[
+ self clippingBounds:oldClip
+ ].
!
flush