点的 CGPath 曲线 (iPhone)

发布于 2024-08-29 17:24:05 字数 286 浏览 5 评论 0原文

我正在寻找一种方法来将曲线(也许是参数函数?)绘制到 CGContext

我能想到的最好的例子是 Adob​​e Ideas iPad 应用程序。当用户拖动手指时,应用程序会使用 CGContextAddLineToPoint 为每个 TouchMoved 绘制线条。用户在touchesEnded:处拿起手指后,应用程序会进行一些数学计算,并将所有线条替换为一条平滑的曲线。

我拥有的是 CGPoints 列表,我希望绘制一条平滑的曲线,沿着这些 CGPoints 进入 CGContext。

有什么帮助吗?

I'm looking for a way to draw a curve (perhaps a parametric function?) into a CGContext

The best example which I can think of is the Adobe Ideas iPad application. As the user drags their finger, the application draws lines for every touchesMoved: using CGContextAddLineToPoint. After the user picks up their finger at touchesEnded:, the application does some math and replaces all of the lines with a single, smoothed curve.

What I have is a list of CGPoints, and I am looking to draw a smooth curve which follows those CGPoints into the CGContext.

Any assistance?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

画尸师 2024-09-05 17:24:05

我建议创建 CGPathRef 并使用 CGPathAddQuadCurveToPoint 方法。

希望这有帮助!

I'd advise creating a CGPathRef and use the CGPathAddQuadCurveToPoint method.

Hope this helps!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文