Re: gtkmm-list Digest, Vol 126, Issue 12



Export from gimp as an .xpm file, and examine the result in a text editor -- it's c/c++ compatible. #include the file in your source code, and use Glib::RefPtr<Gdk::Pixbuf>create_from_xpm_data() to generate your pixbuf.

On 10/18/2014 05:00 AM, gtkmm-list-request gnome org wrote:
Send gtkmm-list mailing list submissions to
        gtkmm-list gnome org

To subscribe or unsubscribe via the World Wide Web, visit
        https://mail.gnome.org/mailman/listinfo/gtkmm-list
or, via email, send a message with subject or body 'help' to
        gtkmm-list-request gnome org

You can reach the person managing the list at
        gtkmm-list-owner gnome org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of gtkmm-list digest..."


Today's Topics:

    1. Encode image in the file? (Philippe Coatmeur)
    2. Re: Encode image in the file? (Hubert Figui?re)


----------------------------------------------------------------------

Message: 1
Date: Fri, 17 Oct 2014 18:11:03 +0100
From: Philippe Coatmeur <philcm gnu org>
To: gtkmm-list gnome org
Subject: Encode image in the file?
Message-ID: <54414DA7 5070301 gnu org>
Content-Type: text/plain; charset="utf-8"; Format="flowed"

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?

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

Cheers -Phil


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