[whatwg] Canvas 2d: proposal to add path(DOMString)

On Fri, Jul 29, 2011 at 1:44 PM, Charles Pritchard <chuck at jumis.com> wrote:
> Having spoken to several developers, I think that we're clear to add a new
> method to the canvas 2d api;
> though there is some question about how it should be added.
>
> The method would take a DOMString using SVG path semantics.
>
> I'm not certain which route is better:
> ctx.path('M....z')
> or
> ctx.fillPath('M ..z'), ctx.strokePath('M...z');
>
> This usually takes ~80 lines of JavaScript to support,
> we're eager to see it added to native implementations.
>
> All browser vendors have SVG support now, and could easily re-use
> code from their SVG implementations to implement this canvas 2d
> supplemental.

I strongly agree with this.  Path parsing is annoying; it'd be very
nice to have the browser handle that for me.

As well, simply making a path using the normal commands is annoyingly
verbose.  SVG paths optimize for terseness (at a moderate cost to
readability), which can help keep code smaller and easier to read with
complex paths.

~TJ

Received on Monday, 1 August 2011 18:30:34 UTC