Adding winding rules to Canvas

All,

there was a recent discussion on adding winding rules to canvas. As you may
know until now, canvas only supported even-odd winding.
Maybe graphics libraries and SVG also support non-zero winding.[1][2]

Mozilla exposes this currently with 'mozFillRule'. Making this part of the
graphics state has several drawbacks.
The biggest is that fill/clip will now have to check the state every time,
or set/reset it. Winding is also part of path geometry.

I have the following proposal:

enum CanvasWindingRule { "nonzero", "evenodd" };
void fill(optional CanvasWindingRule w = "nonzero");
void clip(optional CanvasWindingRule w = "nonzero");
boolean isPointInPath(unrestricted double x, unrestricted double y,
optional CanvasWindingRule w = "nonzero");


proposed patches for this API can be found here:
https://bugs.webkit.org/show_bug.cgi?id=105508
https://bugzilla.mozilla.org/show_bug.cgi?id=827053

What do people think?

1: http://www.w3.org/TR/SVG/painting.html#FillRuleProperty
2: http://en.wikipedia.org/wiki/Nonzero-rule

Received on Tuesday, 15 January 2013 20:43:10 UTC