【发布时间】:2016-08-02 04:27:55
【问题描述】:
我正在尝试使用CGContext 更改我的UIImage 区域的颜色,然后从当前状态创建一个新图像。原始图像具有正确的方向,但在此之后,图像会转向。
CGRect imageRect = CGRectMake(0, 0, originalImage.size.width, originalImage.size.height);
UIGraphicsBeginImageContextWithOptions(originalImage.size, false, originalImage.scale);
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSaveGState(context);
CGContextDrawImage(context, imageRect, originalImage.CGImage);
CGContextSetRGBFillColor(context, 255.0f, 255.0f, 255.0f, 1.0f);
CGContextFillRect(context, CGRectMake(5,5,100,100));
CGContextRotateCTM (context, radians(270));
CGContextRestoreGState(context);
UIImage *img = UIGraphicsGetImageFromCurrentImageContext();
【问题讨论】: