Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

If I save a file as a C program in GIMP, how can I display it from a C program?

I noticed you could save an image as a C program or C header file with GIIMP. But I don't know how to display the image from a C program. Can I just pipe it into a widget that is out there or do I have to write my own?

Update:

I noticed you could save an image as a C program or C header file with GIMP. But I don't know how to display the image from a C program. Can I just pipe it into a widget that is out there or do I have to write my own? I am using gcc and gtk 2.0.

2 Answers

Relevance
  • 1 decade ago
    Favorite Answer

    You will need a C compiler, Oh gosh, I have one right here!

    http://www.compilers.net/Dir/Free/Compilers/CCpp.h...

  • 1 decade ago

    I didn't know that GIMP could do that, cool.

    From looking at the code GIMP generates it looks like you get a huge array of RGB values. One byte each for Red, Green, and Blue. (You can save the alpha too it looks like, and that would be similar, just 4 bytes instead of three.)

    I can't answer your question directly, as I'm not familiar enough with gtk, but you need to look for a bitmap class that takes raw data in its constructor. It should be simple enough, as bitmaps are pretty much exactly that, an array of RGB values. After you get the bitmap object you can use it with any of the widgets normally. I would not think you would need to make your own widget, but you may need to change the format of your byte array to match what the bitmap constructor is expecting.

Still have questions? Get your answers by asking now.