Thanks a lot! I'll try tomorrow.
Bye, Steffi

-----Ursprüngliche Nachricht-----
Von: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Auftrag von Daniel
Nelson
Gesendet: Montag, 24. Oktober 2005 18:05
An: Lingo programming discussion list
Betreff: Re: <lingo-l> Colorization of bitmaps - correction


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!]

Reply via email to