simple example of using gdk_pixbuf_new_from_file



---------- Forwarded message ----------
From: Dehua Zhao <dzhao cs uno edu>
Date: May 9, 2005 7:32 PM
Subject: simple example of using gdk_pixbuf_new_from_file
To: gtk-app-devel-list gnome org

simple example of gdk_pixbuf
#include<gtk/gtk.h>
#include<gdk-pixbuf/gdk-pixbuf.h>
#include <stdlib.h>
#include<string.h>
#include<stdio.h>

#include<string.h>

int main(int argc, char *argv[])
{
GError *gerror;
GdkPixbuf *originalpb, *pb;
GdkPixbuf *rpb, *ipb;
char filename[20];

gtk_set_locale ();
gtk_init (&argc, &argv);

strcpy(filename, argv[1]);

originalpb = NULL;

originalpb=gdk_pixbuf_new_from_file(inputimg,&gerror);
if(!originalpb) {
printf("error message: %s\n", gerror->message);
exit(1);
}
....

hei = gdk_pixbuf_get_height(originalpb)/downsampling;
wid = gdk_pixbuf_get_width(originalpb)/downsampling;
gdk_pixbuf_unref(originalpb);

....
return 0;
}

I got these errors after compiling it

pix-samp.c: In function `main':
pix-samp.c:43: error: `inputimg' undeclared (first use in this function)
pix-samp.c:43: error: (Each undeclared identifier is reported only once
pix-samp.c:43: error: for each function it appears in.)
pix-samp.c:48: error: syntax error before '...' token
pix-samp.c:51: error: `downsampling' undeclared (first use in this function)

and if i remove the downsampling and change inputimg to filename
it compiles but gives Segmentation Fault at runtime

can anyone help me out
Reply.
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list



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