sammycage / lunasvg

SVG rendering and manipulation library in C++
MIT License
866 stars 124 forks source link

Gradient support #22

Closed Lpsd closed 3 years ago

Lpsd commented 3 years ago

linearGradient doesn't seem to be working with the file below. Is this something I'm doing wrong, or isn't implemented yet?

<?xml version="1.0" encoding="iso-8859-1"?>
<svg version="1.1" viewBox="0 0 300 300" x="50%" y="50%" width="300" height="300" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
    <defs>
        <linearGradient id="myGradient" gradientTransform="rotate(90)">
            <stop offset="5%"  stop-color="gold" />
            <stop offset="95%" stop-color="red" />
        </linearGradient>
    </defs>

    <!-- using my linear gradient -->
    <circle cx="150" cy="150" r="150" fill="url('#myGradient')" />
</svg>
Lpsd commented 3 years ago

It turns out I needed to change url('#myGradient') to url(#myGradient), now it's working.