- From: Jatinder Mann <jmann@microsoft.com>
- Date: Tue, 15 Jan 2013 22:59:38 +0000
- To: Rik Cabanier <cabanier@gmail.com>, "public-canvas-api@w3.org" <public-canvas-api@w3.org>
- Message-ID: <d6877b5e48b447c2b2098baae504dc35@BLUPR03MB065.namprd03.prod.outlook.com>
> As you may know until now, canvas only supported even-odd winding. > Maybe graphics libraries and SVG also support non-zero winding. Actually, Canvas 2D Context Level 1 only supports the non-zero winding rule for fill(), clip(), and isPointInPath() today, not even-odd rule. > 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"); It's great to see a proposal here. I strongly feel we should allow developers to select either non-zero winding rule or even-odd rule, just like other graphics technologies. I prefer this proposal instead of introducing new functions for developers to learn, e.g., eoFill(), eoIsPointInPath(), and eoClip(). I believe we will also need to extend this feature to the following versions of those functions as well: void fill(Path path, optional CanvasWindingRule w = "nonzero"); void clip(Path path, optional CanvasWindingRule w = "nonzero"); boolean isPointInPath(Path path, unrestricted double x, unrestricted double y, optional CanvasWindingRule w = "nonzero"); Thanks, Jatinder From: Rik Cabanier [mailto:cabanier@gmail.com] Sent: Tuesday, January 15, 2013 12:43 PM To: public-canvas-api@w3.org Subject: 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 23:02:55 UTC