[Bug 20612] New: Canvas 2D Context needs to support fillRule attribute

https://www.w3.org/Bugs/Public/show_bug.cgi?id=20612

            Bug ID: 20612
           Summary: Canvas 2D Context needs to support fillRule attribute
    Classification: Unclassified
           Product: HTML WG
           Version: unspecified
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P2
         Component: HTML Canvas 2D Context
          Assignee: jaymunro@microsoft.com
          Reporter: jmann@microsoft.com
        QA Contact: public-html-bugzilla@w3.org
                CC: mike@w3.org, public-html-admin@w3.org,
                    public-html-wg-issue-tracking@w3.org

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.

-- 
You are receiving this mail because:
You are the QA Contact for the bug.

Received on Wednesday, 9 January 2013 00:50:47 UTC