Start networking and exchanging professional insights

Register now or log in to join your professional community.

Follow

How to crop an image in IOS by using polygon? How to crop image in after rotate image view in IOS?

I very this two concepts please help me.

user-image
Question added by Purnachandar Rao Voleti , photo editor , Country Club World
Date Posted: 2013/08/20
megharaj hothur
by megharaj hothur , Lead Engineer , hcl

You can use a CGImageMask;

 

UIView*rotatedViewBox =[[UIView alloc] initWithFrame:CGRectMake(0.0f,0.0f, inImage.size.width, inImage.size.height)]; rotatedViewBox.transform =CGAffineTransformMakeRotation(inAngle);CGSize rotatedSize = rotatedViewBox.frame.size;UIGraphicsBeginImageContext(rotatedSize);CGContextRef bitmap =UIGraphicsGetCurrentContext();CGContextTranslateCTM(bitmap, rotatedSize.width /2.0f, rotatedSize.height /2.0f);CGContextRotateCTM(bitmap, inAngle);CGContextScaleCTM(bitmap,1.0f,-1.0f);CGContextDrawImage(bitmap,CGRectMake(-inImage.size.width /2.0f,-inImage.size.height /2.0f, inImage.size.width, inImage.size.height), inImage.CGImage);UIImage*resultImage =UIGraphicsGetImageFromCurrentImageContext();UIGraphicsEndImageContext();

Munadel Jaitawi
by Munadel Jaitawi , Team Leader , Lamsa

http://iphonedevsdk.com/forum/iphone-sdk-development/79088-draw-a-polygon-and-fill-with-pattern-image.html       http://stackoverflow.com/questions//rotation-and-cropping-an-image-ios

More Questions Like This