:-) thanks... however the problem with the invert function is that it does
not preserve the transparency. Which is what I am trying to invert ( I
should have been more specific ) . So I am trying to make all transparent
pixels non-transparent. And vice-versa... will keep looking at
paletMap/threshold as it looks like a good solution.

Regards


Karim

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Elia Morling
Sent: 28 February 2008 16:08
To: Flash Coders List
Subject: Re: [Flashcoders] bitMapData - function optimization

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


-- 
No virus found in this incoming message.
Checked by AVG Free Edition. 
Version: 7.5.516 / Virus Database: 269.21.1/1302 - Release Date: 27/02/2008
16:34


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

Reply via email to