here a handler which produces a similar result, but without the
pixel-wise GetPixel/SetPixel, so much faster:
on colorize (tGrayscaleImage, tColor)
tImage = image(tGrayscaleImage.width, tGrayscaleImage.height, 24)
tImage.copypixels(tGrayscaleImage, tImage.rect, tImage.rect, \
[#bgcolor: tColor, #maskImage:tGrayscaleImage.createMask() ])
return tImage
end
use it like:
m = new(#bitmap)
m.image = colorize(myGrayBitmapMember.image, RGB(0,0,255))
cheers,
valentin
Daniel Nelson wrote:
Error in the last one (repeat with j & i should start from 0). This
is correct:
on makeBlueScaleImageFromGrayscale anImage
--pre: anImage is an 8-bit grayscale or a 32-bit representation of
a grayscale image --post: a "bluescale" image is returned
width = anImage.width
height = anImage.height
newImage = image(width, height, 32, TRUE)
is8bit = (anImage.depth = 8)
height = height - 1
width = width - 1
repeat with j = 0 to height
repeat with i = 0 to width
if is8bit then anInteger = 255 - anImage.getPixel(i, j,
#integer) else anInteger = anImage.getPixel(i, j).blue
multiplier = anInteger / 255.0
aPixel = color(multiplier * anInteger, multiplier * anInteger,
anInteger) newImage.setPixel(i, j, aPixel)
end repeat
end repeat
return newImage
end makeBlueScaleImageFromGrayscale
[To remove yourself from this list, or to change to digest mode, go
to http://www.penworks.com/lingo-l.cgi To post messages to the list,
email [email protected] (Problems, email
[EMAIL PROTECTED]). Lingo-L is for learning and helping with
programming Lingo. Thanks!]
[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/lingo-l.cgi To post messages to the list, email
[email protected] (Problems, email [EMAIL PROTECTED]). Lingo-L is for
learning and helping with programming Lingo. Thanks!]