I’ve extended the BitmapData class to enable the following type of coding. All graphics calls are supported. Haven’t done any performance testing but if anyone wants to test it - feel free.
[COLOR=Gray]// EXAMPLE USAGE[/COLOR]
import BitmapDataEx; [COLOR=Gray]// BitmapDataEx extends flash.display.BitmapData[/COLOR]
[COLOR=Gray]// create a BitmapDataEx object in exactly the same way
// as you would create a BitmapData object [/COLOR]
var bmd = new BitmapDataEx(100, 100, true, 0xFFaabbcc);
[COLOR=Gray]// convert such to a displayable bitmap[/COLOR]
var bitmap = new Bitmap(bmd);
[COLOR=Gray]// add the bitmap to the display list so it will be visible[/COLOR]
addChild(bitmap);
[COLOR=Gray]// position the bitmap[/COLOR]
bitmap.x = 100;
bitmap.y = 100;
[COLOR=Gray]// use graphics calls on the bitmap[/COLOR]
bmd.graphics.clear();
bmd.graphics.lineStyle(1,0xFF0000);
bmd.graphics.beginFill(0xffbbaa);
bmd.graphics.drawCircle(50,50,40);
bmd.graphics.endFill();
[COLOR=Gray]
// drawings are not actually drawn until you call draw
[/COLOR]
bmd.graphics.draw();