void drawmat(char *mat,int matsize,int x,int y,int color)
/*依次:字模指针、点阵大小、起始坐标(x,y)、颜色*/ {
int i, j, k, n;
n = (matsize - 1) / 8 + 1;//2
for(j = 0; j < matsize; j++)
for(i = 0; i < n; i++)
for(k = 0;k < 8; k++)
if(mat[j * n + i] & (0x80 >> k)) /*测试为1的位则显示*/
putpixel(x + i * 8 + k, y + j, color);
}
char yi12[]={
/* 以下是 '1' 的 12点阵宋体 字模,24 byte */
0x00,0x00,0x0C,0x00,0x1C,0x00,0x3C,0x00,
0x0C,0x00,0x0C,0x00,0x0C,0x00,0x0C,0x00,
0x0C,0x00,0x3F,0x00,0x00,0x00,0x00,0x00,
}; |
|