This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 17784 - request: even/odd winding algorithm in addition to non-zero
Summary: request: even/odd winding algorithm in addition to non-zero
Status: RESOLVED FIXED
Alias: None
Product: HTML WG
Classification: Unclassified
Component: HTML5 spec (show other bugs)
Version: unspecified
Hardware: PC Windows NT
: P1 normal
Target Milestone: ---
Assignee: This bug has no owner yet - up for the taking
QA Contact: HTML WG Bugzilla archive list
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-07-15 16:09 UTC by Mike Kamermans
Modified: 2015-06-16 17:08 UTC (History)
5 users (show)

See Also:


Attachments

Description Mike Kamermans 2012-07-15 16:09:40 UTC
I'd like to request that the canvas 2d context fill style is extended with support for the even/odd winding algorithm, in addition to the non-zero winding algorithm, so that drawing shapes on the canvas that are based on paths obtained from graphics sources that encode shapes using the even/odd winding algorithm can be drawn without having to manually analyse the path for subpaths that need their direction flipped.

Use cases are using image from .svg resource with the intention of using them as rasterised image data (not vector graphics) and shapes such as font outlines (for use as polygon graphics, not "letters") to the canvas.

(As a bonus, this algorithm is already available for reuse in every current browser, since SVG requires algorithms both to be available, making implementing it for canvas 2d mostly a matter of hooking it up correctly)
Comment 1 contributor 2012-07-18 07:13:34 UTC
This bug was cloned to create bug 17893 as part of operation convergence.
Comment 2 rcabanie 2012-08-21 22:41:22 UTC
This is indeed very useful and widely used. 
Moving to HTML.Next as it is a new feature request
Comment 3 Robin Berjon 2013-01-21 15:58:11 UTC
Mass move to "HTML WG"
Comment 4 Robin Berjon 2013-01-21 16:00:57 UTC
Mass move to "HTML WG"
Comment 5 Michael[tm] Smith 2015-06-16 10:15:24 UTC
Making this a higher priority to actively seek more feedback on from implementers and webdevs.
Comment 6 rcabanie 2015-06-16 16:50:04 UTC
This was implemented by every browser 1-2 years ago.
Comment 7 Mike Kamermans 2015-06-16 17:08:46 UTC
indeed, this bug has since been resolved, but never got closed.

http://jsbin.com/kemogesubu/edit?html,js,output demonstrates "evenodd" as fill rule working (I only tested it in firefox, chrome, and IE, but kind of assume that means evreyone supports it). You can change "evenodd" to "nonzero" to see it do a flood fill, or keep it "evenodd" to see it only fill the parts that uniquely cordon off a polygonal section.