iOS开发

CGContextAddArc 和 CGContextAddAr

2016-12-20  本文已影响1678人  Jackson_Z
CGContextAddArc(CGContextRef c, CGFloat x, CGFloat y, // 圆心(x,y)
  CGFloat radius, // 半径
  CGFloat startAngle, CGFloat endAngle, // 开始、结束弧度
  int clockwise // 绘制方向,0:顺时针; 1:逆时针
) 

中心点右侧: 弧度为 0
中心点下方: 弧度为 M_PI_2
中心点左侧: 弧度为 M_PI
中心点上方: 弧度为 -M_PI_2

clockwise == 0时

  1. startAngle为0,绿色箭头的地方。endAngle为M_PI_4,黄色箭头的地方。
/* The arc is tangent to the line from the current point to `(x1, y1)', and the line from `(x1, y1)' to `(x2, y2)'. 
弧线与当前点到点(x1, y1)连线相切,且与点(x1, y1)到点(x2, y2)连线相切*/

CG_EXTERN void CGContextAddArcToPoint(CGContextRef __nullable c,
    CGFloat x1, CGFloat y1, CGFloat x2, CGFloat y2, CGFloat radius)
    CG_AVAILABLE_STARTING(__MAC_10_0, __IPHONE_2_0);
上一篇 下一篇

猜你喜欢

热点阅读