--- a/ShadowView.st Sat Sep 18 16:17:46 1999 +0200
+++ b/ShadowView.st Mon Sep 20 08:59:09 1999 +0200
@@ -130,9 +130,10 @@
"realize the shadowView some distance away from myView,
get the pixels under the shadow from the screen"
- |root shW shH right bot kludge clr1 clr0 org blackIs0|
+ |root shW shH right bot kludge clr1 clr0 org blackIs0 img|
myView notNil ifTrue:[
+
self origin:(myView origin + (myView borderWidth * 2) + shadowLength)
extent:(myView extent).
@@ -168,29 +169,65 @@
imageUnderShadow copyFrom:root x:org x y:(org y + bot)
toX:0 y:bot width:width height:shH.
- "
- grey out the image (by oring-in a grey pattern)
- (sometimes we are lucky, and can do it with one raster-op)
- "
- (kludge and:[blackIs0]) ifFalse:[
- imageUnderShadow foreground:clr0 background:(Color colorId:-1).
- imageUnderShadow mask:(Form mediumGreyFormOn:device).
- imageUnderShadow function:#and.
- imageUnderShadow fillRectangleX:right y:0 width:shW height:height.
- imageUnderShadow fillRectangleX:0 y:bot width:width height:shH.
+ false "device visualType == #TrueColor" ifTrue:[
+ "
+ grey out the image (by darkening the pixels)
+ (thats expensive ...)
+ "
+ img := Image fromForm:imageUnderShadow.
+ 0 to:height-1-shH do:[:y |
+ right to:right+shW-1 do:[:x | |pix r g b|
+ pix := img pixelAtX:x y:y.
+ r := img redBitsOf:pix.
+ g := img greenBitsOf:pix.
+ b := img blueBitsOf:pix.
+ r := r // 2.
+ g := g // 2.
+ b := b // 2.
+ pix := img valueFromRedBits:r greenBits:g blueBits:b.
+ img pixelAtX:x y:y put:pix.
+ ].
+ ].
+ 0 to:width-1 do:[:x |
+ bot to:bot+shH-1 do:[:y | |pix r g b|
+ pix := img pixelAtX:x y:y.
+ r := img redBitsOf:pix.
+ g := img greenBitsOf:pix.
+ b := img blueBitsOf:pix.
+ r := r // 2.
+ g := g // 2.
+ b := b // 2.
+ pix := img valueFromRedBits:r greenBits:g blueBits:b.
+ img pixelAtX:x y:y put:pix.
+ ].
+ ].
+ imageUnderShadow := img asFormOn:device.
+ ] ifFalse:[
+ "
+ grey out the image (by oring-in a grey pattern)
+ (sometimes we are lucky, and can do it with one raster-op)
+ "
- blackIs0 ifFalse:[
- imageUnderShadow foreground:(Color black onDevice:device) background:clr0.
+ (kludge and:[blackIs0]) ifFalse:[
+ imageUnderShadow foreground:clr0 background:(Color colorId:-1).
+ imageUnderShadow mask:(Form mediumGreyFormOn:device).
+ imageUnderShadow function:#and.
+ imageUnderShadow fillRectangleX:right y:0 width:shW height:height.
+ imageUnderShadow fillRectangleX:0 y:bot width:width height:shH.
+
+ blackIs0 ifFalse:[
+ imageUnderShadow foreground:(Color black onDevice:device) background:clr0.
+ imageUnderShadow function:#or.
+ imageUnderShadow fillRectangleX:right y:0 width:shW height:height.
+ imageUnderShadow fillRectangleX:0 y:bot width:width height:shH.
+ ]
+ ] ifTrue:[
+ imageUnderShadow foreground:clr1 background:clr0.
+ imageUnderShadow mask:(Form mediumGreyFormOn:device).
imageUnderShadow function:#or.
imageUnderShadow fillRectangleX:right y:0 width:shW height:height.
imageUnderShadow fillRectangleX:0 y:bot width:width height:shH.
- ]
- ] ifTrue:[
- imageUnderShadow foreground:clr1 background:clr0.
- imageUnderShadow mask:(Form mediumGreyFormOn:device).
- imageUnderShadow function:#or.
- imageUnderShadow fillRectangleX:right y:0 width:shW height:height.
- imageUnderShadow fillRectangleX:0 y:bot width:width height:shH.
+ ].
].
].
super realize.
@@ -227,5 +264,5 @@
!ShadowView class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libview/ShadowView.st,v 1.29 1999-08-18 14:35:26 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libview/ShadowView.st,v 1.30 1999-09-20 06:58:54 cg Exp $'
! !