I'm drawing an image onto a surface (via pattern). The image should be scaled up by a large value. When the pattern has a filter value other than CAIRO_FILTER_FAST the image will not come out as expected. If the target surface has an alpha channel edge pixels will be transparent, if not they will be black. They seem to be interpolated with an imaginary black pixel outside the image border. To make the image look good, the imaginary pixel should have the same color as the original edge pixel. Is there a workaround? I've seen people use CAIRO_EXTEND_REFLECT and clipping but as we know from another lengthy discussion elsewhere :-) EXTEND_REFLECT is broken in 1.2.
Created attachment 8798 [details] test code test code drawing an image onto another image using large scaling values
Created attachment 8799 [details] resulting image when running test code
What you want is exactly what CAIRO_EXTEND_PAD does. We've discussed about making that the default, but that is considered API change and was avoided. Maybe we should add a bit more documentation? Tell us about your documentation use. Did you see CAIRO_EXTEND_PAD and ignored it?
For documentation I use the API reference manual and the sample snippets because I never know what to look for in the guides and tutorials. I've seen EXTEND_PAD but my cairo.h says that it's not implemented for surface patterns so I didn't bother trying. I've added it now to my test code anyway and I'm getting a completely black image as if nothing is painted at all.
Right... I'm working on fixing this, with no luck so far. What I did fix however is CAIRO_EXTEND_REFLECT for surface patterns. That will be in 1.4. With that, you can get the effect you want by using REFLECT and cliping.
Actually fixed in pixman awhile ago.
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.