Re: embedding images into icons while compiile time



mohan kumar wrote:
hi,

   I am using a set of png icons in my gtk
applications. I keep them in a seperate "images"
directory. whenever i run my application i need them.
   Is there a way to copy all the images into my
executable at compile time. So i need not keep the
images  when i execute my application. 

You can use the 'gdk-pixbuf-csource' program to convert .png files (and
others) into GdkPixdata structures that can sit in header files.  Using
them is just a matter of including the header, and using
gdk_pixbuf_from_pixdata()[1] to get a GdkPixbuf.

FWIW, I usually use:

gdk-pixbuf-csource --struct --raw --static --name=whatever_icon \
        whatever-icon.png > whatever-icon.h

But you can play around with that to suit your application, of course.

        -brian

[1]http://developer.gnome.org/doc/API/2.0/gdk-pixbuf/gdk-pixbuf-inline.html#gdk-pixbuf-from-pixdata



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