Michael von Aichberger <[EMAIL PROTECTED]> wrote:
> I didn't want [the image of the text member] to be on stage. I wanted
> to get its pixel with getpixel. And with getpixel I got the same as
> what the paint window was showing.
Hi Michael,
Have you tried using getPixel(x, y, #integer) ?
Here's what this returns for me in six different cases:
Using black text:
Outside the text: -- 0
On an antialiased edge: -- 1426063360
Inside the text: -- -16777216
Using blue text
Outside the text: -- 255
On an antialiased edge: -- 1426063615
Inside the text: -- -16776961
Outside the text, you get the color of the text, with an alpha channel value
of 0 (transparent).
Inside the text, you get the color of the text, with an alpha channel value
of 255 (opaque). Color data is coded as follows over 32-bits:
aaaaaaaarrrrrrrrggggggggbbbbbbbb
a = alpha bit
r = red bit
g = green bit
b = blue bit
All bits have the values 0 or 1.
When the alpha channel contains a value of 128 - 255, the first bit will be
1. Director considers the first bit of a 32-bit number to indicate whether
the following 31-bit number is negative or positive. 1 means negative.
This explains why the opaque part of the text returns a negative value.
On an antialiased edge, the alpha channel may contain a value of less than
128, and so the getPixel(x, y, #integer) function returns a large positive
number.
To convert the integer values to alpha and rgb, use the following handler:
on GetARGBFrom(anInteger)
tARGB = [:]
if anInteger < 0 then
tAlpha = 128
anInteger = anInteger + the maxInteger + 1 -- removes -1 flag
end if
tARGB[#blue] = anInteger mod 256
anInteger = anInteger / 256
tARGB[#green] = anInteger mod 256
anInteger = anInteger / 256
tARGB[#red] = anInteger mod 256
tARGB[#alpha] = tAlpha + anInteger / 256
return tARGB
end GetARGB
Using this function, here are the color values of the integers I quote
above:
Using black text:
Outside the text: -- [#blue: 0, #green: 0, #red: 0, #Alpha: 0]
On an antialiased edge: -- [#blue: 0, #green: 0, #red: 0, #Alpha: 85]
Inside the text: -- [#blue: 0, #green: 0, #red: 0, #Alpha: 255]
Using blue text
Outside the text: -- [#blue: 255, #green: 0, #red: 0, #Alpha: 0]
On an antialiased edge: -- [#blue: 255, #green: 0, #red: 0, #Alpha: 85]
Inside the text: -- [#blue: 255, #green: 0, #red: 0, #Alpha: 255]
Does this help you solve your problem?
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!]