Great, I'm glad I could help.
No apologies needed, all new users are welcome, and guiding to the
right group is no issue.
BTW, meanwhile we opened GitHub Discussions (Q&A) for such user
questions which will likely be our main "Q&A Forum" in the
future. Feel free to ask there as well...
Anyway, since I created an example, I'm going to post it here just
in case other readers need one. Note that I'm leaving the conversion
from an image file to binary data as an exercise to the user.
Here is a working example that's using the "manual" approach.
image.cxx:
#include <FL/Fl.H>
#include <FL/Fl_Double_Window.H>
#include <FL/Fl_Box.H>
#include <FL/Fl_PNG_Image.H>
#include "clock.cxx" // binary image data
int main(int argc, char **argv) {
auto window = new Fl_Double_Window(300, 300);
auto box = new Fl_Box(20, 20, 260, 260);
auto img = new Fl_PNG_Image(nullptr, clock_png, clock_png_len);
if (img && !img->fail())
box->image(img);
else
box->label("no image");
window->end();
window->show(argc, argv);
return Fl::run();
}
clock.cxx (created from 'clock.png' by `xxd -i clock.png`):
unsigned char clock_png[] = {
0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d,
0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, 0x64,
// ... more data ...
0xb4, 0x44, 0xd2, 0xe8, 0x85, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e,
0x44, 0xae, 0x42, 0x60, 0x82
};
unsigned int clock_png_len = 3233;
Compile with
fltk-config --use-images --compile
image.cxx
This works because `clock.cxx` is included by `image.cxx` (a quick
hack).