[cairo] Problem drawing pixbuf
Tobias Hoffmann
lcairo-list at thax.hardliners.org
Sat Oct 9 13:20:22 PDT 2010
Hi,
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->save();
cr->translate(5,5); // just to show the borders are there also on the
left and top.
Gdk::Cairo::set_source_pixbuf(cr,data[imgid],0,0);
// cr->push_group();
cr->paint();
// cr->pop_group_to_source();
// cr->paint();
cr->restore();
This leads to a black border around the image, as can be seen in
http://thax.hardliners.org/test/pic1.png
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?
Regards
Tobias
More information about the cairo
mailing list