Flash: the function of mergeAlpha in copyPixels

the sytx of copyPixels is like this:
copyPixels(sourceBitmap:BitmapData, sourceRect:Rectangle, destPoint:Point, [alphaBitmap:BitmapData], [alphaPoint:Point], [mergeAlpha:Boolean]) : Void

Just assume, we have a destination BMP called desBMP, a sourceBitmap, and a alphaBitmap to provide secondary alpha setting.

desBMP.copyPixels(sourceBitmap,sourceRect,destpoint,alphaBitmap,alphaPoint,mergeAlpha);

1. Things need to be clarified first


For desBMP, its transparency attribute is only defined when this BMP is created. it won’t be changed when the copy pixel happens.

2. How mergeAlpha works?


I search tons of help documents. It just said like
“mergeAlpha:Boolean (default = false) — To use the alpha channel, set the value to true. To copy pixels with no alpha channel, set the value to false. ”
There is no exmaple showing how this works and the effect of it.

After hundreds of tests, I got the following conclusions:

Continue reading