'From Squeak3.2alpha of 2 October 2001 [latest update: #4602] on 14 December 2001 at 6:28:50 pm'! "Change Set: ColoredStencil-ar Date: 14 December 2001 Author: Andreas Raab Fixes a problem when using stenciling on color forms. Found when attempting to add a drop shadow to the trash can."! !Form methodsFor: 'displaying' stamp: 'ar 12/14/2001 18:11'! maskingMap "Return a color map that maps all colors except transparent to words of all ones. Used to create a mask for a Form whose transparent pixel value is zero." ^Color maskingMap: self depth! ! !ColorForm methodsFor: 'displaying' stamp: 'ar 12/14/2001 18:14'! maskingMap "Return a color map that maps all colors except transparent to words of all ones. Used to create a mask for a Form whose transparent pixel value is zero." | maskingMap | maskingMap _ Bitmap new: (1 bitShift: depth) withAll: 16rFFFFFFFF. 1 to: colors size do:[:i| (colors at: i) isTransparent ifTrue:[maskingMap at: i put: 0]. ]. colors size+1 to: maskingMap size do:[:i| maskingMap at: i put: 0]. ^maskingMap! ! !FormCanvas methodsFor: 'drawing-images' stamp: 'ar 12/14/2001 18:15'! stencil: stencilForm at: aPoint sourceRect: sourceRect color: aColor "Flood this canvas with aColor wherever stencilForm has non-zero pixels" port isFXBlt "FXBlt has a very different setup" ifTrue:[self setStencilColor: aColor form: stencilForm] ifFalse:[self setPaintColor: aColor. port colorMap: stencilForm maskingMap]. port stencil: stencilForm at: aPoint + origin sourceRect: sourceRect.! !