Fix Depth1Icons drawn in black.
--- a/DeviceGraphicsContext.st Thu May 08 10:27:51 2014 +0200
+++ b/DeviceGraphicsContext.st Fri May 23 17:42:24 2014 +0200
@@ -9,7 +9,7 @@
other person. No title to or ownership of the software is
hereby transferred.
"
-'From Smalltalk/X, Version:6.2.3.0 on 08-05-2014 at 10:06:55' !
+'From Smalltalk/X, Version:6.2.3.0 on 23-05-2014 at 17:22:04' !
"{ Package: 'stx:libview' }"
@@ -2087,24 +2087,24 @@
deviceForm := aForm asFormOn:device.
deviceForm isNil ifTrue:[
- 'DeviceGraphicsContext [warning]: cannot create device-form' errorPrintCR.
- ^self
+ 'DeviceGraphicsContext [warning]: cannot create device-form' errorPrintCR.
+ ^self
].
id := deviceForm id.
id isNil ifTrue:[
- 'DeviceGraphicsContext [warning]: invalid form draw - ignored' errorPrintCR.
- ^ self
+ 'DeviceGraphicsContext [warning]: invalid form draw - ignored' errorPrintCR.
+ ^ self
].
gcId isNil ifTrue:[
- self initGC
+ self initGC
].
(deviceFormGCId := deviceForm gcId) isNil ifTrue:[
- "/ device needGCForBitmapSource - i.e. WIN32
- device platformName ~= 'X11' ifTrue:[
- deviceForm initGC.
- deviceFormGCId := deviceForm gcId.
- ]
+ "/ device needGCForBitmapSource - i.e. WIN32
+ device platformName ~= 'X11' ifTrue:[
+ deviceForm initGC.
+ deviceFormGCId := deviceForm gcId.
+ ]
].
"
@@ -2112,197 +2112,196 @@
"
mask := aForm mask.
- ((aForm depth ~~ 1)
- or:[mask notNil]) ifTrue:[
- mask notNil ifTrue:[
- mask depth == 1 ifFalse:[
- 'DEVGC: alpha channel not yet supported' errorPrintCR.
- ] ifTrue:[
- deviceMask := mask asFormOn:device.
- deviceMask isNil ifTrue:[
- 'DeviceGraphicsContext [warning]: cannot create device-mask' errorPrintCR.
- ^self
- ].
- maskId := deviceMask id.
- maskId notNil ifTrue:[
- deviceMask gcId isNil ifTrue:[deviceMask initGC].
- allColor := Color allColor.
- allBits := allColor colorId.
-
- (deviceForm depth == device depth
- and:[aForm maskedPixelsAre0]) ifTrue:[
- "/ can do it without a temporary pixmap:
- "/ or-in the form into the inverse stamped-out area
- "/ of the destination.
- "/ Oring is of course only possible if we know that
- "/ masked pixels are already zero in the form.
-
- "/ stamp out using mask
- device setForeground:0 background:allBits in:gcId.
- device setFunction:#and in:gcId.
- device
- copyPlaneFromPixmapId:maskId
- x:0
- y:0
- gc:(deviceMask gcId)
- to:drawableId
- x:pX
- y:pY
- gc:gcId
- width:w
- height:h.
- "/ or-in the form
- device setFunction:#or in:gcId.
- device
- copyFromPixmapId:id
- x:0
- y:0
- gc:deviceFormGCId
- to:drawableId
- x:pX
- y:pY
- gc:gcId
- width:w
- height:h.
- ] ifFalse:[
- "/ must do it slow, using a temporary form ..
-
- "
- create temp-form;
- "
- tmpForm := Form width:w height:h depth:device depth onDevice:device.
- tmpForm isNil ifTrue:[
- 'DeviceGraphicsContext [warning]: cannot create temp form' errorPrintCR.
- ^self
- ].
- tmpForm initGC.
- tmpId := tmpForm id.
- tmpGCId := tmpForm gcId.
-
- "
- fill tempform with image
- "
- aForm depth == 1 ifTrue:[
- (colorMap := aForm colorMap) notNil ifTrue:[
- colorMap size < 2 ifTrue:[
- device
- setForegroundColor:(colorMap at:1)
- in:tmpGCId.
- ] ifFalse:[
- device
- setForegroundColor:(colorMap at:2)
- backgroundColor:(colorMap at:1)
- in:tmpGCId.
- ]
- ].
- device
- copyPlaneFromPixmapId:id
- x:0
- y:0
- gc:deviceFormGCId
- to:tmpId
- x:0
- y:0
- gc:tmpGCId
- width:w
- height:h.
- ] ifFalse:[
- device
- copyFromPixmapId:id
- x:0
- y:0
- gc:deviceFormGCId
- to:tmpId
- x:0
- y:0
- gc:tmpGCId
- width:w
- height:h.
- ].
-
- "
- stamp out mask in temp form
- "
- device setForeground:allBits background:0 in:tmpGCId.
- device setFunction:#and in:tmpGCId.
- device
- copyPlaneFromPixmapId:maskId
- x:0
- y:0
- gc:(deviceMask gcId)
- to:tmpId
- x:0
- y:0
- gc:tmpGCId
- width:w
- height:h.
-
- "
- stamp out mask in destination
- "
- device setForeground:0 background:allBits in:gcId.
- device setFunction:#and in:gcId.
- device
- copyPlaneFromPixmapId:maskId
- x:0
- y:0
- gc:(deviceMask gcId)
- to:drawableId
- x:pX
- y:pY
- gc:gcId
- width:w
- height:h.
-
- "
- or-in tempform-bits ...
- "
- device setFunction:#or in:gcId.
- device
- copyFromPixmapId:tmpId
- x:0
- y:0
- gc:tmpGCId
- to:drawableId
- x:pX
- y:pY
- gc:gcId
- width:w
- height:h.
-
- "
- release tempForm immediately
- (although GC will eventually do it,
- this creates less stress to the Xserver in the meanwhile ...)
- "
- tmpForm destroy.
- ].
-
- "/ restore GC
- foreground notNil ifTrue:[
- device setForegroundColor:foreground in:gcId.
- ].
- background notNil ifTrue:[
- device setBackgroundColor:background in:gcId
- ].
- device setFunction:function in:gcId.
- ^ self
- ]
- ]
- ].
-
- device
- copyFromPixmapId:id
- x:0
- y:0
- gc:deviceForm gcId
- to:drawableId
- x:pX
- y:pY
- gc:gcId
- width:w
- height:h.
- ^ self
+ ((aForm depth ~~ 1) or:[mask notNil]) ifTrue:[
+ mask notNil ifTrue:[
+ mask depth ~~ 1 ifTrue:[
+ 'DEVGC: alpha channel not yet supported' errorPrintCR.
+ ] ifFalse:[
+ deviceMask := mask asFormOn:device.
+ deviceMask isNil ifTrue:[
+ 'DeviceGraphicsContext [warning]: cannot create device-mask' errorPrintCR.
+ ^self
+ ].
+ maskId := deviceMask id.
+ maskId notNil ifTrue:[
+ deviceMask gcId isNil ifTrue:[deviceMask initGC].
+ allColor := Color allColor.
+ allBits := allColor colorId.
+
+ (deviceForm depth == device depth
+ and:[aForm maskedPixelsAre0]) ifTrue:[
+ "/ can do it without a temporary pixmap:
+ "/ or-in the form into the inverse stamped-out area
+ "/ of the destination.
+ "/ Oring is of course only possible if we know that
+ "/ masked pixels are already zero in the form.
+
+ "/ stamp out using mask
+ device setForeground:0 background:allBits in:gcId.
+ device setFunction:#and in:gcId.
+ device
+ copyPlaneFromPixmapId:maskId
+ x:0
+ y:0
+ gc:(deviceMask gcId)
+ to:drawableId
+ x:pX
+ y:pY
+ gc:gcId
+ width:w
+ height:h.
+ "/ or-in the form
+ device setFunction:#or in:gcId.
+ device
+ copyFromPixmapId:id
+ x:0
+ y:0
+ gc:deviceFormGCId
+ to:drawableId
+ x:pX
+ y:pY
+ gc:gcId
+ width:w
+ height:h.
+ ] ifFalse:[
+ "/ must do it slow, using a temporary form ..
+
+ "
+ create temp-form;
+ "
+ tmpForm := Form width:w height:h depth:device depth onDevice:device.
+ tmpForm isNil ifTrue:[
+ 'DeviceGraphicsContext [warning]: cannot create temp form' errorPrintCR.
+ ^self
+ ].
+ tmpForm initGC.
+ tmpId := tmpForm id.
+ tmpGCId := tmpForm gcId.
+
+ "
+ fill tempform with image
+ "
+ aForm depth == 1 ifTrue:[
+ (colorMap := deviceForm colorMap) notNil ifTrue:[
+ colorMap size < 2 ifTrue:[
+ device
+ setForegroundColor:(colorMap at:1)
+ in:tmpGCId.
+ ] ifFalse:[
+ device
+ setForegroundColor:(colorMap at:2)
+ backgroundColor:(colorMap at:1)
+ in:tmpGCId.
+ ]
+ ].
+ device
+ copyPlaneFromPixmapId:id
+ x:0
+ y:0
+ gc:deviceFormGCId
+ to:tmpId
+ x:0
+ y:0
+ gc:tmpGCId
+ width:w
+ height:h.
+ ] ifFalse:[
+ device
+ copyFromPixmapId:id
+ x:0
+ y:0
+ gc:deviceFormGCId
+ to:tmpId
+ x:0
+ y:0
+ gc:tmpGCId
+ width:w
+ height:h.
+ ].
+
+ "
+ stamp out mask in temp form
+ "
+ device
+ setForeground:allBits background:0 in:tmpGCId;
+ setFunction:#and in:tmpGCId;
+ copyPlaneFromPixmapId:maskId
+ x:0
+ y:0
+ gc:(deviceMask gcId)
+ to:tmpId
+ x:0
+ y:0
+ gc:tmpGCId
+ width:w
+ height:h.
+
+ "
+ stamp out mask in destination
+ "
+ device
+ setForeground:0 background:allBits in:gcId;
+ setFunction:#and in:gcId;
+ copyPlaneFromPixmapId:maskId
+ x:0
+ y:0
+ gc:(deviceMask gcId)
+ to:drawableId
+ x:pX
+ y:pY
+ gc:gcId
+ width:w
+ height:h.
+
+ "
+ or-in tempform-bits ...
+ "
+ device
+ setFunction:#or in:gcId;
+ copyFromPixmapId:tmpId
+ x:0
+ y:0
+ gc:tmpGCId
+ to:drawableId
+ x:pX
+ y:pY
+ gc:gcId
+ width:w
+ height:h.
+
+ "
+ release tempForm immediately
+ (although GC will eventually do it,
+ this creates less stress to the Xserver in the meanwhile ...)
+ "
+ tmpForm destroy.
+ ].
+
+ "/ restore GC
+ foreground notNil ifTrue:[
+ device setForegroundColor:foreground in:gcId.
+ ].
+ background notNil ifTrue:[
+ device setBackgroundColor:background in:gcId
+ ].
+ device setFunction:function in:gcId.
+ ^ self
+ ]
+ ]
+ ].
+
+ device
+ copyFromPixmapId:id
+ x:0
+ y:0
+ gc:deviceForm gcId
+ to:drawableId
+ x:pX
+ y:pY
+ gc:gcId
+ width:w
+ height:h.
+ ^ self
].
"
@@ -2318,114 +2317,114 @@
if paint is not a real color, we have to do it the hard way ...
"
easy ifTrue:[
- paint isColor ifFalse:[
- paintDither := paint.
- easy := false
- ] ifTrue:[
- paintDither := paint ditherForm.
- paintDither notNil ifTrue:[
- easy := false.
- ]
- ].
+ paint isColor ifTrue:[
+ paintDither := paint ditherForm.
+ paintDither notNil ifTrue:[
+ easy := false.
+ ]
+ ] ifFalse:[
+ paintDither := paint.
+ easy := false
+ ].
].
allColor := Color allColor.
allBits := allColor colorId.
easy ifTrue:[
- "
- paint is a real color
- "
-
- "
- if paint color is all-0 or all-1's, we can do it in one
- operation ...
- "
- fgId := paint colorId.
-
- ((fgId ~~ ((1 bitShift:device depth)-1))
- and:[fgId ~~ allBits]) ifTrue:[
- "
- clear fg-bits ...
- "
- device setForeground:0 background:allBits in:gcId.
- device setFunction:#and in:gcId.
- device
- copyPlaneFromPixmapId:id
- x:0
- y:0
- gc:deviceFormGCId
- to:drawableId
- x:pX
- y:pY
- gc:gcId
- width:w
- height:h.
- ].
-
- fgId ~~ 0 ifTrue:[
- "
- or-in fg-bits ...
- "
- device setForeground:fgId background:0 in:gcId.
- device setFunction:#or in:gcId.
- device
- copyPlaneFromPixmapId:id
- x:0
- y:0
- gc:deviceFormGCId
- to:drawableId
- x:pX
- y:pY
- gc:gcId
- width:w
- height:h
- ].
- "
- flush foreground/background cache
- "
- foreground := nil.
- background := nil.
- device setFunction:function in:gcId.
- ^ self
+ "
+ paint is a real color
+ "
+
+ "
+ if paint color is all-0 or all-1's, we can do it in one
+ operation ...
+ "
+ fgId := paint colorId.
+
+ ((fgId ~~ ((1 bitShift:device depth)-1))
+ and:[fgId ~~ allBits]) ifTrue:[
+ "
+ clear fg-bits ...
+ "
+ device setForeground:0 background:allBits in:gcId.
+ device setFunction:#and in:gcId.
+ device
+ copyPlaneFromPixmapId:id
+ x:0
+ y:0
+ gc:deviceFormGCId
+ to:drawableId
+ x:pX
+ y:pY
+ gc:gcId
+ width:w
+ height:h.
+ ].
+
+ fgId ~~ 0 ifTrue:[
+ "
+ or-in fg-bits ...
+ "
+ device setForeground:fgId background:0 in:gcId.
+ device setFunction:#or in:gcId.
+ device
+ copyPlaneFromPixmapId:id
+ x:0
+ y:0
+ gc:deviceFormGCId
+ to:drawableId
+ x:pX
+ y:pY
+ gc:gcId
+ width:w
+ height:h
+ ].
+ "
+ flush foreground/background cache
+ "
+ foreground := nil.
+ background := nil.
+ device setFunction:function in:gcId.
+ ^ self
].
function == #or ifTrue:[
- easy := paint notNil
- and:[paint isColor
- and:[paint ditherForm isNil]].
- easy ifTrue:[
- easy := bgPaint isNil
- or:[bgPaint isColor
- and:[bgPaint colorId == 0]]
- ].
- easy ifTrue:[
- fgId := paint colorId.
-
- fgId ~~ 0 ifTrue:[
- "
- or-in fg-bits ...
- "
- device setForeground:fgId background:0 in:gcId.
- device
- copyPlaneFromPixmapId:id
- x:0
- y:0
- gc:deviceFormGCId
- to:drawableId
- x:pX
- y:pY
- gc:gcId
- width:w
- height:h
- ].
- "
- flush foreground/background cache
- "
- foreground := nil.
- background := nil.
- ^ self
- ].
+ easy := paint notNil
+ and:[paint isColor
+ and:[paint ditherForm isNil]].
+ easy ifTrue:[
+ easy := bgPaint isNil
+ or:[bgPaint isColor
+ and:[bgPaint colorId == 0]]
+ ].
+ easy ifTrue:[
+ fgId := paint colorId.
+
+ fgId ~~ 0 ifTrue:[
+ "
+ or-in fg-bits ...
+ "
+ device setForeground:fgId background:0 in:gcId.
+ device
+ copyPlaneFromPixmapId:id
+ x:0
+ y:0
+ gc:deviceFormGCId
+ to:drawableId
+ x:pX
+ y:pY
+ gc:gcId
+ width:w
+ height:h
+ ].
+ "
+ flush foreground/background cache
+ "
+ foreground := nil.
+ background := nil.
+ ^ self
+ ].
].
"
@@ -2439,8 +2438,8 @@
"
tmpForm := Form width:w height:h depth:device depth onDevice:device.
tmpForm isNil ifTrue:[
- 'DeviceGraphicsContext [warning]: cannot create temp form' errorPrintCR.
- ^self
+ 'DeviceGraphicsContext [warning]: cannot create temp form' errorPrintCR.
+ ^self
].
"
fill tempform
@@ -2459,16 +2458,16 @@
device setForeground:0 background:allBits in:gcId.
device setFunction:#and in:gcId.
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.
"
or-in temp into destination
"
@@ -2476,16 +2475,16 @@
device setFunction:#or in:gcId.
device
- copyFromPixmapId:tmpForm id
- x:0
- y:0
- gc:tmpForm gcId
- to:drawableId
- x:pX
- y:pY
- gc:gcId
- width:w
- height:h.
+ copyFromPixmapId:tmpForm id
+ x:0
+ y:0
+ gc:tmpForm gcId
+ to:drawableId
+ x:pX
+ y:pY
+ gc:gcId
+ width:w
+ height:h.
"
release tempForm immediately
@@ -2530,7 +2529,7 @@
|id w h easy savedPaint bgForm fgForm tmpForm
fgId bgId noColor allColor allBits dx dy
- pX pY deviceDepth deviceForm|
+ pX pY deviceDepth deviceForm map|
deviceForm := aForm asFormOn:device.
id := deviceForm id.
@@ -2538,16 +2537,16 @@
"temporary ..."
(id isNil
or:[aForm graphicsDevice ~~ device]) ifTrue:[
- deviceForm := deviceForm asFormOn:device.
- id := deviceForm id.
- id isNil ifTrue:[
- 'DeviceGraphicsContext [warning]: invalid form draw - ignored' errorPrintCR.
- ^ self
- ].
+ deviceForm := deviceForm asFormOn:device.
+ id := deviceForm id.
+ id isNil ifTrue:[
+ 'DeviceGraphicsContext [warning]: invalid form draw - ignored' errorPrintCR.
+ ^ self
+ ].
].
gcId isNil ifTrue:[
- self initGC
+ self initGC
].
deviceForm gcId isNil ifTrue:[deviceForm initGC].
@@ -2562,25 +2561,30 @@
and is always drawn opaque.
"
(aForm depth ~~ 1) ifTrue:[
- device
- copyFromPixmapId:id
- x:0
- y:0
- gc:deviceForm gcId
- to:drawableId
- x:pX
- y:pY
- gc:gcId
- width:w
- height:h.
- ^ self
+ device
+ copyFromPixmapId:id
+ x:0
+ y:0
+ gc:deviceForm gcId
+ to:drawableId
+ x:pX
+ y:pY
+ gc:gcId
+ width:w
+ height:h.
+ ^ self
+ ].
+ map := aForm colorMap.
+ map notNil ifTrue:[
+ paint := map at:2.
+ bgPaint := map at:1.
].
"/ if no bgPaint is set, this is a non-opaque draw
bgPaint isNil ifTrue:[
- self displayDeviceForm:aForm x:x y:y.
- ^ self
+ self displayDeviceForm:aForm x:x y:y.
+ ^ self
].
"the following code is somewhat complicated, since it has to deal
@@ -2594,43 +2598,43 @@
"
easy := true.
paint isColor ifFalse:[
- easy := false
+ easy := false
] ifTrue:[
- fgId := paint colorId.
- fgId isNil ifTrue:[
- easy := false
- ]
+ fgId := paint colorId.
+ fgId isNil ifTrue:[
+ easy := false
+ ]
].
bgPaint isColor ifFalse:[
- easy := false
+ easy := false
] ifTrue:[
- bgId := bgPaint colorId.
- bgId isNil ifTrue:[
- easy := false
- ]
+ bgId := bgPaint colorId.
+ bgId isNil ifTrue:[
+ easy := false
+ ]
].
easy ifTrue:[
- "
- easy: both paint and bgPaint are real colors
- "
- ((foreground ~~ paint) or:[background ~~ bgPaint]) ifTrue:[
- device setForeground:fgId background:bgId in:gcId.
- foreground := paint.
- background := bgPaint.
- ].
- device
- copyPlaneFromPixmapId:id
- x:0
- y:0
- gc:(deviceForm gcId)
- to:drawableId
- x:pX
- y:pY
- gc:gcId
- width:w
- height:h.
- ^ self
+ "
+ easy: both paint and bgPaint are real colors
+ "
+ ((foreground ~~ paint) or:[background ~~ bgPaint]) ifTrue:[
+ device setForeground:fgId background:bgId in:gcId.
+ foreground := paint.
+ background := bgPaint.
+ ].
+ device
+ copyPlaneFromPixmapId:id
+ x:0
+ y:0
+ gc:(deviceForm gcId)
+ to:drawableId
+ x:pX
+ y:pY
+ gc:gcId
+ width:w
+ height:h.
+ ^ self
].
"
@@ -2641,120 +2645,120 @@
deviceDepth := device depth.
(fgId notNil and:[function == #copy]) ifTrue:[
- "
- only bg is dithered; fill with bg first ...
- "
- savedPaint := paint.
- self paint:bgPaint.
- self fillDeviceRectangleX:pX y:pY width:w height:h.
- self paint:savedPaint.
-
- "
- if paint color is all-0 or all-1's, we can do it in one
- operation ...
- "
- ((fgId ~~ ((1 bitShift:deviceDepth)-1))
- and:[fgId ~~ allBits]) ifTrue:[
- "
- clear fg-bits ...
- "
- device setForeground:0 background:allBits in:gcId.
- device setFunction:#and in:gcId.
- device
- copyPlaneFromPixmapId:id
- x:0
- y:0
- gc:(deviceForm gcId)
- to:drawableId
- x:pX
- y:pY
- gc:gcId
- width:w
- height:h
- ].
-
- fgId ~~ 0 ifTrue:[
- "
- or-in fg-bits ...
- "
- device setForeground:fgId background:0 in:gcId.
- device setFunction:#or in:gcId.
- device
- copyPlaneFromPixmapId:id
- x:0
- y:0
- gc:(deviceForm gcId)
- to:drawableId
- x:pX
- y:pY
- gc:gcId
- width:w
- height:h
- ].
- "
- flush foreground/background cache
- "
- foreground := nil.
- background := nil.
- device setFunction:function in:gcId.
- ^ self
+ "
+ only bg is dithered; fill with bg first ...
+ "
+ savedPaint := paint.
+ self paint:bgPaint.
+ self fillDeviceRectangleX:pX y:pY width:w height:h.
+ self paint:savedPaint.
+
+ "
+ if paint color is all-0 or all-1's, we can do it in one
+ operation ...
+ "
+ ((fgId ~~ ((1 bitShift:deviceDepth)-1))
+ and:[fgId ~~ allBits]) ifTrue:[
+ "
+ clear fg-bits ...
+ "
+ device setForeground:0 background:allBits in:gcId.
+ device setFunction:#and in:gcId.
+ device
+ copyPlaneFromPixmapId:id
+ x:0
+ y:0
+ gc:(deviceForm gcId)
+ to:drawableId
+ x:pX
+ y:pY
+ gc:gcId
+ width:w
+ height:h
+ ].
+
+ fgId ~~ 0 ifTrue:[
+ "
+ or-in fg-bits ...
+ "
+ device setForeground:fgId background:0 in:gcId.
+ device setFunction:#or in:gcId.
+ device
+ copyPlaneFromPixmapId:id
+ x:0
+ y:0
+ gc:(deviceForm gcId)
+ to:drawableId
+ x:pX
+ y:pY
+ gc:gcId
+ width:w
+ height:h
+ ].
+ "
+ flush foreground/background cache
+ "
+ foreground := nil.
+ background := nil.
+ device setFunction:function in:gcId.
+ ^ self
].
(bgId notNil and:[function == #copy]) ifTrue:[
- "
- only fg is dithered; fill with fg first ...
- "
- self fillDeviceRectangleX:pX y:pY width:w height:h.
-
- "
- if paint color is all-0 or all-1's, we can do it in one
- operation ...
- "
- ((bgId ~~ ((1 bitShift:deviceDepth)-1))
- and:[bgId ~~ allBits]) ifTrue:[
- "
- clear bg-bits ...
- "
- device setForeground:allBits background:0 in:gcId.
- device setFunction:#and in:gcId.
- device
- copyPlaneFromPixmapId:id
- x:0
- y:0
- gc:(deviceForm gcId)
- to:drawableId
- x:pX
- y:pY
- gc:gcId
- width:w
- height:h
- ].
-
- "
- or-in bg-bits ...
- "
- bgId ~~ 0 ifTrue:[
- device setForeground:0 background:bgId in:gcId.
- device setFunction:#or in:gcId.
- device
- copyPlaneFromPixmapId:id
- x:0
- y:0
- gc:(deviceForm gcId)
- to:drawableId
- x:pX
- y:pY
- gc:gcId
- width:w
- height:h
- ].
- "
- flush foreground/background cache
- "
- foreground := nil.
- background := nil.
- device setFunction:function in:gcId.
- ^ self
+ "
+ only fg is dithered; fill with fg first ...
+ "
+ self fillDeviceRectangleX:pX y:pY width:w height:h.
+
+ "
+ if paint color is all-0 or all-1's, we can do it in one
+ operation ...
+ "
+ ((bgId ~~ ((1 bitShift:deviceDepth)-1))
+ and:[bgId ~~ allBits]) ifTrue:[
+ "
+ clear bg-bits ...
+ "
+ device setForeground:allBits background:0 in:gcId.
+ device setFunction:#and in:gcId.
+ device
+ copyPlaneFromPixmapId:id
+ x:0
+ y:0
+ gc:(deviceForm gcId)
+ to:drawableId
+ x:pX
+ y:pY
+ gc:gcId
+ width:w
+ height:h
+ ].
+
+ "
+ or-in bg-bits ...
+ "
+ bgId ~~ 0 ifTrue:[
+ device setForeground:0 background:bgId in:gcId.
+ device setFunction:#or in:gcId.
+ device
+ copyPlaneFromPixmapId:id
+ x:0
+ y:0
+ gc:(deviceForm gcId)
+ to:drawableId
+ x:pX
+ y:pY
+ gc:gcId
+ width:w
+ height:h
+ ].
+ "
+ flush foreground/background cache
+ "
+ foreground := nil.
+ background := nil.
+ device setFunction:function in:gcId.
+ ^ self
].
"
@@ -2774,8 +2778,8 @@
"
dx := dy := 0.
maskOrigin notNil ifTrue:[
- dx := maskOrigin x.
- dy := maskOrigin y
+ dx := maskOrigin x.
+ dy := maskOrigin y
].
bgForm paint:bgPaint.
@@ -2818,16 +2822,16 @@
"
device setForeground:0 background:allBits in:gcId.
device
- copyFromPixmapId:tmpForm id
- x:0
- y:0
- gc:tmpForm gcId
- to:drawableId
- x:pX
- y:pY
- gc:gcId
- width:w
- height:h.
+ copyFromPixmapId:tmpForm id
+ x:0
+ y:0
+ gc:tmpForm gcId
+ to:drawableId
+ x:pX
+ y:pY
+ gc:gcId
+ width:w
+ height:h.
"
release tempForms immediately
@@ -4130,11 +4134,11 @@
!DeviceGraphicsContext class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libview/DeviceGraphicsContext.st,v 1.137.2.1 2014-05-08 08:27:50 stefan Exp $'
+ ^ '$Header: /cvs/stx/stx/libview/DeviceGraphicsContext.st,v 1.137.2.2 2014-05-23 15:42:24 stefan Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libview/DeviceGraphicsContext.st,v 1.137.2.1 2014-05-08 08:27:50 stefan Exp $'
+ ^ '$Header: /cvs/stx/stx/libview/DeviceGraphicsContext.st,v 1.137.2.2 2014-05-23 15:42:24 stefan Exp $'
! !
--- a/Form.st Thu May 08 10:27:51 2014 +0200
+++ b/Form.st Fri May 23 17:42:24 2014 +0200
@@ -9,7 +9,7 @@
other person. No title to or ownership of the software is
hereby transferred.
"
-'From Smalltalk/X, Version:6.2.3.0 on 09-04-2014 at 12:18:10' !
+'From Smalltalk/X, Version:6.2.3.0 on 23-05-2014 at 17:22:23' !
"{ Package: 'stx:libview' }"
@@ -1098,10 +1098,10 @@
^ #blackIs0
].
].
- ].
- depth > 8 ifTrue:[
+ ] ifFalse:[depth > 8 ifTrue:[
^ #rgb
- ].
+ ]].
+
^ #palette
"Modified: 17.6.1996 / 11:45:16 / cg"
@@ -1768,10 +1768,12 @@
offset := 0@0.
depth := d.
depth == 1 ifTrue:[
- BlackAndWhiteColorMap isNil ifTrue:[
- BlackAndWhiteColorMap := Array with:(Color white) with:(Color black)
+ localColorMap isNil ifTrue:[
+ BlackAndWhiteColorMap isNil ifTrue:[
+ BlackAndWhiteColorMap := Array with:(Color white) with:(Color black)
+ ].
+ localColorMap := BlackAndWhiteColorMap.
].
- localColorMap := BlackAndWhiteColorMap.
].
self graphicsDevice notNil ifTrue:[
gc createPixmapWidth:w height:h depth:d.
@@ -1865,10 +1867,13 @@
height := h.
depth := 1.
offset := 0@0.
- BlackAndWhiteColorMap isNil ifTrue:[
- BlackAndWhiteColorMap := Array with:(Color white) with:(Color black)
+
+ localColorMap isNil ifTrue:[
+ BlackAndWhiteColorMap isNil ifTrue:[
+ BlackAndWhiteColorMap := Array with:(Color white) with:(Color black)
+ ].
+ localColorMap := BlackAndWhiteColorMap.
].
- localColorMap := BlackAndWhiteColorMap.
self graphicsDevice notNil ifTrue:[
gc createBitmapFromArray:bytes width:w height:h.
@@ -2006,7 +2011,7 @@
!Form class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libview/Form.st,v 1.150.2.1 2014-05-08 08:27:50 stefan Exp $'
+ ^ '$Header: /cvs/stx/stx/libview/Form.st,v 1.150.2.2 2014-05-23 15:42:24 stefan Exp $'
! !