Skip to main content
June 3, 2006
Question

BitmapData Threshold method

  • June 3, 2006
  • 1 reply
  • 232 views
I've looked through every piece of information I can find on the threshold method and I still can't get it to do what I want. I've got it almost working, but it removes more colors than it should.

All I want to do is chage the color 0xFF00CCFF to transparent (ie. 0x00000000).

My bitmap is created like this
var myBitmapData:BitmapData = new BitmapData(clip1._width, clip1._height, true, 0x000000FF);

Can someone please tell me the exact parameters to pass to the threshold method to remove all the pixels that match 0xFF00CCFF please.
This topic has been closed for replies.

1 reply

Inspiring
June 3, 2006
Use:

myBitmapData.threshold(myBitmapData, myBitmapData.rectangle, myBitmapData.rectangle.topLeft, "==", 0xFF00CCFF, 0x00000000);
June 4, 2006
Use:

myBitmapData.threshold(myBitmapData, myBitmapData.rectangle, myBitmapData.rectangle.topLeft, "==", 0xFF00CCFF, 0x00000000);


Using that doesn't work. This is what I get when using that:
Test1
The purple circles should become transparent, shwoing the background through.

This is what I had before. I can't remember exactly how I decided upon what numbers to use but it kind of works.
myBitmapData.threshold(myBitmapData, myBitmapData.rectangle, new Point(0, 0), "!=", 0xFF00CCFF, 0x00000000, 0x00FF0000, false);
This makes: Test2
The circles go transparent, but so do most of the other colors.

Can anyone make this work better?