topical media & game development
#graphic-flex-image-effects-07-source-aether-utils-ScreenCapture.ax
#graphic-flex-image-effects-07-source-aether-utils-ScreenCapture.ax
[swf]
[flash]
flex
package aether.utils {
import flash.display.BitmapData;
import flash.display.DisplayObject;
import flash.geom.Matrix;
import flash.geom.Point;
import flash.geom.Rectangle;
public class @ax-graphic-flex-image-effects-07-source-aether-utils-ScreenCapture {
static public function capture(
clip:DisplayObject,
transparent:Boolean=true,
area:Rectangle=null
):BitmapData {
if (area == null) {
area = new Rectangle(0, 0, clip.width, clip.height);
}
var color:uint = transparent ? 0x00FFFFFF : 0xFFFFFFFF;
var image:BitmapData = new BitmapData(area.width, area.height, true, color);
var matrix:Matrix = new Matrix();
matrix.translate(-area.x, -area.y);
image.draw(clip, matrix);
return image;
}
static public function drawFromObject(object:DisplayObject):BitmapData {
var bitmapData:BitmapData = new BitmapData(object.width, object.height, true, 0x00000000);
bitmapData.draw(object);
return bitmapData;
}
}
}
(C) Æliens
04/09/2009
You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.