On 17/10/14 01:11 PM, Philippe Coatmeur wrote:
> Hi everyone
> 
> I have this UI that displays an image using
> 
> |add(*manage(new  Gtk::Image("image.png")));|
> 
> But the app pulls it from the hard drive at each lauch, and if it's not
> there it's broken, etc.
> 
> I tried that:
> 
> 
>     Glib::RefPtr<Gdk::Pixbuf> pic =
> Gdk::Pixbuf::create_from_file("image.png");
>     Gtk::Image* img = Gtk::manage(new Gtk::Image(pic));
>     add(*img);
> 
> But it's even worse, if the image is missing at run time, it coredumps ;
> How can I encode image.png so that I can ship it in the code, so the app
> dont't have to find/read an image file?

Is "image.png" in the current working directory? That's what you are
trying to open.
Ideally you'd use an absolute file path based on the install path of the
file.


> In GIMP I can save an image as "C source code" or "C header file" but
> not C++... I tried too.

This should work too. What's the problem?


Hub

_______________________________________________
gtkmm-list mailing list
gtkmm-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtkmm-list

Reply via email to