Can some please help with a color map and bitBlt?
Rick
ret at deltanet.com
Fri Feb 18 04:08:34 UTC 2000
Hello,
Please...
I was wondering if some kind person would please help with this color map problem.
I'm just not getting it tonight...
I hope someone might help get this going and I would try next to take it into morphicLand...
Thank you for any help in advance!
-Rick-
PS - If there is a better way to do a Sepia Tone image filter then I would love to learn!!!
makeSepiaTone: anImage aTone: aColor
"I return a SepiaTone image..."
| myImage myBlackToTone myToneToWhite mySepiaToneMap map |
"Make my Black to Tone to White array..."
myBlackToTone _ Color black mix: aColor shades: 128.
myToneToWhite _ aColor mix: Color white shades: 128.
mySepiaToneMap _ Array new: 256.
1 to: 128 do:
[:i | mySepiaToneMap at: i put: (myBlackToTone at: i).
mySepiaToneMap at: i+128 put: (myToneToWhite at: i)].
Color showColors: mySepiaToneMap. "Debug help showing the colors..."
HELP ON
"make my color map map mySepiaToneMap"
map _ Bitmap new: ( "this is where I'm not sure what to do here... ").
1 to: map size do: [:i | map at: i put: (mySepiaToneMap at: i "or what to do here...")].
HELP OFF
"Hack anImage down to grayscale..."
myImage _ anImage asGrayScale.
"Blit the shades of Gray to shades of aTone..."
(BitBlt toForm: myImage)
destOrigin: 0 at 0;
sourceForm: myImage;
sourceRect: myImage boundingBox;
combinationRule: Form over;
colorMap: mySepiaToneMap;
copyBits.
^myImage.
More information about the Squeak-dev
mailing list
|