單片機(jī)GUI編程顯示漢字int8GetGB12_Address( int8 *ptr )
本文引用地址:http://m.butianyuan.cn/article/201611/322062.htm{
int8 addr;
for (addr=0;addr//查找定位
{
if (( *ptr == gb12Dot[addr].Index[0]) && ( *(ptr+1) == gb12Dot[addr].Index[1]))
{break;}
}
returnaddr;
}
GUI_PutHZ(x1,y1,(uint8*)gb12Dot[GetGB12_Address(ptr)].Msk,12, 12);
const typFNT_GB12gb12Dot[] = {
" ", 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
":", 0x00,0x00,0x00,0x00,0x0C,0x00,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x00,
0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
"敏", 0x41,0x00,0x7F,0x00,0x81,0xE0,0x7F,0x40,0x55,0x40,0xFF,0x40,0x55,0x40,0x54,0x80,
0x7E,0x80,0x05,0x40,0x1A,0x20,0x00,0x00,
"感", 0x01,0x40,0x7F,0xE0,0x41,0x00,0x7F,0x40,0x5D,0x40,0x54,0xA0,0x9D,0x60,0x82,0x20,
0x54,0x40,0x52,0xA0,0x9F,0x80,0x00,0x00,
"度", 0x02,0x00,0x7F,0xE0,0x48,0x80,0x7F,0xE0,0x48,0x80,0x4F,0x80,0x40,0x00,0x5F,0x80,
0x45,0x00,0x87,0x00,0xB8,0xE0,0x00,0x00
}
typedef struct//漢字字模數(shù)據(jù)結(jié)構(gòu)
{
int8 Index[2];//漢字內(nèi)碼索引
int8 Msk[24];//點(diǎn)陣碼數(shù)據(jù)
}typFNT_GB12;
voidGUI_PutHZ(uint32 x, uint32 y, uint8 *dat, uint8 hno, uint8 lno)
{uint8i;
for(i=0; i{GUI_LoadLine(x, y, dat, hno);//輸出一行數(shù)據(jù)
y++;//顯示下一行
dat += (hno>>3);//計(jì)算下一行的數(shù)據(jù)
if( (hno&0x07)!=0 ) dat++;
}
}
uint8GUI_LoadLine(uint32 x, uint32 y, uint8 *dat, uint32 no)
{
uint8bit_dat;
uint8i;
TCOLORbakc;
if(x>=GUI_LCM_XMAX)
return(0);
if(y>=GUI_LCM_YMAX)
return(0);
for(i=0; i{
if( (i%8)==0 ) bit_dat = *dat++;
if( (bit_dat&DCB2HEX_TAB[i&0x07])==0 )
GUI_CopyColor(&bakc, back_color);
else
GUI_CopyColor(&bakc, disp_color);
GUI_Point(x, y, bakc);
if( (++x)>=GUI_LCM_XMAX )
return(0);
}
return(1);
}
uint8GUI_Point(uint8 x, uint8 y, TCOLOR color)
{
if(x>=GUI_LCM_XMAX)
return(0);
if(y>=GUI_LCM_YMAX)
return(0);
if( (color&0x01) != 0 )
gui_disp_buf[y][x>>3] |=DCB_HEX_TAB[x&0x07];
else
gui_disp_buf[y][x>>3] &= (~DCB_HEX_TAB[x&0x07]);
LCD_UpdatePoint(x, y);
return(1);
}
uint8 constDCB_HEX_TAB[8] = {0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01};
TCOLORgui_disp_buf[GUI_LCM_YMAX][GUI_LCM_XMAX/8];
voidLCD_UpdatePoint(uint32 x, uint32 y)
{ // uint32addr;
uint32addr11;
uint32addr22;
//addr = y*(GUI_LCM_XMAX>>3) + (x>>3);
addr11 = y*32%6 + (x>>3);
addr22 =y*32/256;
//WriteCmd3(addr&0xFF, addr>>8,AddrSet);//置地址指針
WriteCmd3(addr11, addr22,AddrSet);//置地址指針
delay(10);
WriteCmd2(gui_disp_buf[y][x>>3],DataWAddrI);
delay(10);
}
評論