![]() |
|
||||||||||
|
|||||||
|
|
« Предыдущая тема | Следующая тема » |
| Опции темы | Опции просмотра |
|
![]() |
![]() |
|
|
|
|||||
|
Регистрация: Aug 2012
Сообщений: 297
|
Здравствуйте.
Каким образом можно сделать скриншот приложения (или какую-то его часть) программным способом? |
|
|||||
|
скопировать всё что на сцене в битмапдату
private function getBitmapData( target:DisplayObject ) : BitmapData { if ( bd ) { bd = null; } //target.width and target.height can also be replaced with a fixed number. var bd : BitmapData = new BitmapData( target.width, target.height ); bd.draw( target ); return bd; } private function displayCapturedBitmapData():void { var bmp:Bitmap = new Bitmap( getBitmapData( myImage ) ); addChild(bmp); } |
|
|||||
private function extractBmpd( ARG_object:DisplayObject, ARG_x:Number=0, ARG_y:Number=0, ARG_width:Number=0, ARG_height:Number=0):BitmapData { if (!ARG_width) ARG_width = ARG_object.width; if (!ARG_height) ARG_height = ARG_object.height; var cropArea:Rectangle = new Rectangle(0, 0, ARG_width, ARG_height); var bmpd:BitmapData = new BitmapData(ARG_width, ARG_height); var croppedBitmap:Bitmap = new Bitmap(bmpd, PixelSnapping.ALWAYS, true); var cropMatrix:Matrix = new Matrix(); cropMatrix.translate(-ARG_x, -ARG_y); bmpd.draw( ARG_object, cropMatrix, null, null, cropArea, true ); return bmpd; } addChild(new Bitmap(extractBmpd(this));
__________________
return this... |
![]() |
![]() |
Часовой пояс GMT +4, время: 22:37. |
|
|
« Предыдущая тема | Следующая тема » |
|
|