[whatwg] [canvas] CanvasRenderingContext2D with addPath, currentPath

Hi,

Would it be possible to extend CanvasRenderingContext2D with the functions:

void addPath(Path path); - which adds a Path object to the current path on Canvas?
attribute Path currentPath; - that returns a copy of the current path, or let you replace the current path with another Path object (not live)?

These could possibly also replace clip(Path), fill(Path), stroke(Path),  drawSystemFocusRing(Path path...), isPointInPath(Path path…).

It needs to be clarified what happens for this case:

var path = new Path();
path.lineTo(20,20);
ctx.currentPath = path;
ctx.fill();

The pendant on CanvasRenderingContext2D:

ctx.beginPath();
ctx.lineTo(20,20);

would do a moveTo(20,20) internally. Should Path do the same? This problem exists for fill(Path path) at the moment as well, if I did not miss a line. Qt for instance adds a moveTo(0,0) at the beginning if no current point was specified, other platforms behave differently.

Greetings,
Dirk

Received on Saturday, 22 September 2012 07:22:17 UTC