OSD Resource Introduction
OSD Resource Introduction
1.0
2006-11-9
2 Bitmaps
typedef struct
{
unsigned short w;
unsigned short h;
unsigned long bmp_size;
unsigned long data_size;
const unsigned char* data;
}bitmap_infor_t;
w
icon’s width
h
icon’s height
bmp_size
icon’s data size before compressed
data_size
icon’s data size after compressed
data
icon’s data (compressed with RLE)
Note:
1. Please remove bitmap files that not for the project.
2. In osd_rsc.c, the array of font_bitmap[ ] is used to hold the bitmap and the font’s data when access
it. So you should guarantee the size of font_bitmap[ ] should equal or larger the bitmaps’ max
bmp_size.
typedef struct
{
UINT8 height;
UINT16 uFontCnt;
const UINT8* width;
const UINT32* data;
const UINT16* uIdxTab;
} font_t;
height
font’s height
uFontCnt
font’s count
width
font’s width array for every character
data
font’s data array for every character
uIdxTab
font’s character code(unicode) array
If a character’s with value is 0, it means that that character not coded in this font, at the same time no
font data in the font data array.
A character’s font data’s is illustrated in the following figure.
Every character’s font data must be multiple of 32-bit. If need, some padding bits maybe added to fit this
limitation.
Each kind of font may have different size, so a font array is used to descript different size fonts of same
kind. In application may has different kind of fonts, and then another font array is used to descript
different kind of fonts.
font_t font_asc[] =
Note:
1. You can only generating one font with the same height at one time. That’s you should not mix font
bitmaps with different height to generate the font data. For the same characters with different font’s
height, generate the font’s data for one height individually.
2. You should well understand the functions of OSD_GetDefaultFontLib() and get_font() in osd_rsc.c for
the information of how the OSD library access a character’s font data and how to add new font support.
BYTE Meaning
3~4 1st string data offset from the start of the string data array
5~6 2nd string data offset from the start of the string data array
3 + i*2 ~ 3 + i*2 + 1 Sting i data offset from the start of the string data array
… ..
3 + N*2 ~ 3 + N*2 +
Last string data offset from the start of the string data array
1
…… Character UINCODE data of every string
Note:
1. You should well understand function OSD_SetLangEnvironment(), g_LangRscMapTable array
and LANG_GROUP_t in osd_rsc.c, string_array.h and osd_rsc.h to add new language support.
5 Palette
Tool usage: genpallete.exe [palette file] [256]. It will generate a palette file with name same as palette
file but the file extension is “.h”. If it runs with no arguments specified, then it will try to file palette.bmp to
processing and output palette.h. The output palette file include two palette arrays: one is RGB style the
other is YUV style. Select YUV to use. The generate palette array’s color alpha value is 0xFF; it should
change to the value between 0 and 15 according to UI design. Then copy the YUV palette array to
renamed palette file.
For the demo code, copy the modified YUV palette file to Glass_DemoBoard \ rsc \ pal.
6 WINSTYLE
WINSTYLE is the abstraction of the pattern and color to draw an object or a frame.
UINT16 wLeftTopIdx;
UINT16 wLeftButtomIdx;
UINT16 wRightTopIdx;
UINT16 wRightButtomIdx;
UINT16 IconLibIdx;
} WINSTYLE, *PWINSTYLE;
The type of C_WS_LINE_DRAW means draw a rectangle frame with specified board color, background
color and foreground color. The type of C_WS_LINE_CIRCL_DRAW is same as C_WS_LINE_DRAW
except that it’s a circle rectangle. The type of C_WS_PIC_DRAW means draw a rectangle with frame
with bitmaps.
wTopLineIdx The top line’s color The top line’s color The top line’s bitmap ID
wLeftLineIdx The left line’s color The left line’s color The left line’s bitmap ID
C_WS_LINE_CIRCL_D
bWinStyleType C_WS_LINE_DRAW C_WS_PIC_DRAW
RAW
C_NOSHOW/ C_NOSHOW/
wTopLineIdx INVALID_INDEX
C_DOUBLE_LINE C_DOUBLE_LINE
C_NOSHOW/ C_NOSHOW/
wLeftLineIdx INVALID_INDEX
C_DOUBLE_LINE C_DOUBLE_LINE
C_NOSHOW/ C_NOSHOW/
wRightLineIdx INVALID_INDEX
C_DOUBLE_LINE C_DOUBLE_LINE
C_NOSHOW/ C_NOSHOW/ The bottom line’s
wBottomLineIdx
C_DOUBLE_LINE C_DOUBLE_LINE bitmap ID
C_NOSHOW| C_NOSHOW|
wBgIdx NOSHOW | C_MIXER
C_MIXER C_ C_MIXER
wFgIdx C_MIXER C_MIXER C_MIXER
wLeftTopIdx N/A N/A INVALID_INDEX
wLeftButtomIdx N/A N/A INVALID_INDEX
wRightTopIdx N/A N/A INVALID_INDEX
wRightButtomIdx N/A N/A INVALID_INDEX
IconLibIdx N/A N/A LIB_ICON