[cairo] Problem drawing pixbuf

Tobias Hoffmann lcairo-list at thax.hardliners.org
Sat Oct 9 13:20:22 PDT 2010


I use cairo(mm) with a Gtk::DrawingArea. There I display a simple image
(e.g. just white), loaded into a Gdk::Pixbuf, using essentially the
following code:

... Cairo::RefPtr<Cairo::Context>  cr   ... scaled to window size ...
paint background gray ...
cr->translate(5,5); // just to show the borders are there also on the
left and top.
// cr->push_group();
// cr->pop_group_to_source();
// cr->paint();

This leads to a black border around the image, as can be seen in
The expected behavior would be http://thax.hardliners.org/test/pic2.png
, as can be obtained by adding the commented-out sections above.
But this workaround becomes really slow for bigger window-sizes.

I've tried different antialias-modes and operator-modes with no success.
It also seems to not be possible to set the background color of the
source. Even using a clipping path does not really work without cutting
away "too much". Setting EXTEND_PAD is problematic for images that have
some content that touches the border.

FYI, I've used debian's libcairo2 1.8.8-2 and now 1.8.10-6 -- the newest 
available (gtk+, et al. are also up-to-date); the problem does not exist 
in a windows-version under wine with cairo 1.9.14, though. I've heard, 
that it also works correctly with OS X (X backend, unknown cairo version).

Any hints?


More information about the cairo mailing list