var maskData:BitmapData = file.data;
var _mask:Bitmap = new Bitmap(maskData);
var shapeData:BitmapData = new BitmapData(maskData.width, maskData.height, true, 0xFF0000FF);
var rect:Rectangle = new Rectangle(0, 0, maskData.width, maskData.height);
shapeData.copyChannel(maskData, rect, new Point(), BitmapDataChannel.ALPHA, BitmapDataChannel.ALPHA);
_shape = new Bitmap(shapeData);
It copies everything at once, and it only touches the channel you care about, which ought to make it faster. But if your implementation is already fast enough, then I guess you don’t have to worry about it.
I am not using trying to use a mask anymore. I am using getColorBoundsRect() and cropping the bitmapData to the area that contains no transparent pixels. Then I am using transform.colorTransform to change the color.
We do not have colorTransform support across the board – I’m hoping (?) there’s some fast way to do color transformation when blitting with Cairo and Canvas, but to my knowledge, there is one. We need a strategy for how we will handle that.
In the meantime, bitmapData.colorTransform should work fine, so if you have a bitmap already, or bitmapData.draw to one, you should be able to accomplish what you need