micahpearlman / MonkSVG

SVG parsing framework in C++
BSD 3-Clause "New" or "Revised" License
79 stars 19 forks source link

Simple straight-line corner-node based polygons don't draw. #9

Open gavofyork opened 11 years ago

gavofyork commented 11 years ago

As the title says - an SVG that includes a shape made from corner-nodes (i.e. a simple polygon) doesn't get rendered.

If some of the nodes are changed to curves, only that segment of the shapes gets drawn.

micahpearlman commented 11 years ago

Do you have a simple example svg? FYI the MonkSVG path parser SEE-UCKS! Top of my todo list is grab the W3 svg path BNF and convert that to lex/yacc. I may have some time this week.

gavofyork commented 11 years ago

Couldn't work out how to attach a file. Here's the SVG code straight for a red triangle as a path that won't render:

< ?xml version="1.0" encoding="UTF-8" standalone="no"?> < svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="100" height="100" id="svg2"> < path d="m 0,0 0,100 100,-50 z" style="fill:#ff2a2a;fill-opacity:1;stroke:none" /> < /svg>

Switching the path to be smooth, on the other hand, renders fine:

< ?xml version="1.0" encoding="UTF-8" standalone="no"?> < svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="100" height="100" id="svg2"> < path d="M 0,0 C -30,20 -30,80 0,100 30,120 100,90 100,50 100,10 30,-20 0,0 z" style="fill:#ff2a2a;fill-opacity:1;stroke:none" /> < /svg>