unicode点阵字模生成工具生成32*32字库在bootloader中显示的代码

来源:互联网 发布:php 权限拦截器 编辑:程序博客网 时间:2024/04/30 01:52

2012-05-09测试以下代码及工具可用,故记录下来。代码如下:

static void PutPixel(unsigned int x,unsigned int y, DWORD  c )
{
 if ( (x < 800) && (y < 480) )
  *((unsigned int *)IMAGE_EBOOT_FRAMEBUFFER_UA_START + 800*y + x) = c;
}

static void drawmat(char *mat,int matsize,int x,int y, DWORD color)
/*依次:字模指针、点阵大小、起始坐标(x,y)、颜色*/
{int i,j,k,n;
 n=(matsize-1)/8+1;
 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);
}

static void OEMShowWaitTXT(DWORD LcdType)/* Add by ZMF */
{
  #if 1
  //系统升级
 drawmat((char*)xi16S,16,160-16*2,60,0xffffff);
  drawmat((char*)tong16S,16,160-16,60,0xffffff);
   drawmat((char*)sheng16S,16,160,60,0xffffff);
    drawmat((char*)ji16S,16,160+16,60,0xffffff);
    drawmat((char*)sheng32S,32,160+16*2,60,0xffffff);//显示32*32汉字或英文
  #else
 drawmat((char*)char_dl16S,16,250,350,0xffffff);
 drawmat((char*)char_o16S,16,250+8*1+2,350,0xffffff);
 drawmat((char*)char_a16S,16,250+8*2+2,350,0xffffff);
 drawmat((char*)char_d16S,16,250+8*3+2,350,0xffffff);
 drawmat((char*)char_i16S,16,250+8*4,350,0xffffff);
 drawmat((char*)char_n16S,16,250+8*5,350,0xffffff);
 drawmat((char*)char_g16S,16,250+8*6,350,0xffffff);

 
 drawmat((char*)char_i16S,16,250+8*9,350,0xffffff);
 drawmat((char*)char_m16S,16,250+8*10,350,0xffffff);
 drawmat((char*)char_a16S,16,250+8*11+1,350,0xffffff);
 drawmat((char*)char_g16S,16,250+8*12+1,350,0xffffff);
 drawmat((char*)char_e16S,16,250+8*13+1,350,0xffffff);
  #endif
 RETAILMSG (1, (TEXT("ZMF:%s done.\r\n"), _T(__FUNCTION__)));
}
包含的头文件如下:

char sheng32S[]={
 #if 1 // h 32*32字模
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0xF8,0x00,0x00,0x00,0x38,0x00,0x00
,0x00,0x38,0x00,0x00,0x00,0x38,0x00,0x00,0x00,0x38,0x00,0x00,0x00,0x38,0x00,0x00
,0x00,0x38,0x00,0x00,0x00,0x38,0x00,0x00,0x00,0x38,0xF0,0x00,0x00,0x3A,0x38,0x00
,0x00,0x3C,0x1C,0x00,0x00,0x38,0x1C,0x00,0x00,0x38,0x1C,0x00,0x00,0x38,0x1C,0x00
,0x00,0x38,0x1C,0x00,0x00,0x38,0x1C,0x00,0x00,0x38,0x1C,0x00,0x00,0x38,0x1C,0x00
,0x00,0x38,0x1C,0x00,0x00,0x38,0x1C,0x00,0x00,0x38,0x1C,0x00,0x00,0x38,0x1C,0x00
,0x00,0x38,0x1C,0x00,0x00,0xFE,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
#else // 三32*32字模
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,0x18,0x00,0x00,0x00,0x3C
,0x0F,0xFF,0xFF,0xFC,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
,0x00,0x00,0x00,0x80,0x00,0x00,0x01,0xE0,0x03,0xFF,0xFF,0xF0,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,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0C
,0x00,0x00,0x00,0x1E,0x3F,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
#endif
};

生成32*32字模的工具下载地址是这里。
原创粉丝点击