
El siguiente es un tip rápido que me tomo algo de tiempo concluir, espero que sea de utilidad.
/**
*@Comment regresa el espacio Bitmap delimitado por las dimensiones y cordenadas proporcionadas
*/
import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.display.IBitmapDrawable;
import flash.display.BlendMode;
import flash.display.PixelSnapping;
import flash.geom.Rectangle;
public static function crop( $x:Number, $y:Number,$width:Number, $height:Number, $displayObject:IBitmapDrawable = null):Bitmap
{
var cropArea:Rectangle = new Rectangle( 0, 0, $width, $height );
var croppedBitmap:Bitmap = new Bitmap( new BitmapData( $width, $height ), PixelSnapping.ALWAYS, true );
var what:* = (($displayObject!=null) ? $displayObject : Stage);
croppedBitmap.bitmapData.draw(what, new Matrix(1, 0, 0, 1, -$x, -$y) , null, BlendMode.NORMAL, cropArea, true );
return croppedBitmap;
}
Tags: actionscript3, AS3, crop image using as3
