swhitty / SwiftDraw

Swift library and command line tool to convert SVGs into SFSymbol, PNG, PDF and Swift source code.
zlib License
326 stars 41 forks source link

Some RadialGradient is not drawn #10

Closed 2n closed 1 year ago

2n commented 1 year ago

Sorry to bother you again.

It seems to be drawn when both stop-color and stop-opacity are inside the <stop> tag, but not when only stop-opacity is present.

The following RadialGradient is drawn,

<radialGradient id="paint6_radial_31_1432" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(20.5 18) rotate(9.86581) scale(11.6726)">
<stop stop-color="#FFA64B"/>
<stop offset="0.900412" stop-color="#FFAE46" stop-opacity="0"/>
</radialGradient>

but the following is not drawn.

<radialGradient id="paint7_radial_31_1432" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(17.5 15) rotate(43.9708) scale(59.0529)">
<stop offset="0.185425" stop-opacity="0"/>
<stop offset="1" stop-opacity="0.4"/>
</radialGradient>

I noticed this because angry_face_color.svg had subtle differences from the originals, even though they did not contain unsupported tags.

This is based on my poor research and I apologize if I am wrong.

swhitty commented 1 year ago

Good pickup, SwiftDraw was incorrectly defaulting to currentColor when a stop-color was not defined causing the gradients to not be rendered.

This has been fixed in 0.11.1

2n commented 1 year ago

Thanks for the quick bug fix. Now it draws very precisely. Awesome!