简体   繁体   English

CGPathAddArc是否包含圆的中心像素?

[英]Does CGPathAddArc include the center pixel of a circle?

I use CGPathAddArc to create a circle, if the radius is 5 pixel, will the whole circle end up with 10 pixels width or 11 pixels? 我使用CGPathAddArc创建一个圆,如果半径为5像素,则整个圆的宽度最终将为10像素还是11像素?

It's also confusing if it does end up with 10 pixels. 如果最终以10像素结尾,也会令人困惑。 In that case, what does it mean that center of a radius? 在这种情况下,半径中心是什么意思?

The CGPathAddArc defined here: CGPathAddArc在这里定义:

void CGPathAddArc (
CGMutablePathRef path,
const CGAffineTransform *m,
CGFloat x,
CGFloat y,
CGFloat radius,
CGFloat startAngle,
CGFloat endAngle,
bool clockwise
);

It does end up with 10 pixels as the diameter, which includes the center point. 最终它的直径为10像素,其中包括中心点。 As the Apple reference doc says: 如Apple 参考文件所述

When you call this function, you provide the center point, radius, and two angles in radians. 调用此函数时,将以弧度为单位提供中心点,半径和两个角度。 Quartz uses this information to determine the end points of the arc 石英使用此信息来确定圆弧的终点

The end points are determined 'including' the center point, so that the entire diameter is 10. 确定端点为“包括”中心点,以便整个直径为10。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM