Re: [whatwg] Proposal: Add CanvasRenderingContext2D.fillRule with "nonzero" (default) and "evenodd" options

Thanks for your feedback!
Based on this, I propose the following:
1. create an enum for the winding rule:

enum CanvasWindingRule { "nonzero
<http://www.whatwg.org/specs/web-apps/current-work/multipage/the-canvas-element.html#dom-context-2d-fillrule-nonzero>",
"evenodd <http://www.whatwg.org/specs/web-apps/current-work/multipage/the-canvas-element.html#dom-context-2d-fillrule-evenodd>"
};

Since this enum will likely be used by the path syntax (and possibly SVG),
maybe we can leave the 'Canvas' portion off
2. extend fill:

void fill <http://www.whatwg.org/specs/web-apps/current-work/multipage/the-canvas-element.html#dom-context-2d-fill>(optional
CanvasWindingRule w = "nonzero
<http://www.whatwg.org/specs/web-apps/current-work/multipage/the-canvas-element.html#dom-context-2d-fillrule-nonzero>");

3. extend clip:

void c <http://www.whatwg.org/specs/web-apps/current-work/multipage/the-canvas-element.html#dom-context-2d-fill>lip(optional
CanvasWindingRule w = "nonzero
<http://www.whatwg.org/specs/web-apps/current-work/multipage/the-canvas-element.html#dom-context-2d-fillrule-nonzero>");

4. extend isPointInPath:

boolean isPointInPath
<http://www.whatwg.org/specs/web-apps/current-work/multipage/the-canvas-element.html#dom-context-2d-ispointinpath>(unrestricted
double x, unrestricted double y, optional CanvasWindingRule w =
"nonzero <http://www.whatwg.org/specs/web-apps/current-work/multipage/the-canvas-element.html#dom-context-2d-fillrule-nonzero>");


Rik

On Wed, Jan 9, 2013 at 11:59 AM, Tab Atkins Jr. <jackalmage@gmail.com>wrote:

> On Wed, Jan 9, 2013 at 11:42 AM, Rik Cabanier <cabanier@gmail.com> wrote:
> > Do people have an opinion on a boolean value vs an enum?
> > A boolean value is slightly faster to execute and type while an enum is
> > more descriptive.
> >
> > So far, canvas has not used enum values before.
>
> I strongly prefer enums for cases where it's not a simple yes/no, and
> this clearly qualifies.
>
> (I also prefer enums generally even when this is true, but that's my
> CSS experience talking, where we have a history of changing things
> that were once booleans into multi-state when people ask for more
> features later.)
>
> ~TJ
>

Received on Wednesday, 9 January 2013 21:20:40 UTC