#define __FONT_WIDTH_SPACE 2
#define __FONT_HEIGHT_SPACE 2
static int font_width = 8;
static int font_height = 8;
static int screen_x = 0;
static int screen_y = 0;
void lcd_printf(char *string, int x, int y, int scale, int fcolor, int bcolor, int mod)
{
static char bits[]={0x80,0x40,0x20,0x10,0x08,0x04,0x02,0x01};
char *data;
char *p = string;
char dots;
int FONT_WIDTH,FONT_HEIGHT;
int i,j,px,py;
int font_fcolor,font_bcolor;
FONT_WIDTH = font_width*scale;
FONT_HEIGHT = font_height*scale;
if(x != -1)screen_x = x;
if(y != -1)screen_y = y;
switch(mod & 0x7)
{
case LCD_DRAWMODE_NORMAL:
font_fcolor = fcolor;
font_bcolor = bcolor;
break;
/*
case LCD_DRAWMODE_TRANS:
break;
case LCD_DRAWMODE_REV:
break;
*/
default:
font_fcolor = -1;
font_bcolor = 0;
break;
}
for(;*p;p++)
{
int li,lj;
dots = *p;
if( (dots < 32) || (dots > 162) )dots = 32;
data = GUI_F8x8_acFont[dots - 32];
py = y;
for(i = 0;i < font_height;i++)
{
dots = *data++;
for(lj = 0;lj < scale;lj++)
{
px = x;
for(j = 0;j < font_width;j++)
{
char dbit;
dbit = dots & bits[j];
for(li = 0;li < scale;li++)
{
if(dbit)set_lcd_pixel(font_fcolor,px++,py);
else set_lcd_pixel(font_bcolor,px++,py);
}
}
for(li = 0;li < __FONT_WIDTH_SPACE;li++)
{
set_lcd_pixel(font_bcolor,px++,py);
}
py++;
}
}
for(i = 0;i < __FONT_HEIGHT_SPACE;i++)
{
px = x;
for(j = 0;j < (FONT_WIDTH + __FONT_WIDTH_SPACE);j++)
{
set_lcd_pixel(font_bcolor,px++,py);
}
py++;
}
x = px;
if( (x + FONT_WIDTH) > 320 ) {x = 0;y = py;}
if(y >= 480)break;
}
screen_x = x;
screen_y = y;
}
void lcd_draw_rect(LCD_RECT *rect, int color)
{
int i,j;
int x0,y0,x1,y1;
x0 = rect->x0;
y0 = rect->y0;
x1 = rect->x1;
y1 = rect->y1;
for(i = x0;i < x1;i++)
{
set_lcd_pixel(color,i,y0);
set_lcd_pixel(color,i,y1);
}
for(i = y0;i < y1;i++)
{
set_lcd_pixel(color,x0,i);
set_lcd_pixel(color,x1,i);
}
}
void lcd_fill_rect(LCD_RECT *rect, int color)
{
int i,j;
int x0,y0,x1,y1;
x0 = rect->x0;
y0 = rect->y0;
x1 = rect->x1;
y1 = rect->y1;
for(i = y0;i < y1;i++)
for(j = x0;j < x1;j++)
set_lcd_pixel(color,j,i);
}
|