Arbitrary rotation of a CGImage

Friday, September 4th, 2009 Share on Twitter

For my current project, I have to rotate a CGImageRef by an arbitrary angle. Here is the code: - (CGImageRef)CGImageRotatedByAngle:(CGImageRef)imgRef angle:(CGFloat)angle { CGFloat angleInRadians = angle * (M_PI / 180); CGFloat width = CGImageGetWidth(imgRef); CGFloat height = CGImageGetHeight(imgRef); CGRect imgRect = CGRectMake(0, 0, width, height); ...