试图捕捉使用的BitmapData舞台区 [英] Trying to capture stage area using BitmapData

查看:144
本文介绍了试图捕捉使用的BitmapData舞台区的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想抓住的部分使用的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);

这篇关于试图捕捉使用的BitmapData舞台区的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆