0

I have three BitmapData objects, all with alpha channel.

bitmapData 1 & 2 have the same RGB content, but different alpha channels:

bitmapData1.rgb == bitmapData2.rgb
bitmapData1.a != bitmapData2.a

bitmapData 3 has completely different data.

what I want to achieve is the following:

targetBitmapData.rgb = bitmapData1.rgb;
targetBitmapData.a = bitmapData1.a * bitmapData3.a + bitmapData2.a*(1-bitmapData3.a);

so, I want to blend the alpha channels of bitmapData 1 & 2 based on alpha channel of bitmapData 3

do I need to iterate over all pixels to do this, or is there a faster way? experimented with copyPixels, but didn't get the desired result.

4

1 回答 1

1

您应该能够draw使用BlendMode. 它可能需要太多的操作才能比迭代更有效。

如果您最终迭代像素(并且不针对 iOS),请考虑PixelBender

于 2012-05-06T13:32:08.227 回答