See this page and the comments below it. There is one about how to invert with 
the paletteMap function.

http://livedocs.adobe.com/flash/8/main/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&file=00001962.html

Elia

----- Original Message ----- From: "EECOLOR" <[EMAIL PROTECTED]>
To: "Flash Coders List" <flashcoders@chattyfig.figleaf.com>
Sent: Thursday, February 28, 2008 3:47 PM
Subject: Re: [Flashcoders] bitMapData - function optimization


You could use the paletMap function or the threshold function of the
bitmapData object. Check the documentation for details.


Greetz Erik


On 2/28/08, Karim Beyrouti <[EMAIL PROTECTED]> wrote:

Hello Hello,

Just wondering if anyone has any tips or ideas on optimizing this
function,
as its really slow.. Basically, it creates an inverted alpha mask from a
bitmap by going through every pixel in the bit map.

Here is the function:

<code>

        private function createInvertedMask() {

                var w:Number = mask_bitmap.width;
                var h:Number = mask_bitmap.height;

                var r:Number = 0;
                var c:Number = 0;
                var v:Number;

                for ( r = 0 ; r < w ; r++ ) {

                        for ( c = 0 ; c < h ; c++ ) {

                                v = mask_bitmap.getPixel32( r, c );

                                if ( v == 0 ) {

                                        mask_bitmap.setPixel32( r, c ,
0xFF000000  );

                                } else {

                                        mask_bitmap.setPixel32( r, c ,
0x00000000  );

                                }
                        }
                }

        }

</code>

_______________________________________________
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

Reply via email to