我正在使用 [SKShapeNode shapeNodeWithPath...]
,但无论我为线连接、平坦度或斜接限制设置了哪些选项,绘制线时都会出现间隙。为什么会这样?
UIBezierPath* bezierPath = UIBezierPath.bezierPath;
[bezierPath moveToPoint: CGPointMake(43.5, 49.5)];
[bezierPath addLineToPoint: CGPointMake(273.5, 49.5)];
[bezierPath addCurveToPoint: CGPointMake(273.5, 116.5) controlPoint1: CGPointMake(273.5, 49.5) controlPoint2: CGPointMake(322.5, 82.5)];
[bezierPath addCurveToPoint: CGPointMake(287.5, 222.5) controlPoint1: CGPointMake(224.5, 150.5) controlPoint2: CGPointMake(287.5, 222.5)];
[bezierPath addCurveToPoint: CGPointMake(227.5, 294.5) controlPoint1: CGPointMake(287.5, 222.5) controlPoint2: CGPointMake(351.5, 316.5)];
[bezierPath addCurveToPoint: CGPointMake(43.5, 255.5) controlPoint1: CGPointMake(103.5, 272.5) controlPoint2: CGPointMake(43.5, 255.5)];
[bezierPath addCurveToPoint: CGPointMake(43.5, 181.5) controlPoint1: CGPointMake(43.5, 255.5) controlPoint2: CGPointMake(-38.5, 221.5)];
[bezierPath addCurveToPoint: CGPointMake(171.5, 181.5) controlPoint1: CGPointMake(125.5, 141.5) controlPoint2: CGPointMake(171.5, 164.5)];
[bezierPath addCurveToPoint: CGPointMake(123.5, 203.5) controlPoint1: CGPointMake(171.5, 198.5) controlPoint2: CGPointMake(160.5, 225.5)];
[bezierPath addCurveToPoint: CGPointMake(54.5, 222.5) controlPoint1: CGPointMake(86.5, 181.5) controlPoint2: CGPointMake(54.5, 222.5)];
[bezierPath addCurveToPoint: CGPointMake(227.5, 255.5) controlPoint1: CGPointMake(54.5, 222.5) controlPoint2: CGPointMake(210.5, 277.5)];
[bezierPath addCurveToPoint: CGPointMake(227.5, 181.5) controlPoint1: CGPointMake(244.5, 233.5) controlPoint2: CGPointMake(227.5, 181.5)];
[bezierPath addCurveToPoint: CGPointMake(227.5, 116.5) controlPoint1: CGPointMake(227.5, 181.5) controlPoint2: CGPointMake(206.5, 142.5)];
[bezierPath addCurveToPoint: CGPointMake(227.5, 88.5) controlPoint1: CGPointMake(248.5, 90.5) controlPoint2: CGPointMake(227.5, 88.5)];
[bezierPath addLineToPoint: CGPointMake(43.5, 88.5)];
[bezierPath addLineToPoint: CGPointMake(43.5, 49.5)];
[bezierPath closePath];
CGFloat scale = 4;
[bezierPath applyTransform:CGAffineTransformMakeScale(scale, scale)];
来自 docs
A line width larger than 2.0 may cause rendering artifacts in the final rendered image. The default value is 1.0.
更改线宽可能会有所帮助。但是,使用 UIKIT 肯定不会导致任何缺陷。我想知道你是否可以切换到那个。
另一个有趣的阅读: http://sartak.org/2014/03/skshapenode-you-are-dead-to-me.html
关于ios - UIBezierPath 段连接导致间隙,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31039696/
欢迎光临 OStack程序员社区-中国程序员成长平台 (https://ostack.cn/) | Powered by Discuz! X3.4 |