相关疑难解决方法(0)

使用CGContextDrawImage旋转图像

如何旋转CGContextDrawImage()中心绘制的图像?

drawRect:

CGContextSaveGState(c);

rect = CGRectOffset(rect, -rect.size.width / 2, -rect.size.height / 2);
CGContextRotateCTM(c, angle);
CGContextDrawImage(c, rect, doodad.CGImage);
CGContextRotateCTM(c, -angle);
CGContextTranslateCTM(c, pt.x, pt.y);

prevRect = rect;

CGContextRestoreGState(c);
Run Code Online (Sandbox Code Playgroud)

我在原点绘制图像,然后在中心旋转图像,然后转换到应该绘制的位置.不工作.

core-graphics cgcontext cgaffinetransform ios cgcontextdrawimage

11
推荐指数
2
解决办法
8926
查看次数