Re: gdk_pixbuf_composite() issue



Michael wrote:

I've got a pixbuf, created with gdk_pixbuf_new() (let's call it 
combined_pixbufs), with a width/height large enough to accommodate two
pixbufs side-by-side. I then have two smaller pixbufs: pixbuf_one and
pixbuf_two. I'm trying to use gdk_pixbuf_composite() to combine them
side-by-side into combined_pixbufs:

x = 0, y = 0;
gdk_pixbuf_composite(pixbuf_one, combined_pixbufs, x, y, 
pixbuf_one_width, pixbuf_one_height, 0.0, 0.0, 1.0, 1.0, 
GDK_INTERP_BILINEAR, 255);
x += pixbuf_one_width;
gdk_pixbuf_composite(pixbuf_two, combined_pixbufs, x, y, 
pixbuf_two_width, pixbuf_two_height, 0.0, 0.0, 1.0, 1.0, 
GDK_INTERP_BILINEAR, 255);

The first pixbuf shows up in combined_pixbufs perfectly. The second one
is all blurry and stretched. I can change the call with pixbuf_two to
pixbuf_one (so it copies pixbuf_one twice), and the second time it's
copied it shows up stretched and blurry, but not the first time.

Anyone know why this is, or an easier way to combine pixbufs together?

For parameters 'offset_x' and 'offset_y' you would use an offset of
the source pixbuf at the destination pixbuf('x' and 'y' in your code),
not an offset of the first rendering pixel(0.0 and 0.0):

x = 0, y = 0;
gdk_pixbuf_composite(pixbuf_one, combined_pixbufs, x, y,
pixbuf_one_width, pixbuf_one_height, x, y, 1.0, 1.0,
GDK_INTERP_BILINEAR, 255);
x += pixbuf_one_width;
gdk_pixbuf_composite(pixbuf_two, combined_pixbufs, x, y,
pixbuf_two_width, pixbuf_two_height, x, y, 1.0, 1.0,
GDK_INTERP_BILINEAR, 255);

http://library.gnome.org/devel/gdk-pixbuf/stable/gdk-pixbuf-scaling.html#gdk-pixbuf-composite

-- 
Andrey Tsyvarev
 
 Linux Verification Center, ISPRAS
 web:    http://www.linuxtesting.org
 e-mail: tsyvarev ispras ru




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]