GDK-PixBuf
- From: Andrej Prsa <andrej prsa guest arnes si>
- To: gtk-list gnome org
- Subject: GDK-PixBuf
- Date: Tue, 12 Jun 2001 00:52:59 +0200
Hello!
I'm going nuts with GDK-Pixbuf... I searched all over the net for a small example but failed to find it. The examples I did find utilize gnome.h, which I try to avoid.
Here's my problem: I have to put simple jpg or gif graphics (with known dimensions, bits, ...) to screen. I tried to do it like this:
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "gtk/gtk.h"
#include "gdk-pixbuf/gdk-pixbuf.h"
int main (int argc, char *argv[])
{
GtkWidget *window;
GdkPixbuf *image;
GdkPixmap *canvas;
GdkGC *setup;
gtk_init (&argc, &argv);
gtk_widget_push_visual (gdk_rgb_get_visual ());
gtk_widget_push_colormap (gdk_rgb_get_cmap());
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_signal_connect (GTK_OBJECT (window), "destroy", GTK_SIGNAL_FUNC (gtk_main_quit), "WM destroy");
gtk_widget_set_usize (window, 600, 600);
gtk_widget_pop_visual ();
gtk_widget_pop_colormap ();
image = gdk_pixbuf_new_from_file ("test.jpg");
canvas = gdk_pixmap_new (window->window, 262, 392, 8);
setup = gdk_gc_new (canvas);
gdk_pixbuf_render_to_drawable (image, canvas, setup, 0, 0, 0, 0, 262, 392, GDK_RGB_DITHER_NORMAL, 0, 0);
gtk_widget_show_all (window);
gtk_main();
return (0);
}
It compiles without problem, but, however, it crashes with:
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
I'm really clueless... Any ideas?
Andrej
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]