📄 display_char.c
字号:
#include "44b0x.h"
#include "Gui.h"
extern unsigned char LCD_Buffer[320*240/4];
extern struct CHAR_INFO{
unsigned char XSize;
unsigned char XDist;
unsigned char BytesPerLine;
void* pData;
} GUI_CharInfoF8x13_ASCII[96] ;
void delay_T(void)
{
int temp;
for(temp=0;temp<0x65535;temp++)
{temp=temp;}
for(temp=0;temp<0x65535;temp++)
{temp=temp;}
for(temp=0;temp<0x65535;temp++)
{temp=temp;}
for(temp=0;temp<0x65535;temp++)
{temp=temp;}
}
void gui_test(int x_t,int y_t,char color)
{
int x,y,x_bit;
char temp,mask=0xff;
x=x_t/4;y=y_t;
if(x_t<4){x_t=x_t+4;}
x_bit=x_t%4;
temp=LCD_Buffer[y*80+x];
switch(x_bit)
{
case 0:mask=0x3f;color=color<<6;break;
case 1:mask=0xcf;color=color<<4;break;
case 2:mask=0xf3;color=color<<2;break;
case 3:mask=0xfc;color=color<<0;break;
default : color=0;
}
temp=(temp&mask)+color;
LCD_Buffer[y*80+x]=temp;
}
//================================================
//
//
//
//
//
//================================================
void display_char(int x,int y,char c,int color)
{
int mask=0x80;
int x_temp=x,y_temp=y;
char temp_t,count_t,point_flag=0,x_size,count_t2=0;
struct CHAR_INFO *t;
unsigned char *p;
t=GUI_CharInfoF8x13_ASCII;
p=(unsigned char *)((t+(c-32))->pData);
x_size=((t+(c-32))->XSize);
for(y_temp=y,count_t2=0;count_t2<13;y_temp++,count_t2++)
{
for(x_temp=x,count_t=0;count_t<x_size;x_temp++,count_t++)
{
temp_t=*p;
temp_t=(temp_t&(mask>>count_t));
if(temp_t)
{
point_flag=1;
if(color==Reverse)
{point_flag=0;}
draw_point_for_char(x_temp,y_temp, point_flag);
}
else
{
point_flag=0;
if(color==Reverse)
{point_flag=1;}
draw_point_for_char(x_temp,y_temp, point_flag);
}
}
p++;
}
}
void display_char_big(int x,int y,char c,int color)
{
int mask=0x80;
int x_temp=x,y_temp=y;
char temp_t,count_t,point_flag=0,x_size,count_t2=0;
struct CHAR_INFO *t;
unsigned char *p;
t=GUI_CharInfoF8x13_ASCII;
p=(unsigned char *)((t+(c-32))->pData);
x_size=32;//((t+(c-32))->XSize);
for(y_temp=y,count_t2=0;count_t2<52;y_temp++,count_t2++)
{
if(count_t2%4==1){
for(x_temp=x,count_t=0;count_t<x_size;x_temp++,count_t++)
{
temp_t=*p;
temp_t=(temp_t&(mask>>(count_t/4)));
if(temp_t)
{
point_flag=1;
if(color==Reverse)
{point_flag=0;}
draw_point_for_char(x_temp,y_temp, point_flag);
}
//else
//{
//point_flag=0;
//if(color==Reverse)
//{point_flag=1;}
//draw_point_for_char(x_temp,y_temp, point_flag);
//}
}
p++;
}
}
}
//=============================================
void display_char_080520(int x,int y,char c,int color)
{
char temp[8];
int count_rev;
int x_size,count,count_for_draw_point;
int mask=0x80,count_mask=0;int p_mask;
int x_display_char=0,y_display_char=0,x_display=x;
struct CHAR_INFO *t;
unsigned char *p;
t=GUI_CharInfoF8x13_ASCII;
p=(unsigned char *)((t+(c-32))->pData);
x_size=((t+(c-32))->XSize);
for(y_display_char=y;y_display_char<13+y;y_display_char++)
{
for(count=0;count<8;count++){ temp[count]=0;}
temp[0]=*p;
if(color==Reverse) //Reverse has been defined in 44b0x.h
{
count_rev=0;
temp[count_rev]=~temp[count_rev];count_rev++;
temp[count_rev]=~temp[count_rev];count_rev++;
temp[count_rev]=~temp[count_rev];count_rev++;
temp[count_rev]=~temp[count_rev];count_rev++;
temp[count_rev]=~temp[count_rev];count_rev++;
temp[count_rev]=~temp[count_rev];count_rev++;
temp[count_rev]=~temp[count_rev];count_rev++;
temp[count_rev]=~temp[count_rev];count_rev++; //this function can negative the color
}
count_mask=0;
p_mask=temp[0];
temp[count_mask]=(((p_mask)&(mask>>count_mask))>>(7-count_mask));count_mask++;
temp[count_mask]=(((p_mask)&(mask>>count_mask))>>(7-count_mask));count_mask++;
temp[count_mask]=(((p_mask)&(mask>>count_mask))>>(7-count_mask));count_mask++;
temp[count_mask]=(((p_mask)&(mask>>count_mask))>>(7-count_mask));count_mask++;
temp[count_mask]=(((p_mask)&(mask>>count_mask))>>(7-count_mask));count_mask++;
temp[count_mask]=(((p_mask)&(mask>>count_mask))>>(7-count_mask));count_mask++;
temp[count_mask]=(((p_mask)&(mask>>count_mask))>>(7-count_mask));count_mask++;
temp[count_mask]=(((p_mask)&(mask>>count_mask))>>(7-count_mask));count_mask++;
count_for_draw_point=0;
for(x_display_char=x;x_display_char<(x_display+8);x_display_char++)
{
draw_point_for_char(x_display_char,y_display_char, temp[count_for_draw_point]);
count_for_draw_point++;
//==============
//here,you must use "count_for_draw_point"to count the temp array
//and you can't use the "x_display_char" to count the array named temp
//if you used the "x_display_char" ,on the screen you will get a half char
//==============
}
p++;
}
}
void display_clear_char(int x,int y,char c,int color)
{
int x_size;
int x_display_char=x,y_display_char=y;
struct CHAR_INFO *t;
t=GUI_CharInfoF8x13_ASCII;
x_size=(t+(c-32))->XSize;
for(y_display_char=y;y_display_char<13+y;y_display_char++)
{
for(x_display_char=x;x_display_char<x+x_size;x_display_char++)
{draw_point_for_char(x_display_char,y_display_char,0);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -