Hi Kurt,

Try this one...

-- Background image
circle = member("circle").image.duplicate()
-- Empty rectangle of desired color and size
blank  = image(100, 100, 32)
blank.fill(blank.rect, rgb(0, 0, 255))
-- Mask with shape of text
words  = member("text").image.extractAlpha()
words  = words.createMask()
-- Copy the rectangle onto the background with the text mask
circle.copyPixels(blank, circle.rect, circle.rect, [#maskImage: words])
member("output").image = circle

The reason to copy a filled rectangle image rather than a text image is
because the alpha is already premultiplied with the pixel data in text
images. So when you use an additional mask on that image, the edges often
get thinned further. Unless you have a very bold font, this has readbility
problems. The blank box has no alpha, so it gets masked perfectly against
the background image.

Pranav Negandhi
Software Engineering
Learnet India Limited, Mumbai.
Phone: 91-22-859 8042 Ext: 316
http://www.learnetindia.com




<snip>
I'm copying a dupe of the image of a text member into a dupe of the
image of a png member. Given the fact that both carry alpha images, the
result is not surprising - the copypixels op pastes the text in, but
also cuts a rect the size of the text image out of the background image
(as in, the alpha is getting copied to, as well as the image). I can
think of three ways around this - one, extract the alpha from the
destination image up front, copy, and put the alpha back; two, make an
interim image that has no alpha, copy the text to that, and then paste
the sucker into the final image; three, use the text member's alpha as
the image to copy from.
<snip>



[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