On Jul 13, 2012, at 9:11 AM, Colin Holgate wrote:

> One exercise in that book I wrote is about using an image as a color picker. 
> It uses the same technique as Scott mentioned, only I then set the color of 
> another graphic to show that it has picked up the right color.
> 
> One thing to double check, the x and y values you're using, are those from 
> the top left of the image? With mousecolor you use the card position, but 
> with this imagedata technique you would subtract the left and top of the 
> image in question, unless the image is the whole card.

function relativeXY tObjRef,x,y
   -- input: x,y (card coordinates) 
   -- output: coordinates relative to an object's rect
   put the topleft of tObjRef into tl
   put item 1 of tl into baseHoriz
   put item 2 of tl into baseVert 
   return (x - baseHoriz & comma & y - baseVert)
end relativeXY

-- Peter

Peter M. Brigham
pmb...@gmail.com
http://home.comcast.net/~pmbrig


_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to