Hello Ramesh, Here is some sample I did image cropping in my application.Please refer it. private function applyCrop( event:MouseEvent ) : void { if(finalImgBx.numChildren > 0) { finalImgBx.removeAllChildren(); } var img:Image = imgCnvsFront.getChildAt(0) as Image; _bitmap = Bitmap(img.content ); _bitmapData = _bitmap.bitmapData; var tmp:BitmapData = new BitmapData(_cropper.width, _cropper.height, true, 0x00000000); var posPoint:Point = new Point(0,0); tmp.copyPixels(_bitmapData, new Rectangle(_cropper.x, _cropper.y, _cropper.width, _cropper.height), posPoint); /* imgCnvs.scrollRect = new Rectangle(_cropper.x+1,_cropper.y+1,_cropper.width,_cropper.height); var tmp:BitmapData = new BitmapData(_cropper.width - 1, _cropper.height - 1); tmp.copyPixels(_bitmap); */ finalBmp = new Bitmap(tmp); finalBmp.height = _cropper.height - 1; finalBmp.width = _cropper.width - 1; finalImage = new Image(); finalImage.height = _cropper.height - 1; finalImage.width = _cropper.width - 1; finalImage.source = finalBmp; finalImage.setStyle("borderStyle","solid"); if(finalImage.width > finalImage.height) { finalImgBx.width = finalImage.width + (finalImage.width*0.5); finalImgBx.height = finalImage.width + (finalImage.width*0.5); } else { finalImgBx.width = finalImage.height + (finalImage.height*0.5); finalImgBx.height = finalImage.height + (finalImage.height*0.5); } finalImage.x = (finalImgBx.width-finalImage.width)*0.5; finalImage.y = (finalImgBx.height-finalImage.height)*0.5; finalImgBx.addChild(finalImage); isScalled = false; isAnyOperationPerformed = true; if(isFlipHorizontal) isLastFlipHorizontal = true; else isLastFlipHorizontal = false; if(isFlipVertical) isLastFlipVertical = true; else isLastFlipVertical = false; } Regards, Sachin Potdar sachi...@gmail.com --- On Tue, 18/1/11, Ramesh Vavila <ramesh...@gmail.com> wrote: |
|