首页 > 移动平台 > 详细

ios图形之矩阵操作

时间:2016-01-23 01:13:05      阅读:201      评论:0      收藏:0      [点我收藏+]
 1 - (void)drawRect:(CGRect)rect
 2 {
 3     // 画四边形
 4     CGContextRef ctx = UIGraphicsGetCurrentContext();
 5     
 6     // 保存上下文
 7     CGContextSaveGState(ctx);
 8     
 9     // 注意:设置矩阵操作必须在添加绘图信息之前
10     CGContextRotateCTM(ctx, M_PI_4);
11 //    CGContextScaleCTM(ctx, 0.5, 0.5);
12 //    CGContextTranslateCTM(ctx, 0, 150);
13     
14     CGContextAddRect(ctx, CGRectMake(200, 100, 100, 100));
15     
16     
17     CGContextRestoreGState(ctx);
18     
19     CGContextAddEllipseInRect(ctx, CGRectMake(20, 20, 100, 100));
20     
21     CGContextStrokePath(ctx);
22     
23 }

技术分享

ios图形之矩阵操作

原文:http://www.cnblogs.com/PJHome/p/5152477.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!