Re: Display XPM Content



On Mon, 22 Aug 2005, Guenther Sohler wrote:
I have created some symbols for my program. Now I want to compile them into the code.
But I am now looking for the right function to create a GtkPixBuf from it.
Previously i used gdk_pixbuf_new_from_file
How can I get the same from following data ? Gimp has created this for me.
Is gdk_pixmap_colormap_create_from_xpm_d the correct function ? if yes, how can i use it ?

One thing you can do instead of including the .xpm source is to use the gdk-pixbuf-csource program (it should be included with gtk) to convert your .xpm file to a GdkPixdata structure, then use the gdk_pixbuf_from_pixdata function to create a GdkPixbuf object from the GdkPixdata.

On the command line:
gdk-pixbuf-csource --struct --name=my_name image.xpm > image.c

Then in your C source:
pixbuf = gdk_pixbuf_from_pixdata (&my_name, TRUE, 0);

For more info:
http://developer.gnome.org/doc/API/2.0/gdk-pixbuf/gdk-pixbuf-inline.html

HTH
JV



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