您好,欢迎来到爱go旅游网。
搜索
您的当前位置:首页ios图形之矩阵操作

ios图形之矩阵操作

来源:爱go旅游网
 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 }

转载于:https://www.cnblogs.com/PJHome/p/5152477.html

因篇幅问题不能全部显示,请点此查看更多更全内容

Copyright © 2019- igat.cn 版权所有 赣ICP备2024042791号-1

违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务