prawn-svg icon indicating copy to clipboard operation
prawn-svg copied to clipboard

Wrong coordinates for radial gradients

Open gioele opened this issue 4 years ago • 4 comments

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:!

gioele avatar Apr 28 '20 09:04 gioele

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.

mogest avatar Jul 04 '20 07:07 mogest

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

jwright6323 avatar Apr 06 '23 05:04 jwright6323

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.

mogest avatar Apr 08 '23 22:04 mogest

Thanks. I filed #153 for this separate issue, then.

jwright6323 avatar Apr 10 '23 15:04 jwright6323