[whatwg] Dashed strokes on <canvas>
Philip Taylor
excors+whatwg at gmail.com
Fri May 25 04:04:16 PDT 2007
On 17/05/07, Philip Taylor <excors+whatwg at gmail.com> wrote:
> On 16/05/07, Ian Hickson <ian at hixie.ch> wrote:
> > For arc() and arcTo() the definition seems complete, but I'm not familiar
> > enough with graphics theory to know what quadraticCurveTo() and
> > bezierCurveTo() need. Could you suggest some text?
>
> I'd probably just add the equations of the curves kind of like:
>
> """
> The quadraticCurveTo(cpx, cpy, x, y) method must do nothing if the
> context has no subpaths. Otherwise it must connect the last point in
> the subpath to the given point (x, y) by a quadratic curve with
> control point (cpx, cpy), and must then add the given point (x, y) to
> the subpath. The curve must cover the points $C(t) = (1-t)^2 P_0 + 2 t
> (1-t) P_1 + t^2 P_2$ with t ranging from 0 to 1, where P_0 is the last
> point in the subpath, P_1 is the control point (cpx, cpy), and P_2 is
> the point (x, y).
>
> The bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y) method must do nothing
> if the context has no subpaths. Otherwise, it must connect the last
> point in the subpath to the given point (x, y) using a Bézier curve
> with control points (cp1x, cp1y) and (cp2x, cp2y). Then, it must add
> the point (x, y) to the subpath. The curve must cover the points $C(t)
> = (1-t)^3 P_0 + 3 t (1-t)^2 P_1 + 3 t^2 (1-t) P_2 + t^3 P_3$ with t
> ranging from 0 to 1, where P_0 is the last point in the subpath, P_1
> is the control point (cp1x, cp1y), P_2 is the control point (cp2x,
> cp2y), and P_3 is the point (x, y).
> """
> (Also s/bezier/Bézier/)
Actually, since I now better understand what "Bézier curve" means, I'd
say something more like
"""
The quadraticCurveTo(cpx, cpy, x, y) method [...] must connect the
last point in the subpath to the given point (x, y) using a quadratic
Bézier curve with control point (cpx, cpy) [...]
The bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y) method [...] must
connect the last point in the subpath to the given point (x, y) using
a cubic Bézier curve with control points (cp1x, cp1y) and (cp2x, cp2y)
[...]
"""
and probably not bother with giving equations, since "quadratic Bézier
curve" and "cubic Bézier curve" are sufficiently well-known and
well-defined (unlike the old "quadratic curve" which seems to be an
undefined or differently-defined term, and the old "Bézier curve"
which is a whole family of curves of varying degrees).
--
Philip Taylor
excors at gmail.com
More information about the whatwg
mailing list