sammycage / lunasvg

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

Case where gradient is lost #90

Closed ifiddynine closed 1 month ago

ifiddynine commented 2 years ago

Hi,

I found an issue where a gradient isn't loaded or rendered correctly, see attached repro case.

<svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect width="40" height="40" rx="6" fill="#18181B"/>
<rect width="40" height="40" rx="6" fill="#9F81DD"/>
<rect width="40" height="40" rx="6" fill="url(#paint0_radial_1325_17657)"/>
<rect width="40" height="40" rx="6" fill="url(#paint1_radial_1325_17657)"/>
<rect width="40" height="40" rx="6" fill="url(#paint2_radial_1325_17657)"/>
<path d="M14 19.25C13.5858 19.25 13.25 19.5858 13.25 20C13.25 20.4142 13.5858 20.75 14 20.75H19.25V26C19.25 26.4142 19.5858 26.75 20 26.75C20.4142 26.75 20.75 26.4142 20.75 26V20.75H26C26.4142 20.75 26.75 20.4142 26.75 20C26.75 19.5858 26.4142 19.25 26 19.25H20.75V14C20.75 13.5858 20.4142 13.25 20 13.25C19.5858 13.25 19.25 13.5858 19.25 14V19.25H14Z" fill="white"/>
<defs>
<radialGradient id="paint0_radial_1325_17657" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(31.8667 33.9535) rotate(-161.408) scale(19.6945 15.4579)">
<stop stop-color="#CE5ACE"/>
<stop offset="1" stop-color="#B139B1" stop-opacity="0"/>
</radialGradient>
<radialGradient id="paint1_radial_1325_17657" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(40 8.60465) rotate(156.196) scale(43.7191 35.479)">
<stop stop-color="#FF075A"/>
<stop offset="1" stop-color="#FC407F" stop-opacity="0"/>
</radialGradient>
<radialGradient id="paint2_radial_1325_17657" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(-2.5133e-07 18.1395) rotate(5.4116) scale(41.9202 87.8269)">
<stop stop-color="#23C9FF"/>
<stop offset="1" stop-color="#60D4FA" stop-opacity="0"/>
</radialGradient>
</defs>
</svg>

add_button

sammycage commented 1 year ago

Hi @ifiddynine

I reviewed the attached repro case and compared the rendering in Firefox and LunaSVG. However, I'm unable to observe any noticeable differences between the two when the image is rendered.

To better assist you, could you please provide more specific details or highlight the specific bug you are experiencing?