I have two layers of bitmaps:
1st – some random image
2nd – bitmap filled with black color that covers 1st bitmap
Also I have a mask bitmap.
I trying to make something like this
https://dl.dropbox.com/u/13089585/so/001.jpg
But I get something like this:
https://dl.dropbox.com/u/13089585/so/002.jpg
I tryed to do this using BitmapData::copyPixels, BitmapData::copyChannel and BitmapData::draw with different combinations of parameters, but still can not make it… I need some method that will override alpha value on dest. bitmap, but only if this value is greater then in src. bitmap.
I have two layers of bitmaps: 1st – some random image 2nd – bitmap
Share
first off, if you use a sprite instead of a bitmap as a mask, you can use
BitmapData.draw()withBlendMode.ERASEto get that effect. but that will not work if you want translucency (e.g. 50% alpha).what you can do is have the mask bitmap be black where you want the 2nd image to be transparent and and transparent elsewhere (30% alpha in the mask will become 70% alpha on 2nd bitmap).
now, create a 3rd
BitmapDatawith fill color red,drawthe mask onto 3rdBitmapDatausingBlendMode.DARKEN.then, use
copyChannel()from 3rd red to 2nd alpha.it’s not pretty, but real life never is…