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

Reply via email to