初级会员

- 积分
- 79
- 金钱
- 79
- 注册时间
- 2012-9-4
- 在线时间
- 0 小时
|
void LCD_ShowChar(u16 x,u16 y,u8 num,u8 size,u8 mode)
{
#if USE_HORIZONTAL==1
#define MAX_CHAR_POSX 312
#define MAX_CHAR_POSY 232
#else
#define MAX_CHAR_POSX 232
#define MAX_CHAR_POSY 312
#endif
u8 temp;
u8 pos,t;
u16 x0=x;
u16 colortemp=POINT_COLOR;
if(x>MAX_CHAR_POSX||y>MAX_CHAR_POSY)return;
//设置窗口
num=num-' ';//得到偏移后的值
if(!mode) //非叠加方式
{
for(pos=0;pos<size;pos++)
{
if(size==12)temp=asc2_1206[num][pos];//调用1206字体
else temp=asc2_1608[num][pos]; //调用1608字体
for(t=0;t<size/2;t++)
{
if(temp&0x01)POINT_COLOR=colortemp;
else POINT_COLOR=BACK_COLOR;
LCD_DrawPoint(x,y);
temp>>=1;
x++;
}
x=x0;
y++;
}
}else//叠加方式
{
for(pos=0;pos<size;pos++)
{
if(size==12)temp=asc2_1206[num][pos];//调用1206字体
else temp=asc2_1608[num][pos]; //调用1608字体
for(t=0;t<size/2;t++)
{
if(temp&0x01)LCD_DrawPoint(x+t,y+pos);//画一个点
temp>>=1;
}
}
}
POINT_COLOR=colortemp;
}
原子哥,对于这个函数的理解。首先把黑色(POINT_COLOR)赋给变量colortemp,然后temp为一时再把 黑色赋给画笔 (if(temp&0x01)POINT_COLOR=colortemp),temp为零时显示背景色白色。这样应该就行了呀,为什么还要再把变量colortemp再赋给画笔一次呢(红色部分)。我把红色部分屏蔽了,TFT上就没显示了··,不懂希望原子哥和各位大侠帮忙解释一下。 |
|