Re: GDK-PixBuf



Andrej Prsa <andrej prsa guest arnes si> writes: 
> image = gdk_pixbuf_new_from_file ("test.jpg");
> canvas = gdk_pixmap_new (window->window, 262, 392, 8);

The "8" argument here is totally bogus, it will only work if your
display is 8-bit. If window->window existed (and it doesn't here) 
you could then pass -1 for the depth to use the one from the window.
However in this case you might do:
 gdk_pixmap_new (NULL, 262, 392, 
                 gtk_widget_get_visual (window)->depth);

> gdk_pixbuf_render_to_drawable (image, canvas, setup, 0, 0, 0, 0,
> 262, 392, GDK_RGB_DITHER_NORMAL, 0, 0);

You need to look at the "scribble" example in the GTK tutorial for how
to go about displaying the pixbuf. The tutorial is on www.gtk.org.
 
> Gdk-ERROR **: BadMatch (invalid parameter attributes)
>   serial 59 error_code 8 request_code 147 minor_code 3
> Gdk-ERROR **: BadMatch (invalid parameter attributes)
>   serial 60 error_code 8 request_code 147 minor_code 3

These are from the depth of 8.

In GTK 2, you could just do:
 image = gtk_image_new_from_file ("test.jpg");
 gtk_container_add (GTK_CONTAINER (window), image);

So look forward to that. ;-)

Havoc





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