W3C home > Mailing lists > Public > public-canvas-api@w3.org > October to December 2011

Re-opening: Canvas 2d path method

From: Charles Pritchard <chuck@jumis.com>
Date: Fri, 30 Sep 2011 18:15:58 -0700
Message-ID: <4E8669CE.5090004@jumis.com>
To: Canvas <public-canvas-api@w3.org>
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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Saturday, 1 October 2011 01:16:21 GMT