[FIX] stippled colors with MVC
Hans-Martin Mosner
hm.mosner at cityweb.de
Tue Apr 25 07:47:09 UTC 2000
Hello all,
this changeset fixes a bug introduced with changes 1972 and 1973:
If Color>>balancedPatternForDepth: had been called to generate a
stippled pattern, a later call to Color>>bitPatternForDepth: would
erroneously return the stippled pattern, which does not work well with
the MVC window bit caching mechanism.
A more complete solution would involve cleaning up the whole
Color->Bitmap conversion mechanism, but I don't have the time right now
to do it.
Cheers,
Hans-Martin
-------------- next part --------------
'From Squeak2.8alpha of 19 January 2000 [latest update: #2005] on 25 April 2000 at 9:41:06 am'!
"Change Set: MVCColors-hmm
Date: 25 April 2000
Author: Hans-Martin Mosner <hmm at heeg.de>
Fixes a bug introduced with changes 1972 and 1973:
If Color>>balancedPatternForDepth: had been called to generate a stippled pattern, a later call to Color>>bitPatternForDepth: would erroneously return the stippled pattern, which does not work well with the MVC window bit caching mechanism.
A more complete solution would involve cleaning up the whole Color->Bitmap conversion mechanism, but I don't have the time right now to do it."!
!Color methodsFor: 'conversions' stamp: 'hmm 4/25/2000 09:40'!
bitPatternForDepth: depth
"Return a Bitmap, possibly containing a stipple pattern, that best represents this color at the given depth. BitBlt calls this method to convert colors into Bitmaps. The resulting Bitmap may be multiple words to represent a stipple pattern of several lines. "
"See also: pixelValueAtDepth: -- value for single pixel
pixelWordAtDepth: -- a 32-bit word filled with the pixel value"
"Details: The pattern for the most recently requested depth is cached."
"Note for depths > 2, there are stippled and non-stippled versions (generated with #balancedPatternForDepth: and #bitPatternForDepth:, respectively). The stippled versions don't work with the window bit caching of StandardSystemView, so we make sure that for these depths, only unstippled patterns are returned"
(depth == cachedDepth and: [depth <= 2 or: [cachedBitPattern size = 1]]) ifTrue: [^ cachedBitPattern].
cachedDepth _ depth.
depth > 2 ifTrue: [^ cachedBitPattern _ Bitmap with: (self pixelWordForDepth: depth)].
depth = 1 ifTrue: [^ cachedBitPattern _ self halfTonePattern1].
depth = 2 ifTrue: [^ cachedBitPattern _ self halfTonePattern2].
! !
More information about the Squeak-dev
mailing list
|