Quartz2d,以CG开头的都属于这个框架下 属于C。 UIkt 是再封装了一层,属于OC。
绘图的步骤:
1,获取当前绘图的上下文
CGConntextRef
2,拼接路径。同时把路径添加到上下文当中
CGContextMoveTopoint()
CGContextAddLineToPoint
3,渲染
CGContextStrokePath
UIBezierPath 属于oc
//创建路径对象
UIbezierPath *path = UIbezierPath alloc init
//通过路径对象拼接路径
[path movetopoint
[Path addLineToPoint
//渲染
[Path stroke];
oc 转 c
UIbezierPath *path = UIbezierPath alloc init
path.CGPath
CGcontextSaveGState() 备份( 图像上下文状态) 是一个图像上下文栈
CGcontextRestoreGState() 恢复
进行矩阵操作就是对上下文进行操作 所以得在把路径提交到上下文前进行操作。