Color at a location on the screen

Matt Denton matt.denton at limelight.com.au
Thu Jan 30 21:54:00 EST 2003


Hi Klaus

>> check the "screenmouseloc
>> " entry in the index.

Thanks for the tip, I thought of doing something like this but the ol' 
mouse would be jumping around all over the place.

I worked out a compromise: because I knew the object I wanted to get 
the colors from, I grabbed the imageData and worked out the RGB value 
from the raw data:

on setPixelColor pThisPixelH
   put (pThisPixelH - left of image "Rainbow.png"+1)*4 into tLeftOffset 
-- four bytes per pixel
   put charToNum(char tLeftOffset +2 of tColors) into tRed -- 2nd byte 
is the lovely red dot
   put charToNum(char tLeftOffset +3 of tColors) into tGreen -- 3rd byte 
is the happy green spot
   put charToNum(char tLeftOffset +4 of tColors) into tBlue -- 4th byte 
is the calm blue dot
   set the backColor of the target to tRed,tGreen,tBlue
end setPixelColor

I'm sure I could optimize this somehow (seems odd converting charToNum 
for data that is then converted back again) but it works.  Anyway all 
the info is in the manual under imageData ;-)  I just fiddled with it 
for a bit till it worked for me.

Thanks again Klaus.

>> I seem to recall an external or was I thinking of another script
>> language?
>
> Cobol? ;-)

hehe... not in a million years ;-0   I'm a Xtalk dummy (bit of assembly 
and even raw hex in machine code back in the dark ages...twas tedious 
but fun).

Chow,

M@
Matt


>
> You could store the old mouseloc, set the screenmouseloc to the desired
> point inside your clear circle, get the mousecolor and set the mouseloc
> to its old loc again...
>
> Just a thougth, but should be doable...
>
> Hope that helps.

>
>> Does anyone know how to find the color at a location on the screen?
>>
>> I've got a small clear circle that drags constrained horizontally over
>> a color bar to select a color. The mouseColor works perfectly as long
>> as the cursor is over the color, but as the clear circle is
>> constrained to the color bar, the cursor can really be anywhere.  So I
>> need to find the color at a location, ie where the circle is on the
>> color bar.  I've searched under 'screen', 'loc', 'cursor', 'color' and
>> every other combination I can think of.



M@
Matt Denton
. . . . . . . . . . . . . . . . . . . . . . . . . . . .
LIMELIGHT MEDIA PTY LTD

P] 61 2 9211 6622
F] 61 2 9211 5922
E] info at limelight.com.au

3/134 BROADWAY
BROADWAY, SYDNEY NSW 2007
ABN 72 065 014 280

NOT YOUR EMAIL?
If this e-mail is not for you, please let us know and destroy the 
original:
wrongmail at limelight.com.au
or call Sydney 61 2 9211 6622.   Thanks for your kind help.

LEGAL
This e-mail is intended only for the use of the individual or entity 
 named above and may contain information that is confidential and 
 privileged.   If you are not the intended recipient, you are hereby 
notified that any dissemination, distribution or copying of this Email 
is strictly prohibited.  Before opening or using attachments, check 
them for viruses and defects.




More information about the use-livecode mailing list