开发者

function CGAffineTransformMakeRotation and CGAffineTransformMake can not work together using quartz-2d

It seems that function CGAffineTransformMakeRotation and CGAffineTransformMake can not work together.

CGContextSetTextMatrix (context, CGAffineTransformMakeRotation  (degreesToRadians(40)));
CGContextSetTextMatrix(context, CGAffineTransformMake(1.0,0.0, 0.0, -1.0, 0.0, 0.0));

I got this

function CGAffineTransformMakeRotation and CGAffineTransformMake can not work together using quartz-2d

CGContextSetTextMatrix (context, CGAffineTransformMakeRotation  (degreesToRadians(40))); 
CGContextSetTextMatrix(context, CGAffineTransformMake(1.0,0.0, 0.0, -1.0, 0.0, 0.0));

I got this

function CGAffineTransformMakeRotation and CGAffineTransformMake can not work together using quartz-2d

What I w开发者_JAVA百科ant to implement is the words are readable and have 40 degree with X-axis.

Thanks!


The CGContextSetTextMatrix sets the text matrix and each call replaces the previous matrix, it does not combine them. You need to combine the matrixes and then set the text matrix:

CGAffineTransform ctm = CGAffineTransformMake(1, 0, 0, 1, 0, 0);
ctm = CGAffineTransformTranslate(ctm, xTextPos, yTextPos);
ctm = CGAffineTransformScale(ctm, 1, -1);
ctm = CGAffineTransformRotate(ctm, -degreesToRadians(40));
CGContextSetTextMatrix(ctx, ctm);
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜