svg-net / SVG

Fork of the ms svg library
http://svg-net.github.io/SVG/
Microsoft Public License
1.17k stars 474 forks source link

Filled path is drawn with wrong stroke #1057

Open alexnoe81 opened 1 year ago

alexnoe81 commented 1 year ago

Description

When drawing filled paths, a wrong border may appear around the path.

Example data

The following svg file shows a red border around yellow triangles. It doesn't do that in other svg viewers, and it is not supposed to:

<?xml version="1.0" encoding="utf-8"  standalone="no"?>
<svg 
 width="960" height="540"
 viewBox="0 0 960 540"
 xmlns="http://www.w3.org/2000/svg"
 xmlns:xlink="http://www.w3.org/1999/xlink"
>

<title>Gnuplot</title>
<desc>Produced by GNUPLOT 5.4 patchlevel 5 </desc>

<g id="gnuplot_canvas">
    <rect x="0" y="0" width="960" height="540" fill="none"/>
    <defs>
        <path id='gpPt7' stroke-width='0.148' stroke='currentColor' d='M0,-1.33 L-1.33,0.67 L1.33,0.67 z'/>
        <use xlink:href='#gpPt7' id='gpPt8' fill='currentColor' stroke='none'/>     
        <use xlink:href='#gpPt7' id='gpPt9' stroke='currentColor' transform='rotate(180)'/>
        <use xlink:href='#gpPt9' id='gpPt10' fill='currentColor' stroke='none'/>
    </defs>

    <g id="gnuplot_plot_3" >
        <title>yyy</title>
        <g fill="none" color="black" stroke="currentColor" stroke-width="2.00" stroke-linecap="butt" stroke-linejoin="miter">
            <use xlink:href='#gpPt8' transform='translate(299.51,281.01) scale(4.72)' color='rgb(192,   0,   0)' opacity='1'/>
            <use xlink:href='#gpPt8' transform='translate(379.73,333.81) scale(4.72)' color='rgb(192,   0,   0)' opacity='1'/>
            <use xlink:href='#gpPt8' transform='translate(459.95,453.80) scale(4.72)' color='rgb(192,   0,   0)' opacity='1'/>
        </g>
    </g>

    <g id="gnuplot_plot_4" ><title>XXX</title>
        <g fill="none" color="black" stroke="currentColor" stroke-width="2.00" stroke-linecap="butt" stroke-linejoin="miter">
            <use xlink:href='#gpPt10' transform='translate(299.51,142.60) scale(4.72)' color='rgb(192, 192,   0)' opacity='1'/>
            <use xlink:href='#gpPt10' transform='translate(379.73,145.80) scale(4.72)' color='rgb(192, 192,   0)' opacity='1'/>
            <use xlink:href='#gpPt10' transform='translate(459.95,139.40) scale(4.72)' color='rgb(192, 192,   0)' opacity='1'/>
        </g>
    </g>
</g>
</svg>

When commenting out the g element with id="gnuplot_plot_3", the red border around the yellow triangles in gnuplot_plot_4vanish.

Used Versions

NuGet 3.4.4, .NET Framework 4.6.2

alexnoe81 commented 1 year ago

With the file above: image

When commenting out gnuplot_id_3: image