sprite map issues using gdk_pixbuf_composite()



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?

Also, I don't actually need to do any scaling, but I cannot currently
find another way to chop sprites out of a sprite map except using the
gdk_pixbuf_composite function.  Is there a better way?

Thanks,

-- 
Greg Donald


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