- From: Maxim Shemanarev <mcseem@antigrain.com>
- Date: Fri, 11 Nov 2005 09:52:53 -0500
- To: <www-svg@w3.org>
Hi SVG Experts, Suppose we have the following SVG (from the SVG 1.1 example): ======================= <?xml version="1.0" standalone="no"?> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> <svg width="4in" height="2in" viewBox="0 0 4000 2000" version="1.1" xmlns="http://www.w3.org/2000/svg"> <defs> <marker id="Triangle" viewBox="0 0 10 10" refX="0" refY="5" markerUnits="strokeWidth" markerWidth="4" markerHeight="3" orient="auto"> <path d="M 0 0 L 10 5 L 0 10 z" /> </marker> </defs> <rect x="10" y="10" width="3980" height="1980" fill="none" stroke="blue" stroke-width="10" /> <desc>Placing an arrowhead at the end of a path. </desc> <path d="M 1000 750 L 2000 750 L 2500 1250" fill="none" stroke="black" stroke-width="100" marker-end="url(#Triangle)" /> </svg> ====================== Here we have a black arrohead. Then, we enclose <defs> into <g> as follows: ======================= <?xml version="1.0" standalone="no"?> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> <svg width="4in" height="2in" viewBox="0 0 4000 2000" version="1.1" xmlns="http://www.w3.org/2000/svg"> <g fill="green"> <!-- HERE! --> <defs> <marker id="Triangle" viewBox="0 0 10 10" refX="0" refY="5" markerUnits="strokeWidth" markerWidth="4" markerHeight="3" orient="auto"> <path d="M 0 0 L 10 5 L 0 10 z" /> </marker> </defs> </g> <rect x="10" y="10" width="3980" height="1980" fill="none" stroke="blue" stroke-width="10" /> <desc>Placing an arrowhead at the end of a path. </desc> <path d="M 1000 750 L 2000 750 L 2500 1250" fill="none" stroke="black" stroke-width="100" marker-end="url(#Triangle)" /> </svg> ======================= Adobe SVG draws a green marker in this case, but in Inkscape it remains black. And the specification doesn't say anything about this behaviour (or I might be missing something). So, what is the correct behaviour? In other words, should we take into account the attribute values that exist at the entry point of the marker/pattern definition? If we should it leads us to whether: a) Very inefficient rendering, O(n^2), when for every marker we have to traverse the whole DOM from the beginning to deduct the attributes at the marker entry point. Or: b) Very complex and buggy code (literally spaghetti-code), especially considering scripting and editing. Just imagine you have 10 nested <g> with a <marker> element inside and then you change some attribute at the 5th <g> that affects the marker. Collecting of the attribute values becomes a nightmare. Can we treat the attributes at the marker/pattern entry point as default ones? McSeem
Received on Friday, 11 November 2005 14:53:08 UTC