开发者

How to rotate a cgpath before drawing it?

I can draw a path...and i am somewhat sure that i need to use affine transform.

what i don't get is how to rotate the path and keep the same center.

I apologize for the lack of c开发者_如何学编程ode here...but all I have is a failed call to CGContextRotateCTM that seemed to halt all drawing.


To rotate around the center:

CGContextTranslateCTM (ctx, center.x, center.y);
CGContextRotateCTM (ctx, angleInRadians);
CGContextTranslateCTM (ctx, -center.x, -center.y);
CGContextAddPath (ctx, path);

I might have the translate signs backward (i.e. negative translation before rotate instead of after), although I believe the CTM methods pre-concat, so the mathematical representation of those calls is

CTMnew = -T * R * T * CTMcurrent
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜