你如何創建矩陣?
試試這個:我已經找到了前一段時間......和改進有點...
/** create a bitmap from a displayObject */
public static function toBitmap(value:DisplayObject, inverse:Boolean = true):Bitmap
{
// help: http://darylteo.com/blog/2006/12/17/bitmapdatadraw/
var defaultMartix:Matrix = value.transform.matrix;
//Find occupied region
var region:Rectangle = new Rectangle();
region = value.getBounds(value);
//Build Matrix Transform
var matrix:Matrix = new Matrix(1, 0, 0, 1, -region.x, -region.y);
value.transform.matrix = matrix;
var bmpData:BitmapData = new BitmapData(value.width, value.height, true, undefined);
bmpData.draw(value, matrix, null, null, null, true);
var bmp:Bitmap = new Bitmap(bmpData, "auto", true);
if (inverse)
{
//Re apply an Inverse Matrix
matrix = new Matrix(1, 0, 0, 1, region.x, region.y);
bmp.transform.matrix = matrix;
}
value.transform.matrix = defaultMartix;
return bmp;
}