问题描述
我熟悉UIBezierPath和相应的CG例程,但是它们似乎都没有绘制出与我在Photoshop等中看到的相同类型的路径.
I'm familiar with UIBezierPath and the corresponding CG routines, but none of them appear to draw the same type of path as what I see in Photoshop, etc.
该如何处理?我只是在谈论用户界面-让用户拖动点.
How would one go about this? I'm just talking about the UI--letting the user drag around points.
我在这里找到一个Java示例: http://www.cse.unsw.edu.au/~lambert/splines/natcubic.html
A java example I found is here: http://www.cse.unsw.edu.au/~lambert/splines/natcubic.html
推荐答案
我将研究CGContextAddCurveToPoint并拖动曲线的控制点.如果您需要更多控制点来创建复杂曲线,只需将结果曲线分成简单的段即可.
I would look into CGContextAddCurveToPoint and drag around curve's control points. If you require more control points to create a complex curve, just split a resulting curve into simple segments.
看看本文,它说明了如何计算控制点根据您曲线上的结.
Take a look at this article It explains how to calculate the control points based on knots you have on your curve.
这篇关于如何在UIKit中实现Photoshop Curves编辑器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!