drawing image from a buffer using gdk_draw_image



Hi,

I have been trying to draw an image (16-bit color) to a 16-bit color system, using a call like this:

GdkImage *img = gdk_image_new (GDK_IMAGE_FASTEST, gdk_visual_get_system (), 640, 482);

img->depth = 16;
img->byte_order = GDK_MSB_FIRST;
img->bpp = 2;
img->bpl = 640*2;
img->mem = buf;   /* buf is the pointer to the 16-bit colored data */

gdk_draw_image (some_d_area, gc, img, 0, 0, 0, 0, 640, 482);

however i got a black image. The drawing area is created using gtk_drawing_area_new().

Do I have to do something extra before I call gdk_draw_image(). I tried to look into gdkrgb and see how it calls gdk_draw_image for 24/32 bit color image, but it is too complicate for me right now, and I don't have a good understanding of gdk_visual and gdk_colormap yet.

Regards,
Patrick





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