Re: sprite map issues using gdk_pixbuf_composite()



On Wed, Oct 29, 2014 at 09:11:07PM -0500, Greg Donald wrote:
I'm having problems trying to chop sprites out of a sprite map.  I can
get my first sprite from the top left corner with this:

gdk_pixbuf_composite( sprite_src, sprite_buf,
                      0, 0, sprite_w, sprite_h,
                      0.0, 0.0, 1.0, 1.0,
                      GDK_INTERP_HYPER,
                      255 );

But then I cannot get my second sprite that is just to the right of
the first one:

gdk_pixbuf_composite( sprite_src, sprite_buf2,
                      sprite_w, 0, sprite_w * 2, sprite_h,
                      0.0, 0.0, 1.0, 1.0,
                      GDK_INTERP_HYPER,
                      255 );

The first one looks great but I get a black rectangle and a failed
assertion on the second one:

GdkPixbuf-CRITICAL **: gdk_pixbuf_composite: assertion 'dest_x >= 0 &&
dest_x + dest_width <= dest->width' failed

I have tried everything I can think of.  Any idea what I'm doing wrong?

You must change offset in the source, not position in the destination.

Yeti



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