• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

ios - UIBezierPath 段连接导致间隙

[复制链接]
菜鸟教程小白 发表于 2022-12-12 15:38:09 | 显示全部楼层 |阅读模式 打印 上一主题 下一主题

我正在使用 [SKShapeNode shapeNodeWithPath...],但无论我为线连接、平坦度或斜接限制设置了哪些选项,绘制线时都会出现间隙。为什么会这样?

enter image description here

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)];



Best Answer-推荐答案


来自 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/

回复

使用道具 举报

懒得打字嘛,点击右侧快捷回复 【右侧内容,后台自定义】
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关注0

粉丝2

帖子830918

发布主题
阅读排行 更多
广告位

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap