Urgent: getting GdkPixBuf out of the image obtained from gtk_image_new_from_file()



Hi,
   I am new to programming with GTK+ and I need to get some extra information to fill in the gap about the tutorial on GDK and GTK.
 
I am writing a program with zooming capability and need to draw a box "like" selection region (like the one in XV) that can be dragged when the cursor moves. I hope someone can answer my following questions:
 
1)As for the zooming, I tried gdk_pixbuf_scale() to do the scaling but I kept getting segmentation fault when running it.
I tried to figure out what's wrong. I found that as soon as I load the pixbuf from a file, I got this error message. I declared the pixbuf using GdKpixBuf *pixbuf, then load the image file using
pixbuf=gdk_pixbuf_new_from_file(filename);
I didn't do anything else in the program just to test but I always get segmentation fault. Has anyone come across the same problem and figured out the solution?
 
2) As an alternative, I manage to read image successfully with
GtkWidget *image;
image=gtk_image_new_from_file(filename).
I was trying to get the pixbuf from this image but the data structures seem to be different.
gtk_image_new_from_file returns a GtkWidget. The function
gtk_image_get_pixbuf() requires a GtkImage structure as the argument. Can anyone tell me how to get the pixbuf from a file through
gtk_image_new_from_file()?
 
your reply will be greatly appreaciated.
 
Thanks
 
John



Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!

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