|
View:
New views
2 Messages
—
Rating Filter:
Alert me
|
|
|
what is the icon format I should use for table->setItemIconHello all, I need to display an icon image on the cell of a table. However, the displayed image is always empty. I find the reason is that the created char arrays are different. For example: extern const unsigned char penguin[]={ 0x42,0x4d,0xe2,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x52,0x00,0x00,0x00,0x28,0x00, 0x00,0x00,0x10,0x00,0x00,0x00,0x12,0x00,0x00,0x00,0x01,0x00,0x04,0x00,0x00,0x00, 0x00,0x00,0x90,0x00,0x00,0x00,0x6d,0x0b,0x00,0x00,0x6d,0x0b,0x00,0x00,0x07,0x00, 0x00,0x00,0x07,0x00,0x00,0x00,0xdc,0xc0,0xb2,0x00,0x80,0x80,0x80,0x00,0x00,0x00, 0x00,0x00,0xc0,0xc0,0xc0,0x00,0x10,0x10,0x10,0x00,0xff,0xff,0xff,0x00,0x08,0xa0, 0xe0,0x00,0x00,0x66,0x61,0x22,0x22,0x21,0x66,0x00,0x06,0x66,0x66,0x55,0x22,0x26, 0x66,0x60,0x66,0x66,0x65,0x55,0x55,0x26,0x66,0x66,0x66,0x66,0x65,0x55,0x55,0x36, 0x66,0x66,0x06,0x66,0x55,0x55,0x55,0x56,0x22,0x60,0x00,0x63,0x55,0x35,0x55,0x55, 0x22,0x20,0x00,0x23,0x55,0x35,0x55,0x55,0x22,0x20,0x00,0x02,0x55,0x33,0x55,0x55, 0x22,0x10,0x00,0x02,0x55,0x53,0x55,0x55,0x22,0x00,0x00,0x01,0x25,0x55,0x55,0x51, 0x21,0x00,0x00,0x00,0x21,0x55,0x55,0x52,0x10,0x00,0x00,0x00,0x02,0x66,0x55,0x22, 0x00,0x00,0x00,0x00,0x02,0x66,0x63,0x21,0x00,0x00,0x00,0x00,0x02,0x66,0x63,0x20, 0x00,0x00,0x00,0x00,0x02,0x42,0x25,0x20,0x00,0x00,0x00,0x00,0x02,0x32,0x32,0x20, 0x00,0x00,0x00,0x00,0x01,0x22,0x22,0x10,0x00,0x00,0x00,0x00,0x00,0x12,0x21,0x00, 0x00,0x00 }; From the table example with Fox Toolkit. /* created by reswrap from file aaa.gif */ <= I created const unsigned char aaa[]={ 0x47,0x49,0x46,0x38,0x39,0x61,0x12,0x00,0x12,0x00,0x11,0x00,0x00,0x21,0xf9,0x04, 0x01,0x00,0x00,0x02,0x00,0x2c,0x00,0x00,0x00,0x00,0x12,0x00,0x12,0x00,0x81,0x00, 0x00,0x00,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x23,0x94,0x8f,0xa9, 0xcb,0x08,0x0f,0x9b,0x88,0x87,0x2a,0x20,0x17,0x9e,0xf0,0xb5,0x9d,0x78,0xda,0x37, 0x32,0x60,0x68,0x92,0xe1,0x79,0x81,0x62,0xd6,0x65,0xf2,0x4c,0xd7,0xb6,0x5d,0x00, 0x00,0x3b }; /* created by reswrap from file aaa2.gif */ <= I created const unsigned char aaa2[]={ 0x47,0x49,0x46,0x38,0x39,0x61,0x12,0x00,0x12,0x00,0x22,0x00,0x00,0x21,0xf9,0x04, 0x01,0x00,0x00,0x05,0x00,0x2c,0x00,0x00,0x00,0x00,0x12,0x00,0x12,0x00,0x82,0x00, 0x00,0x00,0xff,0x00,0x00,0x80,0x80,0x80,0xff,0xff,0xff,0x00,0xff,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x43,0x58,0xba,0xdc,0x2d,0xc2,0x39,0xb2, 0x62,0x09,0x38,0x48,0xaa,0xec,0xca,0xda,0xc2,0x79,0x4e,0xa6,0x8c,0xcb,0x30,0x94, 0x67,0xc7,0xa8,0x4d,0x88,0xbe,0x2c,0x45,0x16,0x70,0x4c,0xd8,0xcd,0x1a,0x07,0xb3, 0x54,0xad,0x43,0xf2,0x31,0x34,0x9c,0x82,0x07,0x16,0x52,0x34,0x89,0x11,0x9f,0xe9, 0xe9,0x30,0x5e,0x30,0x92,0x54,0x2e,0xcb,0xed,0x7a,0x1d,0x09,0x00,0x3b }; Now, the question is what the format of the image the cell of table support? 1> the size of the image 16x16? 18x18? 2> the color level of the image 2 colors, 16 colors, 256 colors? 3> convert the icon to array reswrap.exe -o aa.txt aa.gif is this correct? Thank you ------------------------------------------------------------------------------ Are you an open source citizen? Join us for the Open Source Bridge conference! Portland, OR, June 17-19. Two days of sessions, one day of unconference: $250. Need another reason to go? 24-hour hacker lounge. Register today! http://ad.doubleclick.net/clk;215844324;13503038;v?http://opensourcebridge.org _______________________________________________ Foxgui-users mailing list Foxgui-users@... https://lists.sourceforge.net/lists/listinfo/foxgui-users |
|
|
Re: what is the icon format I should use for table->setItemIconOn Monday 22 June 2009, Feng Feng wrote:
> Hello all, > > I need to display an icon image on the cell of a table. > However, the displayed image is always empty. I find the reason is that the created char arrays are different. > > For example: > extern const unsigned char penguin[]={ > 0x42,0x4d,0xe2,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x52,0x00,0x00,0x00,0x28,0x00, > 0x00,0x00,0x10,0x00,0x00,0x00,0x12,0x00,0x00,0x00,0x01,0x00,0x04,0x00,0x00,0x00, > 0x00,0x00,0x90,0x00,0x00,0x00,0x6d,0x0b,0x00,0x00,0x6d,0x0b,0x00,0x00,0x07,0x00, > 0x00,0x00,0x07,0x00,0x00,0x00,0xdc,0xc0,0xb2,0x00,0x80,0x80,0x80,0x00,0x00,0x00, > 0x00,0x00,0xc0,0xc0,0xc0,0x00,0x10,0x10,0x10,0x00,0xff,0xff,0xff,0x00,0x08,0xa0, > 0xe0,0x00,0x00,0x66,0x61,0x22,0x22,0x21,0x66,0x00,0x06,0x66,0x66,0x55,0x22,0x26, > 0x66,0x60,0x66,0x66,0x65,0x55,0x55,0x26,0x66,0x66,0x66,0x66,0x65,0x55,0x55,0x36, > 0x66,0x66,0x06,0x66,0x55,0x55,0x55,0x56,0x22,0x60,0x00,0x63,0x55,0x35,0x55,0x55, > 0x22,0x20,0x00,0x23,0x55,0x35,0x55,0x55,0x22,0x20,0x00,0x02,0x55,0x33,0x55,0x55, > 0x22,0x10,0x00,0x02,0x55,0x53,0x55,0x55,0x22,0x00,0x00,0x01,0x25,0x55,0x55,0x51, > 0x21,0x00,0x00,0x00,0x21,0x55,0x55,0x52,0x10,0x00,0x00,0x00,0x02,0x66,0x55,0x22, > 0x00,0x00,0x00,0x00,0x02,0x66,0x63,0x21,0x00,0x00,0x00,0x00,0x02,0x66,0x63,0x20, > 0x00,0x00,0x00,0x00,0x02,0x42,0x25,0x20,0x00,0x00,0x00,0x00,0x02,0x32,0x32,0x20, > 0x00,0x00,0x00,0x00,0x01,0x22,0x22,0x10,0x00,0x00,0x00,0x00,0x00,0x12,0x21,0x00, > 0x00,0x00 > }; > >From the table example with Fox Toolkit. > > /* created by reswrap from file aaa.gif */ <= I created > const unsigned char aaa[]={ > 0x47,0x49,0x46,0x38,0x39,0x61,0x12,0x00,0x12,0x00,0x11,0x00,0x00,0x21,0xf9,0x04, > 0x01,0x00,0x00,0x02,0x00,0x2c,0x00,0x00,0x00,0x00,0x12,0x00,0x12,0x00,0x81,0x00, > 0x00,0x00,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x23,0x94,0x8f,0xa9, > 0xcb,0x08,0x0f,0x9b,0x88,0x87,0x2a,0x20,0x17,0x9e,0xf0,0xb5,0x9d,0x78,0xda,0x37, > 0x32,0x60,0x68,0x92,0xe1,0x79,0x81,0x62,0xd6,0x65,0xf2,0x4c,0xd7,0xb6,0x5d,0x00, > 0x00,0x3b > }; > > > /* created by reswrap from file aaa2.gif */ <= I created > const unsigned char aaa2[]={ > 0x47,0x49,0x46,0x38,0x39,0x61,0x12,0x00,0x12,0x00,0x22,0x00,0x00,0x21,0xf9,0x04, > 0x01,0x00,0x00,0x05,0x00,0x2c,0x00,0x00,0x00,0x00,0x12,0x00,0x12,0x00,0x82,0x00, > 0x00,0x00,0xff,0x00,0x00,0x80,0x80,0x80,0xff,0xff,0xff,0x00,0xff,0x00,0x00,0x00, > 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x43,0x58,0xba,0xdc,0x2d,0xc2,0x39,0xb2, > 0x62,0x09,0x38,0x48,0xaa,0xec,0xca,0xda,0xc2,0x79,0x4e,0xa6,0x8c,0xcb,0x30,0x94, > 0x67,0xc7,0xa8,0x4d,0x88,0xbe,0x2c,0x45,0x16,0x70,0x4c,0xd8,0xcd,0x1a,0x07,0xb3, > 0x54,0xad,0x43,0xf2,0x31,0x34,0x9c,0x82,0x07,0x16,0x52,0x34,0x89,0x11,0x9f,0xe9, > 0xe9,0x30,0x5e,0x30,0x92,0x54,0x2e,0xcb,0xed,0x7a,0x1d,0x09,0x00,0x3b > }; > > Now, the question is what the format of the image the cell of table support? > 1> the size of the image > 16x16? 18x18? Any size, limited only by your computer memory, or the limits of the file format in question. I make no promises that really large images will look good on the screen, however... ;-) > 2> the color level of the image > 2 colors, 16 colors, 256 colors? No GIF image will ever have more than 256 colors.... > 3> convert the icon to array > reswrap.exe -o aa.txt aa.gif is this correct? That looks correct. Note, if you're using GIF files, then you'd want to use FXGIFIcon, and if you use BMP files then you'd want to use FXBMPIcon, and so on. I recommend to use the --keep-ext option in reswrap; this will slap the file extension after the file name, making it a bit more difficult to forget which type of icon it was*. I recommend that you generate your reswrapped icons as part of the build process, by having some special build rules in my Makefile (If you're using VC++, you can implement the same idea using a "custom build rule"): # Icons ICONS = \ image.gif \ fileopen.gif \ .... help.gif # Make icon header icons.h: $(ICONS) reswrap -h -o icons.h $(ICONS) # Make icon source icons.cpp: $(ICONS) icons.h reswrap -i icons.h -o icons.cpp $(ICONS) This results in an icons.h file like: /*********** Generated on 2009/06/16 14:44:56 by reswrap version 5.1.1 *********/ /* Created by reswrap from file image.gif */ extern const unsigned char image[]; .... and an icons.cpp file like: /*********** Generated on 2009/06/16 14:44:57 by reswrap version 5.1.1 *********/ #include "icons.h" /* Created by reswrap from file image.gif */ const unsigned char image[]={ 0x47,0x49,0x46,,.... }; These can then be compiled normally. Any C++ source file which needs the icons includes icons.h, while the icons.o [or icons.obj] file will be simply linked in with the rest of the object code. Each icon data array is represented in the executable only once. Having the source files be generated automatically means everything will get rebuild automatically if you ever edit the image files [on a large project this is bound to happen at some point]. Regards, - Jeroen * Reswrap v. 5 has a few nice features which make it easy to include icon or text data into C or C++ code. This includes the ability to place namespace declarations around the data declarations. See "man 1 reswrap" for more info. ------------------------------------------------------------------------------ Are you an open source citizen? Join us for the Open Source Bridge conference! Portland, OR, June 17-19. Two days of sessions, one day of unconference: $250. Need another reason to go? 24-hour hacker lounge. Register today! http://ad.doubleclick.net/clk;215844324;13503038;v?http://opensourcebridge.org _______________________________________________ Foxgui-users mailing list Foxgui-users@... https://lists.sourceforge.net/lists/listinfo/foxgui-users |
| Free embeddable forum powered by Nabble | Forum Help |