Thanks for the tip - the formula looks like: dstPixel[x, y] = srcPixel[x + ((componentX(x, y) - 128) * scaleX) / 256, y + ((componentY(x, y) - 128) * scaleY) / 256]
I am assuming that (componentX(x, y) should have a result from 0-255. So to get this I am grabbing the value at a given pixel in the displacementmap bitmap (getPixel), converting that value to rgb, then grabbing the the correct channel's value (defined as componentX when I set up the filter) using a conversion function: function HexToR(h) {return parseInt(h.substring(0,2),16)} function HexToG(h) {return parseInt(h.substring(2,4),16)} function HexToB(h) {return parseInt(h.substring(4,6),16)} I repeat the same for y then calculate out the rest of the function. I must be doing something wrong in this process because the displacement I am calculating isn't visually matching up. Is there a different way that I should be grabbing the channel value? -----Original Message----- From: [EMAIL PROTECTED] on behalf of Alan MacDougall Sent: Sat 12/17/2005 11:08 PM To: Flashcoders mailing list Subject: Re: [Flashcoders] Displacement Maps, and Button actions Howard Nager wrote: >Thanks - the buttons are rectangular - any tips on how to calculate the corner >positions if the displacement map is a gradient distorting on both x and y? > > > I don't know the math behind the displacement map (I glanced at the formula and decided not to figure it out unless I had to!) If you do a little trial and error until you can get a single point to match, you should be able to calculate exactly how each gray value translates each point. The documentation for the DisplacementMapFilter object does list the formula, which should be a good starting point. _______________________________________________ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders _______________________________________________ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders