-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
stop-opacity on linearGradient stops are not rendered #37
Comments
@iocoker Thats a difficult issue. PDF does not support opacity gradients. At least not in PDF 1.7 (no idea about PDF 2.0; Did not yet pay for the spec... but likely not). So this can only be faked somehow. Some common way to fake it, is to just rasterize the gradient as image. But this increases the file size a lot and also looks bad depending on the resolution used to rasterize the gradient... Maybe it is possible to somehow implement that using soft masks. I'll have to investigate that. |
@rototor , thanks for the reply. The SVG is actually drawn into this sample and Acrobat reports its version as 1.7. |
@iocoker I see, yes that is possible with PDF 1.7. In this example it uses a SMASK for the gradient masking. I "just" need to replicate that. |
And refactored the appling of the first color a bit.
as mask for the GradientPaint. This seems to work and look fine.
But this is currently way of. There has to be put some transform on it - or the "pattern" trick must be used as seen in the tfpdf example.
Our small testcase works find, tux misses still some gradients and some other svg causes crashes. Also the code still needs to be cleaned up...
of the gradient is not going to cause any issues... Added a colored version of tux to better see which gradient is not working.
not working gradient. Some stuff with the matrix seens to be wrong.
SVG files with
stop-opacity
inside a stop are not rendering correctly. EG:<linearGradient> <stop stop-color="#3f2600" stop-opacity="0.6" offset="0" /> <stop stop-color="#3f2600" stop-opacity="0" offset="1" /> </linearGradient>
Will render a uniform opacity of 0.6
So, something like the Tux SVG above renders like this:
![Screenshot 2022-05-01 134104](https://user-images.githubusercontent.com/81635623/166144255-6932fa71-4274-40c5-8d98-b28532ec0e68.png)
The text was updated successfully, but these errors were encountered: