Summary: | ImageMask disappears or gets wrong transform in SVG output | ||
---|---|---|---|
Product: | cairo | Reporter: | Dmitry Shubin <dshubin> |
Component: | svg backend | Assignee: | Emmanuel Pacaud <emmanuel.pacaud> |
Status: | RESOLVED MOVED | QA Contact: | cairo-bugs mailing list <cairo-bugs> |
Severity: | normal | ||
Priority: | medium | CC: | coolwanglu |
Version: | unspecified | ||
Hardware: | x86-64 (AMD64) | ||
OS: | Windows (All) | ||
Whiteboard: | |||
i915 platform: | i915 features: | ||
Attachments: |
Problem PDF file, containing an ImageMask
Result SVG, shows as blank due to misplaced mask PDF with ImageMask which displays well Possible fix or workaround, in Cairo code Result SVG created with patched code |
Created attachment 89560 [details]
Result SVG, shows as blank due to misplaced mask
Created attachment 89561 [details]
PDF with ImageMask which displays well
Created attachment 89562 [details] [review] Possible fix or workaround, in Cairo code I am not really sure if this is an actual fix, or only a hack which allows us to workaround the issue. This is also the reason why I report it to Poppler list and not Cairo. The patch shall be applied to Cairo source code, in \src directory. Tested with Cairo 1.10.2 and 1.12.14. The issue is related to the ImageMask's parent element transform. If ImageMask's parent is an image, parent transform multiplied by mask's transform produces correct coordinates. However, if the ImageMask is global, its parent is a rectangle. In this case ImageMask's transform should be written to SVG as is, without multiplication to the parent's matrix. The patch modifies the logic of saving masks from Cairo context to SVG. If mask's parent is an image, keep existing logic. If it is a rectangle, disregard parent's transformation matrix, and only use the mask's transformation matrix. Created attachment 89563 [details]
Result SVG created with patched code
Compare with the problem result img-X01122206-0001.svg to see the difference in the mask's matrix.
(In reply to comment #0) > Not reproducible with conversion to PNG, PDF or PS. If the bug only occurs in one of the cairo backends it is a cairo bug. Please note that this image mask bug is still present in Cairo 1.13.1. Dmitry's patch seems to fix it for my test cases. Any chance this patch can be integrated into the master branch for 1.13.1? *** Bug 82879 has been marked as a duplicate of this bug. *** -- GitLab Migration Automatic Message -- This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/cairo/cairo/issues/4. |
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.
Created attachment 89559 [details] Problem PDF file, containing an ImageMask ImageMask's in PDF image disappear or get misplaced after conversion to SVG. The mask is present in SVG output, but has very incorrect coordinates. Only seems to affect image masks which are global, i.e. are not attached to other subimages within PDF. Not reproducible with conversion to PNG, PDF or PS.