--- a/DeviceGraphicsContext.st Wed Mar 15 11:08:19 2017 +0100
+++ b/DeviceGraphicsContext.st Wed Mar 15 12:59:17 2017 +0100
@@ -1973,7 +1973,7 @@
(mask notNil or:[depth ~~ 1]) ifTrue:[
mask notNil ifTrue:[
mask depth ~~ 1 ifTrue:[
- 'DEVGC: alpha channel not yet supported' errorPrintCR.
+ 'DeviceGraphicsContext [info]: alpha channel not yet supported' errorPrintCR.
] ifFalse:[
deviceMask := mask asFormOn:device.
deviceMask isNil ifTrue:[
@@ -1999,15 +1999,10 @@
setForeground:0 background:allBits in:gcId;
setFunction:#and in:gcId;
copyPlaneFromPixmapId:maskId
- x:0
- y:0
- gc:deviceMaskGcId
+ x:0 y:0 gc:deviceMaskGcId
to:drawableId
- x:pX
- y:pY
- gc:gcId
- width:w
- height:h.
+ x:pX y:pY gc:gcId
+ width:w height:h.
"/ or-in the form
device setFunction:#or in:gcId.
@@ -2027,27 +2022,17 @@
].
device
copyPlaneFromPixmapId:id
- x:0
- y:0
- gc:deviceFormGCId
+ x:0 y:0 gc:deviceFormGCId
to:drawableId
- x:pX
- y:pY
- gc:gcId
- width:w
- height:h.
+ x:pX y:pY gc:gcId
+ width:w height:h.
] ifFalse:[
device
copyFromPixmapId:id
- x:0
- y:0
- gc:deviceFormGCId
+ x:0 y:0 gc:deviceFormGCId
to:drawableId
- x:pX
- y:pY
- gc:gcId
- width:w
- height:h.
+ x:pX y:pY gc:gcId
+ width:w height:h.
].
] ifFalse:[
"/ must do it slow, using a temporary form ..
@@ -2081,27 +2066,17 @@
].
device
copyPlaneFromPixmapId:id
- x:0
- y:0
- gc:deviceFormGCId
+ x:0 y:0 gc:deviceFormGCId
to:tmpId
- x:0
- y:0
- gc:tmpGCId
- width:w
- height:h.
+ x:0 y:0 gc:tmpGCId
+ width:w height:h.
] ifFalse:[
device
copyFromPixmapId:id
- x:0
- y:0
- gc:deviceFormGCId
+ x:0 y:0 gc:deviceFormGCId
to:tmpId
- x:0
- y:0
- gc:tmpGCId
- width:w
- height:h.
+ x:0 y:0 gc:tmpGCId
+ width:w height:h.
].
"
@@ -2112,15 +2087,10 @@
setForeground:allBits background:0 in:tmpGCId;
setFunction:#and in:tmpGCId;
copyPlaneFromPixmapId:maskId
- x:0
- y:0
- gc:deviceMaskGcId
+ x:0 y:0 gc:deviceMaskGcId
to:tmpId
- x:0
- y:0
- gc:tmpGCId
- width:w
- height:h.
+ x:0 y:0 gc:tmpGCId
+ width:w height:h.
"/Debug = 1 ifTrue:[
"/ Debug := 0.
"/ tmpForm asImage inspect.
@@ -2135,15 +2105,10 @@
setForeground:0 background:allBits in:gcId;
setFunction:#and in:gcId;
copyPlaneFromPixmapId:maskId
- x:0
- y:0
- gc:deviceMaskGcId
+ x:0 y:0 gc:deviceMaskGcId
to:drawableId
- x:pX
- y:pY
- gc:gcId
- width:w
- height:h.
+ x:pX y:pY gc:gcId
+ width:w height:h.
"
or-in tempform-bits ...
@@ -2152,15 +2117,10 @@
setForeground:0 background:0 in:gcId;
setFunction:#or in:gcId;
copyFromPixmapId:tmpId
- x:0
- y:0
- gc:tmpGCId
+ x:0 y:0 gc:tmpGCId
to:drawableId
- x:pX
- y:pY
- gc:gcId
- width:w
- height:h.
+ x:pX y:pY gc:gcId
+ width:w height:h.
"
release tempForm immediately
@@ -2185,25 +2145,19 @@
device
copyFromPixmapId:id
- x:0
- y:0
- gc:deviceFormGCId
+ x:0 y:0 gc:deviceFormGCId
to:drawableId
- x:pX
- y:pY
- gc:gcId
- width:w
- height:h.
+ x:pX y:pY gc:gcId
+ width:w height:h.
^ self
].
"
the following code is somewhat complicated, since it has to deal
with dithered paint colors, which cannot be done directly on most
- devices (actually, a test for the devices capabilities has to be added here)
+ devices (actually, a test for the device's capabilities has to be added here)
(just assume drawing a bitmap with dithered paint color ... sigh)
"
-
easy := (function == #copy).
"
@@ -2244,15 +2198,10 @@
device setFunction:#and in:gcId.
device
copyPlaneFromPixmapId:id
- x:0
- y:0
- gc:deviceFormGCId
+ x:0 y:0 gc:deviceFormGCId
to:drawableId
- x:pX
- y:pY
- gc:gcId
- width:w
- height:h.
+ x:pX y:pY gc:gcId
+ width:w height:h.
].
fgId ~~ 0 ifTrue:[
@@ -2263,21 +2212,17 @@
device setFunction:#or in:gcId.
device
copyPlaneFromPixmapId:id
- x:0
- y:0
- gc:deviceFormGCId
+ x:0 y:0 gc:deviceFormGCId
to:drawableId
- x:pX
- y:pY
- gc:gcId
- width:w
- height:h
+ x:pX y:pY gc:gcId
+ width:w height:h
].
"
flush foreground/background cache
"
- foreground := nil.
- background := nil.
+ device setForegroundColor:foreground backgroundColor:background in:gcId.
+ "/ foreground := nil.
+ "/ background := nil.
device setFunction:function in:gcId.
^ self
].
@@ -2301,15 +2246,10 @@
device setForeground:fgId background:0 in:gcId.
device
copyPlaneFromPixmapId:id
- x:0
- y:0
- gc:deviceFormGCId
+ x:0 y:0 gc:deviceFormGCId
to:drawableId
- x:pX
- y:pY
- gc:gcId
- width:w
- height:h
+ x:pX y:pY gc:gcId
+ width:w height:h
].
"
flush foreground/background cache
@@ -2393,8 +2333,7 @@
background := nil.
device setFunction:function in:gcId.
- "Modified: / 27-05-2007 / 12:45:10 / cg"
- "Modified (comment): / 13-02-2017 / 19:59:59 / cg"
+ "Modified: / 15-03-2017 / 12:45:36 / cg"
!
displayDeviceLineFromX:x0 y:y0 toX:x1 y:y1
@@ -2423,7 +2362,8 @@
|id w h easy savedPaint bgForm fgForm tmpForm
fgId bgId noColor allColor allBits dx dy
- pX pY deviceDepth deviceForm deviceFormGCId map|
+ pX pY deviceDepth deviceForm deviceFormGCId map savForeground savBackground
+ paintClr bgPaintClr|
deviceForm := aForm asFormOn:device.
id := deviceForm drawableId.
@@ -2457,26 +2397,25 @@
(aForm depth ~~ 1) ifTrue:[
device
copyFromPixmapId:id
- x:0
- y:0
- gc:deviceFormGCId
+ x:0 y:0 gc:deviceFormGCId
to:drawableId
- x:pX
- y:pY
- gc:gcId
- width:w
- height:h.
+ x:pX y:pY gc:gcId
+ width:w height:h.
^ self
].
+
+ paintClr := paint.
+ bgPaintClr := bgPaint.
+
map := aForm colorMap.
map notNil ifTrue:[
- paint := map at:2.
- bgPaint := map at:1.
+ paintClr := map at:2.
+ bgPaintClr := map at:1.
].
"/ if no bgPaint is set, this is a non-opaque draw
- bgPaint isNil ifTrue:[
+ bgPaintClr isNil ifTrue:[
self displayDeviceForm:aForm x:x y:y.
^ self
].
@@ -2491,18 +2430,18 @@
if bgPaint or paint is not a real color, we have to do it the hard way ...
"
easy := true.
- paint isColor ifFalse:[
+ paintClr isColor ifFalse:[
easy := false
] ifTrue:[
- fgId := paint colorId.
+ fgId := paintClr colorId.
fgId isNil ifTrue:[
easy := false
]
].
- bgPaint isColor ifFalse:[
+ bgPaintClr isColor ifFalse:[
easy := false
] ifTrue:[
- bgId := bgPaint colorId.
+ bgId := bgPaintClr colorId.
bgId isNil ifTrue:[
easy := false
]
@@ -2512,22 +2451,17 @@
"
easy: both paint and bgPaint are real colors
"
- ((foreground ~~ paint) or:[background ~~ bgPaint]) ifTrue:[
+ ((foreground ~~ paintClr) or:[background ~~ bgPaintClr]) ifTrue:[
device setForeground:fgId background:bgId in:gcId.
- foreground := paint.
- background := bgPaint.
+ "/ foreground := paint.
+ "/ background := bgPaint.
].
device
- copyPlaneFromPixmapId:id
- x:0
- y:0
- gc:deviceFormGCId
- to:drawableId
- x:pX
- y:pY
- gc:gcId
- width:w
- height:h.
+ copyPlaneFromPixmapId:id x:0 y:0 gc:deviceFormGCId
+ to:drawableId x:pX y:pY gc:gcId
+ width:w height:h.
+
+ device setForegroundColor:foreground backgroundColor:background in:gcId.
^ self
].
@@ -2543,7 +2477,7 @@
only bg is dithered; fill with bg first ...
"
savedPaint := paint.
- self paint:bgPaint.
+ self paint:bgPaintClr.
self fillDeviceRectangleX:pX y:pY width:w height:h.
self paint:savedPaint.
@@ -2592,8 +2526,9 @@
"
flush foreground/background cache
"
- foreground := nil.
- background := nil.
+ "/ foreground := nil.
+ "/ background := nil.
+ device setForegroundColor:foreground backgroundColor:background in:gcId.
device setFunction:function in:gcId.
^ self
].
@@ -2742,8 +2677,7 @@
foreground := nil.
background := nil.
- "Modified: / 22-04-1997 / 21:44:10 / cg"
- "Modified (comment): / 13-02-2017 / 20:00:06 / cg"
+ "Modified: / 15-03-2017 / 12:58:01 / cg"
!
displayDeviceOpaqueString:aStringArg from:index1 to:index2 in:fontArg x:x y:y