K Dmitrij
unread,Sep 27, 2017, 9:53:24 AM9/27/17Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Sign in to report message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to fltkg...@googlegroups.com
code for debug:
[CODE=CPP]
#include <FL/Fl.H>
#include <FL/Fl_Shared_Image.H>
#include <FL/Fl_PNG_Image.H>
Fl_Shared_Image* get_icon(const char* name, int W = 0, int H = 0) {
if (!W || !H) {
//AppSettings::get_instance().get("icon_w", W, 20);
//AppSettings::get_instance().get("icon_h", H, 20);
W = H = 20;
}
Fl_Shared_Image* ret = Fl_Shared_Image::get(name, W, H);
if (!ret) {
printf("no matches for: %s(%d, %d) \n", name ,W, H);
for (int _i = 0; _i < Fl_Shared_Image::num_images(); _i++) {
if (strcmp(name, Fl_Shared_Image::images()[_i]->name()) == 0) {
printf(" but we have found: %s(%d, %d)\n",
Fl_Shared_Image::images()[_i]->name(),
Fl_Shared_Image::images()[_i]->w(),
Fl_Shared_Image::images()[_i]->h());
}
}
printf("+++++++++++++++++++++++++++++++\n");
}
return ret;
}
static unsigned char report_32x32_png[895] = /* binary data included from report_32x32.png */
{137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,32,0,0,0,32,8,6,0,0,0,
115,122,122,244,0,0,3,70,73,68,65,84,88,133,181,151,77,111,26,71,24,199,127,187,
44,176,176,100,89,219,117,141,237,38,54,196,73,165,170,47,170,122,76,62,128,
123,245,33,39,14,205,193,82,14,190,244,20,229,228,207,80,9,245,226,67,15,93,31,
28,201,113,27,165,173,191,68,15,85,171,90,113,43,161,196,169,149,23,163,184,49,
134,5,118,103,114,240,98,193,2,94,88,146,191,52,130,121,152,125,158,223,60,243,
236,12,163,16,80,165,82,185,2,220,5,210,193,223,70,209,250,250,250,111,165,82,
233,126,216,56,173,143,237,158,170,170,119,198,9,14,112,122,122,90,92,94,94,102,
119,119,247,66,8,181,143,77,23,66,48,110,179,44,75,51,77,115,115,101,101,229,
214,168,0,239,68,217,108,150,169,169,41,205,52,205,205,98,177,56,16,162,103,9,
164,148,231,223,255,58,106,162,104,177,72,0,113,61,141,105,154,36,147,73,205,
113,156,205,213,213,85,54,54,54,122,150,163,95,13,0,112,210,20,252,184,119,12,
29,64,163,200,48,46,99,53,26,168,201,20,89,11,77,10,177,89,42,149,88,91,91,235,
130,24,152,1,33,4,47,42,199,145,130,3,144,90,128,249,5,0,190,91,46,96,38,99,26,
112,123,120,0,41,113,26,181,232,0,29,18,82,118,45,237,80,0,70,92,229,171,92,6,
199,245,198,10,174,199,99,24,113,117,120,0,33,4,0,10,240,237,141,197,177,130,
183,37,165,64,12,40,165,11,223,130,65,212,239,82,3,51,16,212,73,181,202,171,163,
10,201,68,130,249,185,89,0,158,60,61,192,19,130,217,220,12,41,93,231,224,191,
67,90,173,22,51,211,211,24,198,112,59,121,207,70,36,253,130,9,182,189,199,251,
108,109,239,240,243,47,191,158,219,182,30,252,196,214,246,14,79,15,158,33,165,
100,231,225,35,182,182,119,120,252,207,191,3,253,68,206,192,132,101,177,84,40,
144,201,24,231,99,174,93,45,224,186,30,25,227,204,86,200,47,82,175,59,88,89,115,
160,159,160,148,160,161,92,46,255,0,124,51,212,211,163,107,55,159,207,127,221,
105,8,205,128,16,18,111,200,217,4,165,197,84,20,165,103,142,221,99,194,0,254,
216,47,115,240,252,85,36,128,79,151,22,88,156,155,25,15,224,243,235,121,190,184,
158,143,4,32,165,12,173,133,80,128,134,211,160,209,114,35,1,164,146,9,226,33,
167,105,40,64,249,240,5,207,35,30,74,75,31,229,152,155,158,28,13,192,243,186,
247,254,107,151,103,249,120,97,62,18,128,231,121,61,254,66,1,130,25,120,83,173,
225,52,155,145,0,50,105,29,61,145,24,13,32,72,252,186,90,227,245,73,180,99,121,
22,133,120,108,196,26,8,2,228,38,46,145,155,184,20,9,160,159,191,80,128,224,18,
252,95,173,83,107,68,91,130,172,161,147,214,147,163,1,184,110,247,43,231,10,65,
43,218,70,136,235,137,30,127,161,0,193,19,203,76,37,48,83,23,23,210,69,10,251,
79,241,222,238,5,195,74,3,176,109,187,221,87,165,148,123,97,7,72,84,73,41,247,
109,219,86,1,1,80,44,22,81,108,219,78,3,159,0,115,192,135,192,7,186,174,127,169,
40,202,164,148,82,247,159,213,57,187,172,14,155,49,1,212,0,7,64,81,20,7,56,174,
215,235,191,3,71,192,75,224,16,248,91,3,44,224,38,240,153,15,97,58,142,99,114,
150,29,29,72,116,4,86,3,253,126,129,155,254,231,100,71,223,1,114,190,255,55,126,
240,63,129,67,205,239,124,239,59,110,183,246,108,211,62,68,91,170,15,60,232,70,
229,2,199,126,224,182,28,63,27,237,172,52,59,219,91,243,93,174,52,74,186,48,118,
0,0,0,0,73,69,78,68,174,66,96,130};
// fltk-config --use-images --compile shared_images.cxx && ./shared_images
int main() {
fl_register_images();
Fl_PNG_Image image("report", report_32x32_png, sizeof(report_32x32_png)); // original image
Fl_Shared_Image *image16x16 = get_icon("report", 16, 16); // image for menu item
Fl_Shared_Image *image20x20 = get_icon("report", 20, 20); // image for panel
Fl_Shared_Image *image24x24 = get_icon("report", 24, 24); // image for panel with growed sizes
return 0;
}
[/CODE]