-
Notifications
You must be signed in to change notification settings - Fork 78
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
clipPath ignored with PNG rendering #292
Comments
@replabrobin, can you confirm that ReportLab only support Path-like clip paths? Is there anything that would prevent using a circle as a clip path, like in this example image? |
Even using a path it doesn't work |
Are you really sure? It worked for me. |
I tested again and yep, I still get the image of the first post, without masks |
Maybe you have a dev version or anything? |
No, even when reverting code to 1.1.0, it still works. I have no Windows to test, but I don't see this would make a difference. |
I'll test on Linux |
The issues is still there for me on Linux |
Here are the debug logs DEBUG:svglib.svglib:Exception during applyStyleOnShape DEBUG:svglib.svglib:Exception during applyStyleOnShape DEBUG:svglib.svglib:Exception during applyStyleOnShape DEBUG:svglib.svglib:Unused attrs: path ['class'] DEBUG:svglib.svglib:Exception during applyStyleOnShape DEBUG:svglib.svglib:Exception during applyStyleOnShape DEBUG:svglib.svglib:Exception during applyStyleOnShape DEBUG:svglib.svglib:Unused attrs: path ['class'] DEBUG:svglib.svglib:Exception during applyStyleOnShape DEBUG:svglib.svglib:Exception during applyStyleOnShape DEBUG:svglib.svglib:Exception during applyStyleOnShape DEBUG:svglib.svglib:Exception during applyStyleOnShape DEBUG:svglib.svglib:Exception during applyStyleOnShape DEBUG:svglib.svglib:Exception during applyStyleOnShape DEBUG:svglib.svglib:Unused attrs: image ['__rules_applied', '{http://www.w3.org/1999/xlink}href'] DEBUG:svglib.svglib:Unused attrs: g ['__rules_applied'] DEBUG:svglib.svglib:Exception during applyStyleOnShape DEBUG:svglib.svglib:Exception during applyStyleOnShape DEBUG:svglib.svglib:Exception during applyStyleOnShape DEBUG:svglib.svglib:Exception during applyStyleOnShape DEBUG:svglib.svglib:Exception during applyStyleOnShape DEBUG:svglib.svglib:Exception during applyStyleOnShape DEBUG:svglib.svglib:Unused attrs: image ['__rules_applied', '{http://www.w3.org/1999/xlink}href'] DEBUG:svglib.svglib:Unused attrs: g ['__rules_applied'] DEBUG:PIL.PngImagePlugin:STREAM b'IHDR' 16 13 DEBUG:PIL.PngImagePlugin:STREAM b'IDAT' 41 41578 DEBUG:PIL.PngImagePlugin:STREAM b'IHDR' 16 13 DEBUG:PIL.PngImagePlugin:STREAM b'IDAT' 41 65536 |
Claude, so far as I can tell PDF supports clipping with paths and in canvas.py we use a path to create ellipse/circle So at least in principle it ought to be possible to mask using a circle. Unfortunately the canvas api doesn't make this terribly easy as the canvas circle/ellipse methods don't return the created path and don't have a render mode to allow easier specification of the rendering. On the other hand one can create the path with path.ellipse(....) and then just use canvas.clipPath on the result |
With PDF, path clips work, but circle ones don't. And for PNG both don't work. So what we need to figure out is why path clips don't work in PNG |
Ah sorry, indeed I only tested PDF rendering. I admit I don't care so much for PNG (not in my use cases). |
Thanks for this tip. I think we should able to support at least Circles with that trick. |
So, with PNG, does the issue also happen on your device? |
Hi Victor, unfortunately the renderPM/PDF/PS/SVG csnvasses sre all slightly different.from the original pdfgen/canvas.py code. The shapes.path class does allow isClipPath to be set so if png is not obeying the setting then presumably we will have to mess with the renderPM canvas/renderer classes to amke it work. |
The SVG I have
svg source
The PNG it produces
Additionnal context
OS: Windows 10 / Arch Linux (this happens on both)
svglib: 1.1.0
reportlab: 3.6.1
The text was updated successfully, but these errors were encountered: