svg-net / SVG

Fork of the ms svg library

Home Page:http://svg-net.github.io/SVG/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Logo get rendered incorrect

anthonn opened this issue · comments

Description

This SVG:
source

Gets rendered as:
render

The followin test code was used:

var svg = SvgDocument.Open<SvgDocument>(Stream);
_image = svg.Draw();
_image.Save("render.png");

Stream.Seek(0, SeekOrigin.Begin);
using var save = File.Open("source.svg", FileMode.Create);
Stream.CopyTo(save);				

Example data

images.zip

Used Versions

.NET 4.8
SVG 3.4.7

@anthonn

(workaround)

First of all, this will be correctly rendered.

    <g transform="translate(0 .047)" fill="none" fill-rule="evenodd">
       <!-- (workaround)moved this element. -->
        <mask id="f" fill="#fff"><use xlink:href="#e" /></mask>

        <g transform="translate(142.142)">
            <mask id="b" fill="#fff"><use xlink:href="#a" /></mask>
            <path d="M7.281 16.708c.795-5.661 5.517-10.245 11.45-10.245 5.985 0 10.713 4.547 11.504 10.245h7.019C36.38 7.258 28.467.26 18.835.26 9.118.261 1.16 7.195.264 16.708H7.28z" fill="#FF8300" mask="url(#b)" />
        </g>

        <path d="M172.372 20.141c-.804 5.69-5.484 10.297-11.5 10.297-5.963 0-10.636-4.643-11.445-10.297h-7.034c.819 9.577 8.76 16.446 18.48 16.446 9.651 0 17.67-6.933 18.526-16.446h-7.027zM0 12.8h6.775V6.933h12.456V1.043H0z" fill="#FF8300" />

        <g transform="translate(0 16.033)">
            <mask id="d" fill="#fff"><use xlink:href="#c" /></mask>
            <path fill="#FF8300" mask="url(#d)" d="M6.775 6.09h11.987V.201H0v19.571H19.23v-5.89H6.775z" />
        </g>

        <path fill="#FF8300" d="M26.67 29.916v5.89h17.46v-5.89H33.444z" />

        <path fill="#FF8300" mask="url(#f)" d="M26.67 26.483h6.775V1.043H26.67zM48.484 26.483h6.775V1.043h-6.775zM77.099 22.124h11.987v-5.89H70.324v19.572h19.231v-5.89H77.1zM106.223 16.21h-7.13l8.505 20.482h3.596l1.628-3.868-3.686-9.284zM48.484 29.916v5.89h17.46v-5.89H55.258zM129.545 16.708h6.776V1.043h-6.776zM129.545 36.692h6.776v-16.55h-6.776zM118.855 1.043l-7.523 18.725 3.392 8.54 11.48-27.265zM100.197 1.043h-7.4l4.871 11.733h7.191zM70.324 12.8h6.775V6.933h12.456V1.043H70.324z" />
    </g>

Another logo that get corrupted at rendering:
image

Should look like:
download

svg.zip

@anthonn

mask attribute of <path> element is not implemented...

See #482. There is actually an old PR #825 that seems to fix this, I don't know the state of that.
@H1Gdev - you had reviewed it at the time, can you please have a look?

@mrbean-bremen

PR #825 has conflicts with the latest source code.
Also, looking at the background, it seems that this PR #825 has not been completed.

Ok, thanks - conflicts can be resolved, but if it was not finished...