croping bitmapData in flex

February 6, 2008 at 7:53 am (Flex) (, )

have a dummy bitmapData object of same diamnetions as ur source and another of what u want;

var bitmapData1:BitmapData = new BitmapData(100,100);
bitmapData = new BitmapData(50,50);

draw the whole source or part of source into bitmapData1

bitmapData1.draw(this,myMatrix,null,null,new Rectangle(0,0, 100, 100));

Copy required pixels from your dummy biitmap data

bitmapData.copyPixels(bitmapData1,new Rectangle(50, 50, 100, 100),new Point());
bitmapData1 = null;

* The same can be achived with 1 bitmapdata object also using matrix object.

Post a Comment