dodle
December 15th, 2011, 04:09 AM
I'm trying to use a const unsigned char[] that is data from a .png image for an icon:
static const unsigned char tux_png[] = {
0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d,
0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x01, 0x90, 0x00, 0x00, 0x01, 0xdf,
0x08, 0x06, 0x00, 0x00, 0x00, 0x7e, 0xb1, 0x8e, 0x75, 0x00, 0x00, 0xa0,
0xdb, 0x49, 0x44, 0x41, 0x54, 0x78, 0x5e, 0xec, 0xdd, 0x6b, 0x4c, 0x55,
0xd9, 0x1d, 0xc6, 0xe1, 0x97, 0x9b, 0x47, 0xf0, 0x5e, 0x8c, 0x20, 0x58,
0x51, 0x90, 0x86, 0x20, 0x12, 0x2d, 0xa3, 0x1d, 0x7b, 0xb5, 0xde, 0xb0,
0x54, 0xc7, 0x68, 0x13, 0x75, 0x54, 0xda, 0x5a, 0x52, 0x3e, 0xd4, 0xcc,
0x68, 0x89, 0x71, 0xd0, 0x4c, 0xa3, 0xc9, 0x8c, 0x89, 0x75, 0x92, 0x2a,
0x99, 0x89, 0xf3, 0x61, 0x8c, 0x46, 0xc3, 0x28, 0xad, 0x97, 0x8e, 0xd7,
0xa9, 0xb5, 0xca, 0xb4, 0xd6, 0x8c, 0x53, 0x99, 0x58, 0x65, 0x94, 0x18,
0x71, 0x00, 0x15, 0x51,
...
But I can't figure out how to use it with wxIcon. I have read the docs (http://docs.wxwidgets.org/stable/wx_wxicon.html#wxicon) but still have not figured it out. I tried:
wxIcon icon(tux_png);
and
wxIcon icon(tux_png, 400, 479);
and some other things as well. Is there a way to convert data from a const char[] for use with wxIcon or wxBitmap?
static const unsigned char tux_png[] = {
0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d,
0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x01, 0x90, 0x00, 0x00, 0x01, 0xdf,
0x08, 0x06, 0x00, 0x00, 0x00, 0x7e, 0xb1, 0x8e, 0x75, 0x00, 0x00, 0xa0,
0xdb, 0x49, 0x44, 0x41, 0x54, 0x78, 0x5e, 0xec, 0xdd, 0x6b, 0x4c, 0x55,
0xd9, 0x1d, 0xc6, 0xe1, 0x97, 0x9b, 0x47, 0xf0, 0x5e, 0x8c, 0x20, 0x58,
0x51, 0x90, 0x86, 0x20, 0x12, 0x2d, 0xa3, 0x1d, 0x7b, 0xb5, 0xde, 0xb0,
0x54, 0xc7, 0x68, 0x13, 0x75, 0x54, 0xda, 0x5a, 0x52, 0x3e, 0xd4, 0xcc,
0x68, 0x89, 0x71, 0xd0, 0x4c, 0xa3, 0xc9, 0x8c, 0x89, 0x75, 0x92, 0x2a,
0x99, 0x89, 0xf3, 0x61, 0x8c, 0x46, 0xc3, 0x28, 0xad, 0x97, 0x8e, 0xd7,
0xa9, 0xb5, 0xca, 0xb4, 0xd6, 0x8c, 0x53, 0x99, 0x58, 0x65, 0x94, 0x18,
0x71, 0x00, 0x15, 0x51,
...
But I can't figure out how to use it with wxIcon. I have read the docs (http://docs.wxwidgets.org/stable/wx_wxicon.html#wxicon) but still have not figured it out. I tried:
wxIcon icon(tux_png);
and
wxIcon icon(tux_png, 400, 479);
and some other things as well. Is there a way to convert data from a const char[] for use with wxIcon or wxBitmap?