Re: drawing image from a buffer using gdk_draw_image



"Tara M" <learfox furry ao net> writes:  
 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);

You aren't supposed to assign to the img struct, you are supposed to
read those values and then write to img->mem in accordance with what
is in the struct. This involves special-casing every possible depth,
byte order, bpp, bpl, etc. It is a total nightmare. ;-) 

GdkImage is a low-level interface for people who need direct access to
the hardware pixel data representation. 
 
If its all possible youmight want to look at using GTK+ RGB
buffers instead, they accomplish the same thing and are easier to
use and problem free.

http://developer.gnome.org/doc/GGAD/z132.html#SEC-GDKRGB

Yes, this is highly recommended.

Havoc




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