Hi,

I also remembered where I had seen the 1 x 256 gradient rectangle shape used as a lookup table for colours - it was not my idea originally:

Check out the LightMaps class in PaperVision3D - this deals with creating an array of colour values used for looking up the colour of something which you could adapt for your idea.

org.papervision3d.materials.utils.LightMap is the class you want - getFlatMapArray is the method.

http://papervision3d.googlecode.com/svn/trunk/as3/trunk/src/org/papervision3d/materials/utils/LightMaps.as

   Glen

Glen Pike wrote:
Hi,

From what I can see of the gradient map, it multiplies a grayscale value by a gradient?? To do this, you need to get your bitmap data into grayscale - use the ColorMatrixFilter like here:

   http://www.actionscript.org/forums/showthread.php3?p=766173

Then you will need to map your grayscale values to a colour value. I guess one way to do this would be to create a 1 * 256 rectangle filled with a gradient of your choice. You would then convert this to a bitmap, then map the value of each pixel in your image you want to gradient map to the RBG value of the corresponding pixel in your 256 long rectangle:

     e.g.
   //convert bitmap data to grayscale using the above method,
//pseudocode - you would probably need to call getPixel / setPixel and other methods...
   mapped = new Bitmap(grayscaleW, grayscaleH);
   for(each pixel in grayscale) {
var luminance = grayscale[x][y].red; //0-255 could use .green or .blue as they are all the same value
       mapped[x][y] = gradientRBG[luminance];
   }

//This means you could use any gradient you want and create it dynamically, or create it at authortime as long as it is 1 x 256 (you can make it larger, but you just sample the pixel RGB values from the first row.

There is probably a quicker way of mapping the values from a grayscale image to colour values, so have a scout around - maybe play with FlashFilterLab, but I am guessing the ColourMatrix filter may help again here...

   HTH

   Glen

ACE Flash wrote:
any suggestions? please...

On Mon, Nov 10, 2008 at 11:36 AM, ACE Flash <[EMAIL PROTECTED]> wrote:

Hey there, I am going to apply the gradient map effect on a image ( the
name called in photoshop => image => ajustments => gradient map ) . do you
know how to deal with it in action script 3?
*http://yarra.ath.cx/zmzm/upload/Picture_1.png*<http://yarra.ath.cx/upload/Picture_1.png>


Thank you

_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders




--

Glen Pike
01326 218440
www.glenpike.co.uk <http://www.glenpike.co.uk>

_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to