This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.
Developers should be able to specify which fill rule to use, even-odd or non-zero winding rule, when painting a geometry created by sub-paths. Whereas SVG and other technologies support both fill rules, Canvas 2D Context currently only supports non-zero winding rule. I recommend we update the specification to include support for the following attribute on the CanvasRenderingContext2D interface, with a default value of “nonzero” to be compatible with current Canvas sites and apps. attribute DOMString fillRule; // "evenodd", "nonzero" (default: "nonzero") I recommend updating “Section 12 Drawing paths to the canvas” with language similar to the SVG fill-rule property, http://www.w3.org/TR/SVG/painting.html. An example of text could be: "The fillRule attribute represents the algorithm which is used to determine which subpaths are considered inside a closed path. The two valid values are nonzero and evenodd. On getting, it must return the current value. On setting, if the new value is one of the literal strings nonzero, or evenodd, then the current value must be changed to the new value; other values must be ignored, leaving the value unchanged. "Nonzero" This fill rule determines whether an independent subpath is inside a closed path by drawing a ray from a point inside the subpath to infinity in any direction and then examining the places where the subpaths of the path crosses the ray. Starting with a count of zero, add one each time a subpath crosses the ray from left to right and subtract one each time a subpath crosses the ray from right to left. After counting the crossings, if the result is zero then the point is outside the closed path. Otherwise, it is inside. "evenodd" This fill rule determines whether an independent subpath is inside a closed path by drawing a ray from a point inside the subpath to infinity in any direction and counting the number of subpaths of the path that the ray crosses. If this number is odd, the point is inside; if even, the point is outside." Definitions of fill(), clip(), and isPointInPath() methods would need to be updated.
EDITOR'S RESPONSE: This is an Editor's Response to your comment. If you are satisfied with this response, please change the state of this bug to CLOSED. If you have additional information and would like the Editor to reconsider, please reopen this bug. If you would like to escalate the issue to the full HTML Working Group, please add the TrackerRequest keyword to this bug, and suggest title and text for the Tracker Issue; or you may create a Tracker Issue yourself, if you are able to do so. For more details, see this document: http://dev.w3.org/html5/decision-policy/decision-policy.html Status: Fixed Change Description: https://github.com/w3c/html/commit/02b587dd054416de2f240fe86b780c95132f9463 Rationale: New feature added for Context 2d L2.
Related check-ins https://github.com/w3c/html/commit/97061129eb1589604a1697ea568c0d9830ccc511 https://github.com/w3c/html/commit/fb1a90c6415d6f84c9d14c6da53f30d0451a47db
WhatWG bug: https://www.w3.org/Bugs/Public/show_bug.cgi?id=21077