Bug 14100

Summary: problem with postscript patterns
Product: cairo Reporter: Charles Doutriaux <doutriaux1>
Component: postscript backendAssignee: Carl Worth <cworth>
Status: RESOLVED FIXED QA Contact: cairo-bugs mailing list <cairo-bugs>
Severity: blocker    
Priority: high CC: ajohnson
Version: 1.4.14   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: Working test case, no patterns
Broken example, now we have a pattern and it does not fit on page anymore

Description Charles Doutriaux 2008-01-16 10:50:11 UTC
Created attachment 13754 [details]
Working test case, no patterns

Consider the attached 2 examples, the only difference in the second one is that I'm using a pattern, I guess this forces it to switch to "image" mode.
In the second case the rectangle is completely out of the page. It looks like it did not understand the rotation?
Comment 1 Charles Doutriaux 2008-01-16 10:51:27 UTC
Created attachment 13755 [details]
Broken example, now we have a pattern and it does not fit on page anymore
Comment 2 Charles Doutriaux 2008-01-16 12:00:46 UTC
This works under 1.5.6
Comment 3 Adrian Johnson 2008-01-17 05:55:20 UTC
Cairo 1.4.10 had full page fallbacks. If anything was drawn on the page that is not supported by the PostScipt backend it generated a full page fallback image.

In your second example you create a pattern from an ARGB32 image. As PostScript does not support transparency it assumes that the ARGB32 image contains transparency and creates a fallback image. If you change the ARGB32 to RGB24 you will not get the fallback image.

Cairo 1.5.6 has finer-grained fallbacks. It will only use fallback images for the unsupported regions of the page. In addition it makes some attempt to flatten transparency. When it sees the ARGB32 image it will check if you are actually using transparency in the image before deciding it is unsupported. In addition it will also check if anything is already drawn underneath the image. If nothing is underneath it will blend the color in with white to remove the transparency.

In cairo 1.5.6 the PDF and PostScript backends now support cairo_push_group() and cairo_surface_create_similar() so you could create your pattern without using an image surface. This will create the pattern with PostScript drawing commands instead of embedding a little image.

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.