首页 > 代码库 > CGPathAddArc & CGPathAddArcToPoint

CGPathAddArc & CGPathAddArcToPoint

CGPathAddArc & CGPathAddArcToPoint

 

参考:http://blog.csdn.net/xcysuccess3/article/details/24001571

 

CGPathAddArc

 

 

注意:由于iOS中的坐标体系是和Quartz坐标体系中Y轴相反的,所以iOS UIView在做Quartz绘图时,Y轴已经做了Scale为-1的转换,因此造成CGPathAddArc函数最后一个是否是顺时针的参数结果正好是相反的,也就是说如果设置最后的参数为YES,根据参数定义应该是顺时针的,但实际绘图结果会是逆时针的。

其实Quartz 2D的坐标系同UIKit并不一样,它的坐标原点在屏幕左下方,但是为了统一编程方式,UIKit对其进行了转换,坐标原点统一在屏幕左上角。

where the red line is what will be drawn, sA is startAngle, eA is the endAngle, r is radius, and x and y are x and y. If you have a previous point the function will line from this point to the start of the arc (unless you are careful this line won‘t be going in the same direction as the arc).

 

 

CGPathAddArcToPoint

Where P1 is the current point of the path, the x1, x2, y1, y2 match the functions x1x2y1y2 and r is radius. The arc will start in the same direction as the line between the current point and (x1, y1)and end in the direction between (x1, y1) and (x2, y2). it won‘t line to (x2, y2) It will stop at the end of the circle.

 

 

CGPathAddArc & CGPathAddArcToPoint