MauriceMeilleur last edited by gferreira
@justvanrossum, I was looking at your conversation with Agyei about blobs again, and I wanted to know: have you and @frederik documented qCurve and qCurveTo anywhere? I'm trying to figure out the syntax from your example and it's not making sense to me—how does the method know these are all handles with no on-curve points?
Quadratic curves are available in DrawBot in the
BezierPathobject cause its a subclass of a BasePen.
It could be added as callback similar as to
qCurveToso it can be documented and directly be supported.
justvanrossum last edited by justvanrossum
@mauricemeilleur It's part of the "pen protocol" which lives in with FontTools, so any documentation should go there. It's documented in the code, have a look at the
The main trick for the blobs is indeed the fact that the contour will have no on-curve points, and that is achieved by passing
Noneas the last argument to
Thanks for the link, Frederik—now what Just told me once about implied on-curve points is starting to make more sense. If I understand it right, curveTo() requires you to make the on-curve point explicit, while qCurveTo() does not?
@justvanrossum Thanks, Just—Frederik sent me there, too, and the syntax is starting to make sense to me now.
@justvanrossum So in the blob sketch, drawing the curve with control points only was a matter of efficient code? Because I guess you could draw a blob with curveTo(), but then you'd have to define all the segments individually and you'd have to vary the on-curve points as well as the control points, right?
I get a list that includes none of those control points. And there are more points in the list than there can be interpolated on-curve points and control points.
bez = BezierPath() bez.qCurveTo((-182, -57), (30, 145), (75, 174), (150, 150), (0, -150), None) drawPath(bez) print(bez.points)
[(-91.0, -103.5), (-151.66666666666666, -72.5), (-146.66666666666666, -23.33333333333333), (-76.0, 44.0), (-5.333333333333343, 111.33333333333333), (37.5, 149.83333333333334), (52.5, 159.5), (67.5, 169.16666666666666), (87.5, 170.0), (112.5, 162.0), (137.5, 154.0), (125.0, 100.0), (75.0, 0.0), (25.0, -100.0), (-30.333333333333336, -134.5), (-91.0, -103.5)]
What am I seeing?
justvanrossum last edited by
@mauricemeilleur You're seeing the representation of your shape as cubic beziers. The quads get converted to cubic because the underlying NSBezierPath doesn't support quadratic curves.
@justvanrossum Ah. That explains a lot, going all the way to some stuff I was trying in January. Thanks!