Re: Use a .png file



Your original question was:

"How can I include a .png or .bmp image in my source code?"

All the answers I have seen so far show you how to display an image from a file at run time.  None of these show how to include the image in your source code.

The following code displays an image that is compiled as data into the executable itself:

Glib::RefPtr<Gdk::Pixbuf> fis_icon = Gdk::Pixbuf::create_from_inline(-1,fisicon_inline,FALSE);

fis_icon is a data structure that is produced by a gnome command line utility called "gdk_pixbuf_csource."  You can use the "man" command to find out about the calling syntax and output options for this utility.  Then you merely take the file it produces and include it in your source code and the image data is compiled into your application.


Bob

Kathrin Hauptvogel wrote:

>Good morning
>
>How can I include a .png or .bmp image in my source code?
>
>#include <gtkmm.h>
>using namespace Gtk;
>
>int main(int argc, char *argv[])
>{
>  Main kit(argc, argv);
>
>  Window window;
>  Main::run(window);
>  
>  return 0;
>}
>
>
>Kathrin Hauptvogel
>
>_______________________________________________
>gtkmm-list mailing list
>gtkmm-list gnome org
>http://mail.gnome.org/mailman/listinfo/gtkmm-list
>
>  
>



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