[webkit-dev] Enable CANVAS_PATH by default
Dirk Schulze
dschulze at adobe.com
Thu Feb 14 09:55:00 PST 2013
Hi WebKit folks,
I worked on the Path interface defined by the Canvas spec of W3C and WHATWG [1][2] for the last couple of weeks.
Summary:
Canvas supports a new DOM interface called Path. The Path interface takes a series of very well known path methods like moveTo, lineTo, cubicCurveTo, rect and allows to create and keep a path independent of a Canvas context. Additionally, I added the attribute 'currentPath' to the Canvas context to provide read and write access to the current path created on the Canvas context. Code snippet:
var path = new Path();
path.rect(0,0,100,100);
var ctx = canvas.getContext('2d');
ctx.currentPath = path;
ctx.lineTo(200,200);
ctx.closePath();
var path2 = ctx.currentPath; // path2 != path
Not implemented are addText, addPath, addPathByStrokingText. Another proposal from Rik Cabanier[3] seems to address the idea behind these methods better.
I would like to ask to enable CANVAS_PATH by default on trunk. Ports can opt-out the flag again. More information about some implementation details in a short article[4]. If there are any concerns, suggestions or questions, I am happy to answer them.
Greetings,
Dirk
[1] http://www.w3.org/html/wg/drafts/2dcontext/html5_canvas/#path-objects
[2] http://www.whatwg.org/specs/web-apps/current-work/multipage/the-canvas-element.html#path-objects
[3] http://blogs.adobe.com/webplatform/2013/01/31/revised-canvas-paths/
[4] http://dschulze.com/blog/articles/10/html-canvas-path-object-in-webkit
More information about the webkit-dev
mailing list