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
[email protected]
--- On Tue, 18/1/11, Ramesh Vavila <[email protected]> wrote:
From: Ramesh Vavila <[email protected]>
Subject: [flex_india:32661] cropping image
To: [email protected]
Date: Tuesday, 18 January, 2011, 4:20 PM
Hi Everybody
How to Crop the selected area of image in flex 4 can help me in this. if any
reference code please send me that code url.
Thanks in Advance
ramesh v
--
You received this message because you are subscribed to the Google Groups "Flex
India Community" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/flex_india?hl=en.
--
You received this message because you are subscribed to the Google Groups "Flex
India Community" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/flex_india?hl=en.