W3C home > Mailing lists > Public > whatwg@whatwg.org > August 2011

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

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Mon, 1 Aug 2011 18:30:34 -0700
Message-ID: <CAAWBYDBtnEXp5Mr72oV5Fy6fpkim-Xe-TJDOq0gaObzO+-qm9w@mail.gmail.com>
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.

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

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:35 UTC