-
Notifications
You must be signed in to change notification settings - Fork 501
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Linear gradient svg is not rendered #1561
Comments
I am not sure how to test it against prawn-svg itself, so just wanted to confirm that it has nothing to do with asciidoctor-pdf and I should create issue upstream. |
All handling of the SVG itself is delegated to prawn-svg, so yes, it's an upstream issue. However, we could start adding tests for specific SVG features like this one so that we can detect regressions. |
The problem you're facing is mentioned in the fix for the resolved issue as a limitation in prawn-svg:
In your example, the stop-color is the same for both stops, but the opacity is different. So the linear gradient will appear as a solid color. If you replace the stop-opacity=0 with the color white, it will work. I've added a test to the test suite to verify that the linear gradient works with opaque colors. |
Although the issue is closed, the lack of support for stop-opacity still remains in prawn-svg. I recommend reporting the issue upstream. Then I'll update the test accordingly. |
Not sure if I got you right. I have tried to change colors to black(first stop) and white (second stop) -- the same result (no gradient, no solid color for the bigger rect)
then I made Well, anyway I will just avoid using gradients in svg (it was logo of our customer with fancy gradients -- I can use png instead) |
There's a secondary problem in the SVG that you provided which I forgot to
mention. When you run the current SVG, there's a warning about missing
stops in the console. The gradient references another gradient with the
stops. If you combine them into a single element, the gradient will work
(as long as you don't use opacity).
So gradients do work, but they need to be:
a) defined using a single element
b) cannot use stop-opacity
So you just have to play with the SVG a bit.
|
Oh, thx for clarifications, will try to play with it a bit. |
I know there was issue resolved upstream: mogest/prawn-svg#62
But it looks like it doesn't work for a simple svg with a single linear gradient (created in inkscape):
It is rendered as:
Prawn gems:
ps, svg file:
box-gradient.svg
The text was updated successfully, but these errors were encountered: