首页 > 学院 > 开发设计 > 正文

点阵字模工具编程辅助效果示例

2019-11-17 05:46:15
字体:
来源:转载
供稿:网友
/*************** 点阵字模工具编程辅助效果示例 ***************//************************************************************************
该示例中的字模数组均由“点阵字模工具”生成,你可以用你自己需要的点阵信息来
替换示例中的字模信息,注重字模大小要一致,否则显示会出问题。用WIN-TC的字模工具生成指定字模信息能给你提供方便的集成小型字库解决方案
************************************************************************/#include "Conio.h"
#include "graphics.h"
#define closegr closegraphvoid initgr(void) /* BGI初始化 */
{int gd=DETECT,gm=0; /* 和gd=VGA,gm=VGAHI是同样效果 */
 registerbgidriver(EGAVGA_driver);/* 注册BGI驱动后可以不需要.BGI文件的支持运行 */
 initgraph(&gd,&gm,"");
}void drawmat(char *mat,int matsize,int x,int y,int 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);
}char shan16[]={
/* 以下是 '山' 的 16点阵宋体 字模,32 byte */
0x00,0x00,0x01,0x00,0x01,0x00,0x01,0x00,
0x01,0x00,0x01,0x00,0x01,0x08,0x21,0x08,
0x21,0x08,0x21,0x08,0x21,0xF8,0x2E,0x08,
0x30,0x08,0x00,0x00,0x00,0x00,0x00,0x00, };char dong16[]={
/* 以下是 'dong' 的 16点阵宋体 字模,32 byte */
0x01,0x00,0x01,0x00,0x02,0x00,0x03,0xF0,
0x3C,0x00,0x05,0x00,0x09,0x00,0x11,0xF0,
0x1F,0x00,0x01,0x00,0x09,0x20,0x09,0x10,
0x11,0x08,0x23,0x00,0x01,0x00,0x00,0x00,};char da16[]={
/* 以下是 '点' 的 16点阵宋体 字模,32 byte */
0x02,0x00,0x02,0x00,0x02,0x00,0x02,0x00,
0x02,0x00,0x03,0xF0,0x3E,0x00,0x02,0x00,
0x05,0x00,0x04,0x80,0x08,0x40,0x10,0x20,
0x20,0x18,0x40,0x0E,0x00,0x00,0x00,0x00,};char xue16[]={
/* 以下是 '阵' 的 16点阵宋体 字模,32byte */
0x00,0x20,0x12,0x20,0x09,0x20,0x00,0x40,
0x23,0xFC,0x3C,0x08,0x63,0xC0,0x44,0x80,
0x01,0x00,0x01,0xF8,0x7E,0x80,0x00,0x80,
0x00,0x80,0x02,0x80,0x01,0x00,0x00,0x00,};char wei16[]={
/* 以下是 '宋' 的 16点阵宋体 字模,32 byte */
0x01,0x00,0x01,0x20,0x01,0x10,0x01,0xE0,
0x3F,0x00,0x21,0x00,0x22,0x90,0x2C,0x90,
0x27,0x50,0x3D,0x60,0x2A,0x20,0x44,0x52,
0x4A,0x8A,0x91,0x06,0x00,0x00,0x00,0x00,};char hai16[]={
/* 以下是 '体' 的 16点阵宋体 字模,32 byte */
0x01,0x00,0x01,0x00,0x21,0x70,0x13,0x80,
0x04,0x30,0x43,0xD0,0x22,0x90,0x02,0xFE,
0x1F,0x90,0x22,0x90,0x24,0x10,0x47,0xFC,
0x40,0x20,0x00,0xA0,0x00,0x40,0x00,0x00,};char fen16[]={
/* 以下是 '字' 的 16点阵隶书 字模,32 byte */
0x00,0x00,0x03,0x00,0x00,0x80,0x04,0x40,
0x04,0x20,0x08,0x18,0x10,0x0E,0x21,0xC0,
0xDE,0x40,0x02,0x40,0x04,0x40,0x08,0x40,
0x12,0x80,0x61,0x00,0x00,0x00,0x00,0x00,
};char xiao16[]={
/* 以下是 '模' 的 24点阵楷体_GB2312 字模,72 byte */
0x00,0x00,0x10,0xC0,0x10,0x20,0x10,0x78,
0x13,0x80,0x1C,0x30,0x71,0x08,0x12,0x20,
0x39,0x20,0x54,0xA0,0x90,0x40,0x10,0xA0,
0x11,0x18,0x16,0x0E,0x10,0x00,0x00,0x00,};char dian32[]={
/* 以下是 '灌' 的 32点阵黑体 字模,128 byte */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,
0x00,0x03,0x00,0x00,0x00,0x03,0x00,0x00,
0x00,0x03,0x00,0x00,0x00,0x03,0x00,0x00,
0x07,0xFF,0xFF,0x80,0x06,0x03,0x00,0x80,
0x06,0x03,0x00,0x80,0x06,0x03,0x00,0x80,
0x06,0x03,0x00,0x80,0x06,0x03,0x00,0x80,
0x07,0xFF,0xFF,0x80,0x07,0xFF,0xFF,0x80,
0x06,0x03,0x00,0x80,0x06,0x03,0x00,0x80,
0x06,0x03,0x00,0x80,0x06,0x03,0x00,0x80,
0x06,0x03,0x00,0x80,0x07,0xFF,0xFF,0x80,
0x06,0x03,0x00,0x00,0x06,0x03,0x00,0x00,
0x06,0x03,0x00,0x00,0x06,0x03,0x00,0x00,
0x00,0x03,0x00,0x18,0x00,0x01,0x00,0x18,
0x00,0x01,0xFF,0xF0,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,};char zi32[]={
/* 以下是 '灌' 的 32点阵方正黄草简体 字模,128 byte */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x03,0xFF,0xFF,0xC0,0x03,0xFF,0xFF,0xC0,
0x00,0x00,0x03,0x80,0x00,0x00,0x06,0x00,
0x00,0x00,0x18,0x00,0x00,0x00,0x70,0x00,
0x00,0x01,0xC0,0x00,0x00,0x01,0x80,0x00,
0x00,0x01,0x80,0x00,0x00,0x01,0x80,0x00,
0x00,0x01,0x80,0x00,0x3F,0xFF,0xFF,0xFC,
0x3F,0xFF,0xFF,0xFC,0x00,0x01,0x80,0x00,
0x00,0x01,0x80,0x00,0x00,0x01,0x80,0x00,
0x00,0x01,0x80,0x00,0x00,0x01,0x80,0x00,
0x00,0x01,0x80,0x00,0x00,0x01,0x80,0x00,
0x00,0x01,0x80,0x00,0x00,0x01,0x80,0x00,
0x00,0x01,0x80,0x00,0x00,0x01,0x80,0x00,
0x00,0x1F,0x80,0x00,0x00,0x0F,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,};char xi32[]={
/* 以下是 'xi' 的 32点阵楷体_GB2312 字模,128 byte */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xC0,
0x00,0x00,0x7F,0xE0,0x07,0xFF,0xC0,0x00,
0x00,0x02,0x00,0x00,0x00,0x03,0x00,0x00,
0x00,0x04,0x00,0x00,0x00,0x08,0x06,0x00,
0x00,0x10,0x0E,0x00,0x00,0x60,0x18,0x00,
0x01,0xFF,0xE0,0x00,0x00,0x81,0x80,0x00,
0x00,0x03,0x00,0x00,0x00,0x04,0x03,0x00,
0x00,0x18,0x00,0x80,0x00,0x60,0x00,0xE0,
0x03,0xFF,0xFF,0xF0,0x03,0xE0,0xC0,0x38,
0x00,0x00,0xC0,0x10,0x00,0x00,0xC0,0x00,
0x00,0x00,0xC0,0x00,0x00,0xC0,0xC3,0x00,
0x01,0x80,0xC1,0xC0,0x03,0x00,0xC0,0x60,
0x06,0x00,0xC0,0x30,0x0C,0x00,0xC0,0x10,
0x00,0x0F,0x80,0x00,0x00,0x07,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,};
char yao32[]={
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,0x00,0x00,0x40,0x42,0x00,
0x00,0x60,0x46,0x00,0x00,0xC0,0x66,0x00,
0x00,0x80,0x64,0x00,0x01,0x06,0x64,0x60,
0x03,0x03,0x64,0xC0,0x33,0x30,0x64,0x00,
0x7F,0xF0,0x64,0x00,0x06,0x20,0x64,0x00,
0x06,0x23,0x45,0x80,0x02,0x46,0x44,0x40,
0x01,0xC0,0x44,0x00,0x01,0xC0,0x46,0x00,
0x03,0x30,0xC6,0x00,0x06,0x01,0x83,0x82,
0x3C,0x07,0x03,0xFC,0x10,0x1E,0x01,0xFC,
0x00,0x00,0x00,0x70,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
};
char peng32[]=;
main()
{int i,j;
 initgr(); /* BGI初始化 */ drawmat(shan16,16,220,125,RED);
 drawmat(dong16,16,250,125,RED);
 drawmat(da16,16,280,125,GREEN);
 drawmat(xue16,16,310,125,GREEN);
 drawmat(wei16,16,340,125,YELLOW);
 drawmat(hai16,16,370,125,YELLOW);
 drawmat(fen16,16,400,125,GREEN);
 drawmat(xiao16,16,430,125,GREEN);
 drawmat(dian32,32,300,140,RED);
 drawmat(zi32,32,340,140,YELLOW);
 drawmat(xi32,32,380,140,GREEN);
 drawmat(yao32,32,310,180,GREEN);
 drawmat(peng32,32,350,180,GREEN);
 getch(); /* 暂停一下,看看前面绘图代码的运行结果 */
 closegr(); /* 恢复TEXT屏幕模式 */
}



上一篇:递归找迷宫

下一篇:词法分析程序

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表