[webkit-dev] Fwd: Proposal: Add CanvasRenderingContext2D.fillRule with "nonzero" (default) and "evenodd" options

Rik Cabanier cabanier at gmail.com
Fri Jan 18 18:30:21 PST 2013


After a discussion the mailing list, we settled on the following syntax:

1. create an enum for the winding rule:

enum CanvasWindingRule { "nonzero", "evenodd" };

2. extend fill:

void fill(*optional CanvasWindingRule w = "nonzero"*);

3. extend clip:

void clip(*optional CanvasWindingRule w = "nonzero"*);

4. extend isPointInPath:

boolean isPointInPath(unrestricted double x, unrestricted double y, *optional
CanvasWindingRule w = "nonzero"*);

This API is already submitted to mozilla:
https://bugzilla.mozilla.org/show_bug.cgi?id=827053
I also have a patch that will implement this in WebKit too:
https://bugs.webkit.org/show_bug.cgi?id=106188

Please let me know if there are any objections.

Rik

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

> On Wed, Jan 9, 2013 at 11:42 AM, Rik Cabanier <cabanier at 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20130118/63d00ee3/attachment.html>


More information about the webkit-dev mailing list