塗りつぶされたShape と、Shape のバウンディング ボックスと同じ幅と高さの BitmapData があります。
BitmapData から Shape を切り取る必要があります (基本的に BitmapData を Shape に描画します...) [そのように: http://imgur.com/uwE5F.png ]
私はかなりハックな方法を使用します:
public static function cutPoly(img:BitmapData, s:Shape, bounds:Bounds):BitmapData {
var temp:BitmapData = new BitmapData(bounds.width, bounds.height, true);
Main.inst.stageQuality("low"); //hack to kill anti-aliasing
temp.draw(s,new Matrix());
Main.inst.stageQuality("high"); // end hack
//0xFF00FF00 is the color of the shape
makeColTrans(temp,0xFF00FF00); //makes the color transparent :P
//return temp;
img.draw(temp);
//img.draw(temp);
temp.dispose();
makeColTrans(img, 0xFFFFFFFF);
return img;
}
より良い方法があるかどうか疑問に思っていました...単なるハックではない方法です。