むしろ、ビットマップを使用して、そのようなものを操作しやすくすることをお勧めします(もちろん、スケーラブルベクターグラフィックスを実行する必要がない限り)。図形を描画する場合でも、グラフィックAPIを使用して図形を作成できます。
これを行うには、「ダミー」スプライト(または別のIBitmapDrawable
実装)をインスタンス化してグラフィックを作成し、それらを関数に「コピー」しBitmapData
ますbitmapData.draw()
。BlendMode.ERASE
このようにして、たとえば、シェイプのピクセルを削除するためのオプションを使用して描画できます。
例(私の頭の中から):
// creates a bitmap data canvas
var bitmapData:BitmapData = new BitmapData(500, 500);
// creates a bitmap display object to contain the BitmapData
addChild(new Bitmap(bitmapData));
// creates a dummy object to draw and draws a 10px circle
var brush:Sprite = new Sprite(); // note this is not even added to the stage
brush.graphics.beginFill(0xff0000);
brush.graphics.drawCircle(10, 10, 10);
// the matrix will be used to position the "brush strokes" on the canvas
var matrix:Matrix = new Matrix();
// draws a circle in the middle of the canvas
matrix.translate(250, 250);
bitmapData.draw(brush, matrix
// translates the position 5 pixels to the right to slightly erase the previously
// drawn circle creating a half moon
matrix.translate(5, 0);
bitmapData.draw(brush, matrix,null,BlendMode.ERASE);