- From: Helmethead <hoshem mel comcen com au>
- To: Andrej Prsa <andrej prsa guest arnes si>
- Cc: gtk-list gnome org
- Subject: Re: GDK-PixBuf
- Date: Tue, 12 Jun 2001 10:50:22 +1000
On Tue, Jun 12, 2001 at 12:52:59AM +0200, Andrej Prsa wrote:
> 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);
window->window doesn't exist yet, so that might be why this is failing. You can just pass NULL for the first argument anyway.
] [Thread Prev