Re: Pixel Question
Scott: I am happy to say that your function appears to be OK, and not slightly inaccurate as I reported. I don't know what happened because I certainly checked the image's colour values in Photoshop before making the comparison. However, as a result of what you said below, I went back to Photoshop and checked the values again, and lo-and-behold, the values were then exactly the same as those reported by your function! Anyway, I reduced the colour-depth of the picture and re-saved it as PNG this time (rather than JPG). The RGB values reported by the function were then exactly the same as those given by Photoshop. Sorry for the confusion, and thanks again for the help. Regards, Bob Scott Rossi wrote: Recently, Bob Warren wrote: >> Using a mouseMove routine on the top card such as:- >> >> on mouseMove >> put retrievePixelColor(long id of image "myImage" \ >> of card "Card2",the mouseH,the mouseV) into field \ >> "ColourRGB" of card "Card1" >> end mouseMove >> >> - it works quite nimbly, even on my old Pentium II. >> >> However, there are some slight inaccuracies in the colours reported. >> For example: >> >> RED 255,0,0 is reported as 254,0,0 >> GREEN 0,128,0 is reported as 0,128,1 >> BLUE 0,0,255 is reported as 0,0,254 >> YELLOW 255,255,0 is reported as 255,255,1 >> >> WHITE 255,255,255 is OK. >> >> Without a better analysis of your function, I cannot see immediately >> what the trouble is. Can you see it Scott? >Well, the function pulls the color directly from the imagedata >contained in >the image -- it doesn't do any manipulation, only reporting. How are >you >gauging the accuracy of the color values? The mouseColor? In my experience >the mouseColor is sometimes off. Have you scaled the image at all? I >would >suggest opening your image in an image editor (Photoshop or similar) >and >measuring your colors there for reference. You also might want to >doublecheck that you're measuring position correctly from the topleft >of the >image. That's about all I can think of -- I can also take a look at >your >image. >Let us know what you find out. >Regards, >Scott Rossi ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Pixel Question
> > 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. > that's a good thing to know... so far, when manipulating imageData, I used binaryDecode and baseConvert... using chartonum is much easier... JB ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Pixel Question
Recently, Scott Rossi 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 - Thanks a lot Scott, almost there! Using a mouseMove routine on the top card such as:- on mouseMove put retrievePixelColor(long id of image "myImage" \ of card "Card2",the mouseH,the mouseV) into field \ "ColourRGB" of card "Card1" end mouseMove - it works quite nimbly, even on my old Pentium II. However, there are some slight inaccuracies in the colours reported. For example: RED 255,0,0 is reported as 254,0,0 GREEN 0,128,0 is reported as 0,128,1 BLUE 0,0,255 is reported as 0,0,254 YELLOW 255,255,0 is reported as 255,255,1 WHITE 255,255,255 is OK. Without a better analysis of your function, I cannot see immediately what the trouble is. Can you see it Scott? Regards, Bob ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Pixel Question
> 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. >> 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" <[EMAIL PROTECTED]> 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: [EMAIL PROTECTED] >> W: http://www.tactilemedia.com >> >> ___ >> use-revolution mailing list >> use-revolution@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@lists.runrev.com > Please visit this url to subscribe, unsubscribe and manage your subscription > preferences: > http://lists.runrev.com/mailman/listinfo/use-revolution ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Pixel Question
Recently, jbv wrote: >> 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. > great job Scott. Thanks. As long as it works. Most of the thanks go to Ken Ray for the way cool info about imageData/alphaData on his site. I'm not a math guy (Jim Hurley will vouch for that) but after a little head banging I've been able to grasp the concept. Sort of. Regards, Scott Rossi Creative Director Tactile Media, Multimedia & Design - E: [EMAIL PROTECTED] W: http://www.tactilemedia.com ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Pixel Question
great job Scott. BTW I didn't know that chartonum also worked on binary data... JB > 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: [EMAIL PROTECTED] > W: http://www.tactilemedia.com > > ___ > use-revolution mailing list > use-revolution@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@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Pixel Question
JB wrote: >Hi Bob, >> Dear All, >> >> 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 have tried, but so far without success. Any ideas anyone? >> >Here's something I would try (I don't have the time right now though) : >- make a screenshot of the card underneath so that in can be imported >inside an image object (hidden if necessary) >- get the mouse location (x,y coordinates) >- then compute the pixel value of the image using the imagedata >property >HTH, >JB - Thanks JB! I have little doubt that the method would work, even without trying it. I also thought of using imagedata, but I was hoping for a less cumbersome solution. It's the "compute" bit that might take up a bit of CP time, especially if some mad hatter like me makes the mouse go whizzing around the screen! But I see no other alternative at the moment, and after all, the proof of the pudding is in the eating, so I'll give it a try in practice. Thanks again, and also to Richard and (wide-awake) Klaus! Regards to all, Bob ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Pixel Question
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: [EMAIL PROTECTED] W: http://www.tactilemedia.com ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Pixel Question
Hi Bob, > Dear All, > > 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 have tried, but so far without success. Any ideas anyone? > Here's something I would try (I don't have the time right now though) : - make a screenshot of the card underneath so that in can be imported inside an image object (hidden if necessary) - get the mouse location (x,y coordinates) - then compute the pixel value of the image using the imagedata property HTH, JB ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Pixel Question
Klaus Major wrote: 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. sorry this is not possible right out of the box. "the mousecolor" will only for the "actual" pixel under the cursor. Richard G. wrote: get the mouseColor maybe a whiff of sleep wouldn't hurt... ;-) Yes indeed, I missed" hidden underneath". The mouseColor works off the screen buffer, so while it works reliably for all windows, even the desktop or anything else on screen, it won't work on things that can't be seen. I'll see if I can work out a nap later :) -- Richard Gaskin Managing Editor, revJournal ___ Rev tips, tutorials and more: http://www.revJournal.com ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Pixel Question
Hi Bob and Richard, 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. sorry this is not possible right out of the box. "the mousecolor" will only for the "actual" pixel under the cursor. Richard G. wrote: get the mouseColor maybe a whiff of sleep wouldn't hurt... ;-) Richard Gaskin Managing Editor, revJournal ___ Rev tips, tutorials and more: http://www.revJournal.com Regards Klaus Major [EMAIL PROTECTED] http://www.major-k.de ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Pixel Question
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. get the mouseColor -- Richard Gaskin Managing Editor, revJournal ___ Rev tips, tutorials and more: http://www.revJournal.com ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Pixel Question
Dear All, 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 have tried, but so far without success. Any ideas anyone? Bob ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution