在as3中截取显示对象的最节省资源的方法是什么?
这是我目前使用的代码:
public static function img(o:DisplayObject,width:int,height:int):ByteArray
{
var b:BitmapData = new BitmapData(width,height,true,0x000000);
b.draw(o,new Matrix(o.width/width,0,0,o.height/height),null,null,null,true);
return new JPGEncoder(35).encode(b);
}
但是它占用了太多的CPU能力。如果处理速度更慢,但 CPU 利用率不超过 60%,我可以。
谢谢。