ColorAtScreenLoc Function

Ray ray at linkit.com
Tue Jan 21 14:04:28 EST 2014


Mark - I believe this is everything I need.  Thanks!  I especially like 
you usage of the templateImage which keeps everything easy to work with 
and no cleanup needed.

Ray

On 1/21/2014 1:32 PM, Mark Schonewille wrote:
> Hi Ray,
>
> This function doesn't involve moving the mouse cursor.
>
> function screenlocColor
>    put the screenloc into myLoc
>    add 31 to item 1 of myLoc
>    add 31 to item 2 of myLoc
>    put (the screenLoc),myLoc into myRect
>    export snapshot from rectangle myRect to myPixels as PNG
>    set the text of the templateImage to myPixels
>    put char 1 to 4 of the imageData of the templateImage into myPixel
>    return charToNum(char 2 of myPixel), \
>      charToNum(char 3 of myPixel),charToNum(char 4 of myPixel)
>    reset the templateImage
> end screenlocColor
>
> -- 
> Best regards,
>
> Mark Schonewille
>
> Economy-x-Talk Consulting and Software Engineering
> Homepage: http://economy-x-talk.com
> Twitter: http://twitter.com/xtalkprogrammer
> KvK: 50277553
>
> Use Color Converter to convert CMYK, RGB, RAL, XYZ, H.Lab and other 
> colour spaces. http://www.color-converter.com
>
> Buy my new book "Programming LiveCode for the Real Beginner" 
> http://qery.us/3fi
>
> Fill out this survey please
> http://livecodebeginner.economy-x-talk.com/survey/
>
> On 1/21/2014 18:28, Ray wrote:
>> Anybody know of a function which returns the color of the screen at a
>> given location?  Simply pass it a point and get the color of that pixel,
>> kind of like a combination of the mouseColor function and the
>> controlAtScreenLoc function.  I'd be happy if it only worked for points
>> on Livecode stacks.  I've tried 'click at loc [myPoint] and then getting
>> the mouseColor but it doesn't work.
>
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your 
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the use-livecode mailing list