Re: embedding images into icons while compiile time

mohan kumar wrote:

   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.



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