Cole Tierney <[EMAIL PROTECTED]> wrote:
> I'm trying to invert a 16 color indexed greyscale bitmap with imaging
> lingo. I thought this would be a no brainer.
> 
> I first tried copyPixels with #notcopy ink. This appears to work, but
> there seem to be subtle rounding errors.

Hi Cole,

Using the image you sent me, the following seems to work.  Note the use of
the undocumented value for #dither.

on invertImage(anImage)
  tRect    = anImage.rect
  tPalette = anImage.paletteRef
  tDepth   = anImage.depth
  
  tImage   = image(tRect.width, tRect.height, tDepth, tPalette)
  
  tOptions = [#ink: #notCopy, #dither: 1215]
  tImage.copyPixels(anImage, tRect, tRect, tOptions)
  
  return tImage
end

This is not a generic solution: it failed with an image that uses the
Metallic palette.  I hope it is enough to solve your current issue.

Cheers,

James

[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