#include<gdk/gdkpixbuf.h>
#include<gtk/gtkmain.h>


int main(int argc, char **argv) {
 
  gtk_init(&argc, &argv);

  unsigned char *data_big = (guint8*)g_malloc(64*128*4 * sizeof(guint8));
  GdkPixbuf* big = gdk_pixbuf_new_from_data(data_big, GDK_COLORSPACE_RGB,
    TRUE /* has_alpha */,
    8 /* bits per sample */,
    64, 128 /* width and height */,
    64*4 /* rowstride */,
    0, 0 /* cleanup callback */ );

  unsigned char* data_small = (guint8*)g_malloc(64*64*4 * sizeof(guint8));
  GdkPixbuf* small = gdk_pixbuf_new_from_data(data_small, GDK_COLORSPACE_RGB,
    TRUE /* has_alpha */,
    8 /* bits per sample */,
    64, 64 /* width and height */,
    64*4 /* rowstride */,
    0, 0 /* cleanup callback */ );

  //Segfaults:
  gdk_pixbuf_composite(small, big, 
    0, 64 /* dest_x and dest_y */,
    64, 64 /* dest_width and dest_height */,
    0, 0 /* offset_x, offset_y */,
    1, 1 /* scale_x, scale_y */,
    GDK_INTERP_NEAREST /* interp_type */,
    255 /* overall_alpha */ );

  return 0;
}
