Ha! The title says it all, yet again a text only post ...
While working on the current game (the same project Squize is working on, see his last post), I needed way to be able to paint an area in a real life fashion (that is, the paint on the brush runs out just a few centimeters before the end of the wall).
I must admit, that I didn't have much play with f8's BitmapData before, I just don't needed it. Until now.
I just hate it to get into something "new" in the middle of a project, but unlike some of Flash's other new things BitmapData is fairly easy to get into. Except the part where you start to mess with matrixes. I had some great examples which showed a lot of the stuff I thought I need, but I just wasn't in the mood to dig into using matrixes for creating the desired effect.
But there is hope ...
Using 3 BitmapData objects, 2 PNGs and copyPixels with alpha ...
Part of the code:
var bmpAlpha:BitmapData = BitmapData.loadBitmap("brush_shape_and_alpha.png");
var bmpBrush:BitmapData = BitmapData.loadBitmap("paintpattern.png");
// mod alpha
// iPaintAlpha is a value from 0 (paint it) to -255 (paint nothing)
bmpAlpha.colorTransform(bmpAlpha.rectangle, new ColorTransform(1, 1, 1, 1, 0, 0, 0, this._iPaintAlpha));
this._bmpPaintArea.copyPixels(bmpBrush, bmpAlpha.rectangle,
new Point(this._xmouse, this._ymouse), bmpAlpha, new Point(0,0), true);
this._iPaintAlpha--;
Et viola ...
Instead of using some matrix stuff, I just "alpha" the alpha chanel mask with a ColorTransform and use this to copy the "paintpattern" into the painting area ...
I'll upload an example file once I've reached my current milestone ...
nGFX