我想抓住的部分使用的BitmapData和copyPixels方法,舞台区:
I am trying to grab part of stage area using BitmapData and copyPixels method:
bmd = new BitmapData(stage.stageWidth, stage.stageHeight);
bmdRect = new BitmapData(320, 240);
rectangle = new Rectangle(360, 20, 320, 240);
bmdRect.copyPixels(bmd, rectangle, new Point());
bmd.draw(bmp);
bmp = new Bitmap(bmdRect);
var myEncoder:JPGEncoder = new JPGEncoder(100);
var byteArray:ByteArray = myEncoder.encode(bmd);
结果我得到的是一个空的.JPG我为pretty的确保误差是位图的过程中,而不是保存一个...
The result i get is an empty .jpg I m pretty sure that the error is in the Bitmap procedure and not the saving one...
最后使用该解决方案复制阶段的部分
Finally used this solution to copy part of the stage
(我复制一切,是在舞台上从(360,20),并在的)
var bitmapdata:BitmapData = new BitmapData(stage.stageWidth, stage.stageHeight);
bitmapdata.draw(stage);
var bitmapDataA: BitmapData = new BitmapData(300, 250);
bitmapDataA.copyPixels(bitmapdata, new Rectangle(360, 20, 320, 240), new Point(0, 0));
var myEncoder:JPGEncoder = new JPGEncoder(90);
var byteArray:ByteArray = myEncoder.encode(bitmapDataA);