Apache flex 带有剪切矩形和缩放矩阵的Flex/actionscript快照

Apache flex 带有剪切矩形和缩放矩阵的Flex/actionscript快照,apache-flex,actionscript,Apache Flex,Actionscript,在上面的代码中,我能够捕获图像 但我还想对其应用scalingMatrix(用于缩小/缩小)和剪切矩形 怎么做 我也尝试了捕获BitmapData,但用它我甚至无法获得正确的图像。看见所以我不想用这个 var snapshot:ImageSnapshot = ImageSnapshot.captureImage(someSprite); var file:FileReference = new FileReference(); file.save(snapshot.data,'abc.png')

在上面的代码中,我能够捕获图像

但我还想对其应用scalingMatrix(用于缩小/缩小)和剪切矩形

怎么做

我也尝试了捕获BitmapData,但用它我甚至无法获得正确的图像。看见所以我不想用这个

var snapshot:ImageSnapshot = ImageSnapshot.captureImage(someSprite);
var file:FileReference = new FileReference();
file.save(snapshot.data,'abc.png');
上面的代码允许您仅绘制剪辑矩形内的部分。 在我的例子中,我不必考虑缩放矩阵,即使
我使用了放大/缩小功能。

最终我可以完全取消ImageSnapshot类。
sw = someSprite.stage.stageWidth;            
sh = someSprite.stage.stageHeight;           
var cr:Rectangle = new Rectangle(x,y,cw,ch);//you have to check that this clip rectangle should not overshoot your stage
//cr is the clip rectangle
var bmp:BitmapData = new BitmapData(sw,sh);
bmp.draw(someSprite,null,null,null,cr);

var bmp1:BitmapData = new BitmapData(cw,ch);
bmp1.copyPixels(bmp,cr,new Point(0,0));
var enc:JPEGEncoder = new JPEGEncoder();
var data:ByteArray = encoder.encode(bmd1);
new FileReference().save(data,'image.jpeg');