点的 CGPath 曲线 (iPhone)
我正在寻找一种方法来将曲线(也许是参数函数?)绘制到 CGContext
我能想到的最好的例子是 Adobe 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我建议创建 CGPathRef 并使用 CGPathAddQuadCurveToPoint 方法。
希望这有帮助!
I'd advise creating a CGPathRef and use the CGPathAddQuadCurveToPoint method.
Hope this helps!