[Solved] Equal operation in BitmapData threshold function

Hello Again,
I think that’s a potential bug in the BitmapData threshold function I tried to remove a certain color using the following code from the image:

bitmapData.threshold(bitmapData, new Rectangle(0, 0, bitmapData.width, bitmapData.height), new Point(), "==", backColor, 0, 0x00FFFFFF);

but it didn’t work :frowning: going in the code of BitmapData I found that the color and threshold are flipped using these lines:

threshold = __flipPixel (threshold);
color = __flipPixel (color);

removing these lines the code worked properly which was a bit weird but I think reversing threshold and color and anding it with the mask will remove some components.

Sorry for posting here but I really don’t know where to report the bugs :smile:

What happens if you specify the destination point, instead of just passing an empty point?

the threshold still not working :frowning: just the final bitmapData have some places unshowable :frowning:

The color at the end 0x00FFFFFF, including the alpha, is setting it to be fully transparent. That means it’s just going to set the pixel to a fully transparent colour of white.

Also, the best place to report bugs is Github: https://github.com/openfl/openfl/issues :smile:

Hey guys,

I’ve just done a pass on bitmapData.threshold, I think it’s good now, but if you’d like to test, it would be nice!

The updated method is here: