ColorAtScreenLoc Function

Ray ray at linkit.com
Tue Jan 21 16:00:45 EST 2014


Mark I'm having fun with this code.  Just one question; why add 31 
pixels as opposed to another number of pixels?

On 1/21/2014 3:36 PM, Mark Schonewille wrote:
> Hi Ray,
>
> Now I'm thinking, why did I write a function for the screenLoc only? 
> So, here's a general solution.
>
> // usage: pointColor("100,200") or
> // pointColor(100,200) or e.g.
> // pointColor(the screenLoc)
> function pointColor thePoint
>    if the paramCount is 2 then
>       put param(1),param(2) into thePoint
>    end if
>    put thePoint into myLoc
>    add 31 to item 1 of myLoc
>    add 31 to item 2 of myLoc
>    put thePoint,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
>    reset the templateImage
>    return charToNum(char 2 of myPixel), \
>      charToNum(char 3 of myPixel),charToNum(char 4 of myPixel)
> end pointColor
>
> -- 
> 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 20:04, Ray wrote:
>> 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
>
>
> _______________________________________________
> 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