I have a filled Shape, and a BitmapData that is the same width and height as the Shape's bounding box.
I need to cut the Shape from the BitmapData (basically draw the BitmapData onto the shape...) [like so: https://i.stack.imgur.com/VhdAm.png]
I use the rather hackish method of:
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;
}
I was wondering if there is a better method...one that isn't just a hack.