Pixel Question

Jim Ault JimAultWins at yahoo.com
Thu Mar 23 23:46:28 EST 2006


> great job Scott.
> 
> BTW I didn't know that chartonum also worked on binary data...
> 
> JB

Actually,  it works on the imageData format for representing image pixel
colors in Rev.

from the docs...
Each pixel is represented by 32 bits (4 bytes) of image data, with pixels
numbered from the top left corner of the image, left to right, then top to
bottom. The first byte consists of zeroes, and the last three bytes encode
the amount of red, green, and blue respectively.

Since each pixel is represented by 4 bytes (4 characters), you can obtain
the numeric value of any of the color channels for a given pixel using the
charToNum function. <snip>

>> Scott Rossi
>> I believe this function will retrieve the pixel color of a pixel in any
>> image
                   (that is in the Rev format)!

Jim Ault
Las Vegas

On 3/23/06 1:22 PM, "jbv" <jbv.silences at club-internet.fr> wrote:


>> Recently, Bob Warren wrote:
>> 
>>> Suppose I have 2 cards in a stack and I am moving the mouse over the top
>>> card (naturally). I want to know what colour is under the mouse pointer
>>> in a corresponding position on the 2nd card which is hidden underneath.
>> 
>> I believe this function will retrieve the pixel color of a pixel in any
>> image using the X,Y position of the pixel as measured from the topleft of
>> the image.  Pass the long ID of the image and the X,Y coordinates as
>> follows:
>> 
>> on mouseUp
>>   answer retrievePixelColor(long id of myImage,5,5)
>> end mouseUp
>> 
>> function retrievePixelColor pObj,X,Y
>>   put imageData of pObj into tData
>>   put ((Y-1) * width of pObj * 4) + ((X-1)*4) into P
>>   repeat with N = 2 to 4
>>     put charToNum(char (P+N) of tData) & "," after tColor
>>   end repeat
>>   delete last char of tColor
>>   return tColor
>> end retrievePixelColor
>> 
>> Let me know if this works for you.
>> 
>> Regards,
>> 
>> Scott Rossi
>> Creative Director
>> Tactile Media, Multimedia & Design
>> -----
>> E: scott at tactilemedia.com
>> W: http://www.tactilemedia.com
>> 
>> _______________________________________________
>> use-revolution mailing list
>> use-revolution at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your subscription
>> preferences:
>> http://lists.runrev.com/mailman/listinfo/use-revolution
> 
> --
> 
> 
> 
> _________________________
> Faith is a central nervous system disease, like Alzheimer or multiple
> sclerosis.
> 
> 
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution





More information about the use-livecode mailing list