Re-opening: Canvas 2d path method

This was discussed at the SVG F2F in Seattle recently, and has been 
mentioned on the WHATWG mailing lists as well as the W3C.

I'm expecting to add: void path( DOMString svgPath ) to 
CanvasRenderingContext2D.

There may be some issues with the way that arc is specified with SVG. 
There have certainly been issues with arc in older canvas implementations.
That said, it seems like a straightforward task.

The path method would accept a DOMString representing a path, as defined 
by SVG Tiny.

For example, create a line from 0,0 to 0,100:

var canvas = document.createElement('canvas');
var ctx = ctx.getContext('2d');
ctx.path('M0,0 L0,100z');


SVG Paths are well supported by vendors, they have been around quite 
some time,
and implementing them in Canvas via JavaScript has also been done, for 
quite some time.

This proposal would simply codify that practice, and add it onto the 
Canvas 2d spec,
with a reference to SVG Tiny.

Reference:
http://www.w3.org/TR/SVGTiny12/paths.html


-Charles

Received on Saturday, 1 October 2011 01:16:20 UTC