Re: Display XPM Content



On Monday 22 August 2005 10:18, 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 ?


char *bitmap[]= {
"16 16 3 1",
"       c #FFFFFF",
".      c #FF0000",
"+      c #000000",
"       .........",
"       .........",
"       ..    +..",
"       ..   + ..",
"       ..  +  ..",
"       .. +   ..",
"       ..+    ..",
".........    +..",
".........   + ..",
"..    +    +  ..",
"..   +    +   ..",
"..  +    +    ..",
".. +    +    +..",
"..+    +    + ..",
"................",
"................"};

GdkPixbuf* pixbuf = gdk_pixbuf_new_from_xpm_data(bitmap);
 ... do stuff ...
g_object_ref(G_OBJECT(pixbuf));

You will also need to make bitmap a const char*[] type.

Chris



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