StarlingGraphics / Starling-Extension-Graphics

flash.display.Graphics style extension for the Starling Flash GPU rendering framework
https://github.com/StarlingGraphics/Starling-Extension-Graphics/wiki
MIT License
282 stars 89 forks source link

Fill triangulation routine bug #106

Open akuklev opened 10 years ago

akuklev commented 10 years ago

The triangulation routine does not process polygons with holes correctly. Both in the case one introduced the holes like in genuine Flash graphics (beginFill, moveTo-lineTo-lineTo for outer contours, then moveTo-lineTo-lineTo for the holes, endFill afterwards) and also in the case one produced holes by making a self-touching contour, like:

// Draw a rectangle(0, 0, 10, 10) {
g.moveTo(0, 0); 
g.lineTo(0, 10);
g.lineTo(10, 10);
g.lineTo(10, 0);
g.lineTo(0, 0);
// }, cut out a triangle((4,4), (4, 5), (5, 4)) {
g,lineTo(4, 4);
g.lineTo(4, 5);
g.lineTo(5, 4);
g,lineTo(4, 4);
g.lineTo(0, 0);
// }
IonSwitz commented 10 years ago

Thank you for reporting this. This is a known issue and the explanation to why it is like this can be read in this issue:

https://github.com/StarlingGraphics/Starling-Extension-Graphics/issues/81

(Don't let the title fool you, the issue is at heart the same as the one you describe here.

It is very hard to solve, and most likely, it won't be solved.