W3C home > Mailing lists > Public > whatwg@whatwg.org > January 2013

[whatwg] Canvas: even-odd winding rule fills

From: James Ascroft-Leigh <jwal@jwal.me.uk>
Date: Wed, 2 Jan 2013 11:40:34 +0000
Message-ID: <CA+vH3CagRwbA46+eGrDuYgZwBa6hGvn=CUwmkKtc0JNMdAizpQ@mail.gmail.com>
To: whatwg@whatwg.org
All,

I recently discovered that a common and well understood 2D graphics
operation is not supported by the 2D canvas API even though it is supported
by almost every other modern 2D graphics API.  This missing feature is
called even-odd fill and controls how the fill region is calculated for
self-intersecting paths or enclosed subpaths.

This is already implemented in Mozilla Firefox as the mozFillRule property
of the 2D canvas drawing context which can take the values "nonzero"
(default) and "evenodd".  The feature is used by projects such as pdf.js
for rendering PDFs to the canvas.

I am working on adding similar functionality to WebKit (for Apple Safari,
Google Chrome and other related browsers).  This is actually really easy as
the backend drawing APIs already have the necessary features to support SVG
rendering.

The suggestion has been made that this is added as an unprefixed fillRule
property and incorporated into the HTML standard.  This has been mentioned
on this list before but there hasn't really been much discussion. Please
see the links below for more information if you are interested.

   * Webkit patch: https://bugs.webkit.org/show_bug.cgi?id=105508
   * W3 "bug": https://www.w3.org/Bugs/Public/show_bug.cgi?id=19932
   * pdf.js issue: https://github.com/mozilla/pdf.js/issues/2351

Post to the list if you have any comments about the proposal or if you
think you can help me.

Thanks,

James
Received on Wednesday, 2 January 2013 11:40:59 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 30 January 2013 18:48:12 GMT