我试图旋转图像,我想在图像文件上绘制(到上下文。一切正常,除非我旋转图像。
基本上我有一个图像;我想缩放和调整图像大小,然后将其剪辑为矩形,最后将其绘制到 UICurrentContext;
//create a new graphic context
UIGraphicsBeginImageContext(CGSizeMake(500, 500));
CGContextRef graphicContext = UIGraphicsGetCurrentContext();
CGContextDrawImage(graphicContext, CGRectMake(0, 0, rect.size.width, rect.size.height), image.CGImage);
CGContextRotateCTM(graphicContext, 45 * M_PI/180.0);
UIImage* editedImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
//draw it to the current context
[editedImage drawAtPoint:CGPointMake(0,0)];
问题是当我旋转图像时,我不知道图像上下文的新大小是多少。接下来,编辑图像中的图像没有 旋转..