prawn-svg
prawn-svg copied to clipboard
Wrong coordinates for radial gradients
The coordinates in radial gradients are off. As you can see by comparing the SVG and the PDF renderings (especially the gradient in the fingers) the focus of the radial gradients are not where they should be and the colors appear almost flat.
Maybe the unit scaling of the context hasn't been applied?
There is a reproducible test case + script at https://gist.github.com/gioele/9e412c1a902d67377f73cc93087cd582.
BTW, thank you for implementing radial gradients in the first place :heart:!
Hi @gioele, thanks so much for reporting and sorry it's taken a while to get to.
This has been a frustrating one to diagnose. I've narrowed it down to gradientTransform
not working properly in some specific cases, for neither linear nor radial gradients. I've got a few more paths to look down, and will keep you up to date on how I'm going.
This seems related to an issue I ran into; the gradient seems to be rendered differently based on the image's location on the page. Here's a gist of that condition: https://gist.github.com/jwright6323/666747665d920d6bc294959be24f6822
Hi @jwright6323, sorry to say that it's not related. I totally forgot about this bug, and have re-replicated it, and confirmed it has to do with thegradientTransform
not being applied correctly. Your SVG doesn't use this attribute. It might be another problem, but I did some quick tests and couldn't replicate it using SVG.
If you can supply an SVG that exhibits the problem then I'm happy to look further into it.
Thanks. I filed #153 for this separate issue, then.