Quartz-2D:绘图
函数 |
方法 |
CGContextBeginPath |
开始一个新路径 |
CGContextMoveToPoint |
设置路径的起点 |
CGContextClosePath |
关闭路径 |
CGContextAddPath |
添加路径 |
CGContextAddLineToPoint |
在指定点添加线 |
CGContextAddLines |
添加多条线 |
CGContextAddRect |
添加矩形 |
CGContextAddRects |
添加多个矩形 |
CGContextAddEllipseInRect |
在矩形区域中添加椭圆 |
CGContextAddArc |
添加圆弧 |
CGContextAddArcToPoint |
在指定点添加圆弧 |
CGContextAddCurveToPoint |
在指定点添加曲线 |
函数 |
方法 |
CGContextDrawPath |
绘制路径 |
CGContextFillPath |
实心路径 |
CGContextFillRect |
实心矩形 |
CGContextFillRects |
多个实心矩形 |
CGContextFillEllipseInRect |
在矩形区域中绘制实心椭圆 |
CGContextStrokePath |
空心路径 |
CGContextStrokeRect |
空心矩形 |
CGContextStrokeRectWithWidth |
使用宽度绘制空心矩形 |
CGContextStrokeEllipseInRect |
在矩形区域中绘制空心椭圆 |
函数 |
方法 |
CGContextSetLineWidth |
设置线宽 |
CGContextSetBlendMode |
设置混合模式 |
CGContextSetShouldAntialias |
设置抗锯齿效果 |
CGContextSetLineCap |
设置线条收尾点样式 |
CGContextSetLineJoin |
设置线条连接点样式 |
CGContextSetLineDash |
设置虚线 |
有平移变换、缩放变换、旋转变换、x轴对称变换、y轴对称变换、坐标原点对称变换。
CTM变换矩阵: current transform Martix的简称
CTM主要涉及的函数有:
CGContextRotateCTM:旋转变换
CGContextScaleCTM:缩放变换
CGContextTranslateCTM:平移变换
仿射变换(Affine):
也是一种2D变换,他可以重用变换,经过多次变换,每一种变换都可以用矩阵表示,通过多次矩阵相乘得到最后结果。
下面是一些访射变换函数:
CGAffineMakeRotation:创建新的旋转变换矩阵
CGAffineMakeScale:创建新的 缩放矩阵函数
CGAffineMakeTranslation:创建新的平移矩阵
CGAffineTransformRotate:旋转矩阵
CGAffineTransformScale:缩放矩阵
CGAffineTransformTranslate:平移矩阵
CGContextConcatCTM:连接到CTM变换。