#REFACTORING by stefan
class: GraphicsMedium
added:
#copyFrom:toX:y:
#copyFrom:x:y:toX:y:width:height:
#copyFrom:x:y:width:height:
#depth
removed: #copyBitsFrom:bitsPerPixel:depth:width:height:x:y:toX:y:
changed:
#copyFrom:x:y:toX:y:width:height:async:
#copyPlaneFrom:x:y:toX:y:width:height:
--- a/GraphicsMedium.st Fri Jul 22 16:17:25 2016 +0200
+++ b/GraphicsMedium.st Fri Jul 22 16:18:19 2016 +0200
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
"
COPYRIGHT (c) 1989 by Claus Gittinger
All Rights Reserved
@@ -735,6 +737,10 @@
^ gc dashStyle:aDashList offset:dashOffset
!
+depth
+ ^ self subclassResponsibility
+!
+
device
"return the device, the receiver is associated with"
@@ -1347,27 +1353,16 @@
gc copyBitsFrom:aByteArray bitsPerPixel:bpp depth:depth padding:pad width:srcW height:srcH x:srcX y:srcY toX:dstX y:dstY
!
-copyBitsFrom:aByteArray bitsPerPixel:bpp depth:depth width:srcW height:srcH x:srcX y:srcY toX:dstX y:dstY
- "copy bits from a smalltalk byteArray.
- The bits found there are supposed to be in the devices native format (i.e.
- translated to allocated color indices on pseudoColor devices and padded as required.
- The byteOrder is MSB and will be converted as appropriate by the underlying devices
- method to whatever the device needs.
- Assumes the source bits are in ST/X's natural padding (i.e. 8-bit padded)"
-
- gc copyBitsFrom:aByteArray bitsPerPixel:bpp depth:depth width:srcW height:srcH x:srcX y:srcY toX:dstX y:dstY
-!
-
copyFrom:aGC toX:dstX y:dstY
"copy from a drawable - maybe self"
- gc copyFrom:aGC toX:dstX y:dstY
+ self copyFrom:aGC x:0 y:0 toX:dstX y:dstY width:aGC width height:aGC height async:false
!
copyFrom:aGC x:srcX y:srcY toX:dstX y:dstY width:w height:h
"copy from a drawable - maybe self"
- gc copyFrom:aGC x:srcX y:srcY toX:dstX y:dstY width:w height:h
+ self copyFrom:aGC x:srcX y:srcY toX:dstX y:dstY width:w height:h async:false
!
copyFrom:aDrawable x:srcX y:srcY toX:dstX y:dstY width:w height:h async:async
@@ -1391,7 +1386,7 @@
asy ifFalse:[
self catchExpose
].
- gc copyFrom:deviceDrawable x:srcX y:srcY toX:dstX y:dstY width:w height:h async:async.
+ gc copyFrom:deviceDrawable graphicsContext x:srcX y:srcY toX:dstX y:dstY width:w height:h depth:self depth.
asy ifFalse:[
device flush.
self waitForExpose
@@ -1401,7 +1396,7 @@
copyFrom:aGC x:dstX y:dstY width:w height:h
"copy from a drawable - maybe self"
- gc copyFrom:aGC x:dstX y:dstY width:w height:h
+ self copyFrom:aGC x:0 y:0 toX:dstX y:dstY width:w height:h async:false
!
copyPlaneFrom:aDrawable x:srcX y:srcY toX:dstX y:dstY width:w height:h
@@ -1411,7 +1406,16 @@
The drawable must have been allocated on the same device.
All coordinates are in device coordinates."
- gc copyPlaneFrom:aDrawable x:srcX y:srcY toX:dstX y:dstY width:w height:h
+ |deviceDrawable|
+
+ ((aDrawable graphicsDevice ~~ device)
+ or:[aDrawable isImage]) ifTrue:[
+ deviceDrawable := aDrawable asFormOn:device.
+ ] ifFalse:[
+ deviceDrawable := aDrawable
+ ].
+
+ gc copyPlaneFrom:deviceDrawable graphicsContext x:srcX y:srcY toX:dstX y:dstY width:w height:h
! !
!GraphicsMedium methodsFor:'copying'!