PocketSVG icon indicating copy to clipboard operation
PocketSVG copied to clipboard

Gradient Fill support

Open SuperWomble opened this issue 9 years ago • 2 comments

Please consider adding Gradient support to PocketSVG.

Right now, Gradients cause a crash due to expectation of fill color values instead of fill URLs.

e.g. if I create a radial Gradient in Sketch, the resulting SVG contains the following def:

 <defs>
        <radialGradient cx="50%" cy="50%" fx="50%" fy="50%" r="86.5418155%" id="radialGradient-1">
            <stop stop-color="#00FFCC" offset="0%"></stop>
            <stop stop-color="#005B38" offset="100%"></stop>
        </radialGradient>
    </defs>

The drawing path then refers to that gradient via a url on the fill attribute:

<path d="..." id="Inner-Color" fill="url(#radialGradient-1)"></path>

PocketSVG is choking on the fill's value, as it's expecting the start of a hex triplet, but is instead finding "url(..."

Assertion failure in hexTriplet::hexTriplet(NSString *__strong)(), ... PocketSVG-master/SVGEngine.mm:669

Cheers. And thanks again for all the hard work.

SuperWomble avatar Apr 03 '17 02:04 SuperWomble

This would be a large task, mainly because gradients can't be inlined into the path tag. I won't rule it out, but don't hold your breath.

fjolnir avatar Apr 03 '17 03:04 fjolnir

OK, big thanks.

SuperWomble avatar Apr 03 '17 03:04 SuperWomble