Re: Use a .png file
- From: Bob Caryl <bob fis-cal com>
- To: doug dooglio net
- Cc: Gtkmm-Mailinglist <gtkmm-list gnome org>
- Subject: Re: Use a .png file
- Date: Wed, 07 Dec 2005 14:21:04 -0600
It is a gnome application, so I suppose it is safe to assume that you
must install it to use it.
The reason I use this method is because I was not too impressed by the
quality of the xpm export from gimp, versus the quality of the
conversion of .png files by gnome-pixbuf-csource. I use this method for
very small icons and all the way up to larger background images. I have
been quite satisified with the results.
Bob
R. Douglas Barbieri wrote:
>On 12/7/05, Bob Caryl <bob fis-cal com> wrote:
>
>
>>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.
>>
>>
>>
>
>Wow! That is a cool solution. For me, I open up the image in gimp,
>save it out as an XPM, then include the image as source code: #include
>"image.xpm". Then I do
>
>Glib::RefPtr<Gdk::Pixbuf> image = Gdk::Pixbuf::create_from_xpm_data(
>image_xpm );
>
>So is the gdk_pixbuf_csource function more efficient than xpm
>conversion? Also, is it only in gnome?
>
>
>
>>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
>>>
>>>
>>>
>>>
>>>
>>_______________________________________________
>>gtkmm-list mailing list
>>gtkmm-list gnome org
>>http://mail.gnome.org/mailman/listinfo/gtkmm-list
>>
>>
>>
>
>
>--
>R. Douglas Barbieri
>doug dooglio net
>_______________________________________________
>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]