To display image there is the display_icon() function based on STK DISPLAY_TEXT command. In case you want to have pictures in other STK commands you can implement appropriate wrapper as in the stkcmd.c example.
To create image use the set_img() function. It has four parameters:
width
height
format
image
callback
The image callback generates the image itself - it is called when ME requests the image.
Example - generate filled rectangle:
Example - show 96x22 xbm format picture
u8 PROGMEM bladox_pic[]= // xbm format { 0xff, 0xd7, 0xfe, 0xff, 0xfd, 0xdd, 0xff, 0xdf, 0xfe, 0xff, 0xbf, 0x7e, 0x87, 0xf9, 0xe7, 0x7f, 0x8f, 0xbf, 0x05, 0xff, 0x0f, 0xee, 0xf2, 0x73, 0x03, 0x80, 0x40, 0x00, 0x02, 0x43, 0x00, 0x00, 0x00, 0x00, 0x20, 0x40, 0x01, 0x20, 0x60, 0x10, 0x00, 0x07, 0x00, 0x10, 0xe0, 0x30, 0x70, 0x60, 0xf1, 0xff, 0x70, 0x80, 0xe0, 0x07, 0xfc, 0x1b, 0xf0, 0x75, 0x7c, 0x38, 0xf1, 0xff, 0x70, 0x01, 0xe0, 0x07, 0xfc, 0x3f, 0xf8, 0x7b, 0xfa, 0x3c, 0xf9, 0xf7, 0x70, 0x30, 0xf0, 0x07, 0xfe, 0x7d, 0xfc, 0xeb, 0x74, 0x3e, 0xf3, 0xf0, 0x70, 0x08, 0x70, 0x2f, 0x9c, 0x79, 0x1e, 0xe0, 0x72, 0x3f, 0x3b, 0xf0, 0xf0, 0x04, 0x70, 0x4f, 0x3c, 0x78, 0x1e, 0xf0, 0xf1, 0x0f, 0x31, 0xf8, 0x70, 0x41, 0x38, 0x1f, 0x1e, 0x30, 0x0f, 0xe0, 0xc0, 0x2f, 0xf1, 0x5f, 0x70, 0x80, 0x38, 0x1f, 0x1c, 0x71, 0x4f, 0xf2, 0xc4, 0x07, 0xf9, 0xff, 0xf0, 0x00, 0x3c, 0x1e, 0x1c, 0x30, 0x1e, 0xc0, 0xc0, 0x0f, 0xf9, 0xff, 0xf1, 0x00, 0x1c, 0x3e, 0x3e, 0x78, 0x5b, 0xe0, 0xe3, 0x1f, 0xf3, 0xe0, 0x70, 0x02, 0x5c, 0x3f, 0x1c, 0x78, 0x1e, 0xf0, 0xe0, 0x1f, 0x71, 0xe0, 0x71, 0x00, 0xfe, 0x7f, 0x1c, 0x3c, 0x1a, 0x60, 0x70, 0x3e, 0x33, 0xf0, 0x30, 0x00, 0xfe, 0x3f, 0x0e, 0x3c, 0x2e, 0xf0, 0xf8, 0x3c, 0x31, 0xf8, 0x30, 0x60, 0xdf, 0x79, 0x0e, 0x3e, 0x1c, 0x7c, 0x78, 0x7e, 0xfb, 0xff, 0xf8, 0x7f, 0x0f, 0x78, 0xfc, 0x9f, 0x1e, 0x3c, 0xfc, 0x79, 0xfb, 0x7f, 0xf8, 0xbf, 0x2f, 0x7c, 0xff, 0x2f, 0xbe, 0x1f, 0x3e, 0x7c, 0xff, 0x17, 0xfe, 0xff, 0x07, 0x7d, 0xff, 0x07, 0xf8, 0x0f, 0x1f, 0x3e, 0x83, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; u8 generate_bladox_pic (u16 i) { u8 j; u8 x=rb(bladox_pic+i); u8 ret=0; // swap lsb/msb order for(j=0;j<8;j++) ret|=(x&(1<<j))?(1<<(7-j)):0; return ret; } void foo() { display_icon(96, 22, IMG_BW, generate_bladox_pic, NULL, Q_DISPLAY_ICON_SELF_EXP); }
|
Indicates black and white image. |
|
Indicates color image. |
|
|
|
In case you wanted to write a new STK command wrapper using T_ICON_ID use this function to set the image generating function.
|
Copyright © 2004-2006 BLADOX | Turbo version 1.2
|