论坛交流
首页办公自动化| 网页制作| 平面设计| 动画制作| 数据库开发| 程序设计| 全部视频教程
应用视频: Windows | Word2007 | Excel2007 | PowerPoint2007 | Dreamweaver 8 | Fireworks 8 | Flash 8 | Photoshop cs | CorelDraw 12
编程视频: C语言视频教程 | HTML | Div+Css布局 | Javascript | Access数据库 | Asp | Sql Server数据库Asp.net  | Flash AS
当前位置 > 文字教程 > C语言程序设计教程
Tag:新手,函数,指针,数据类型,对象,Turbo,入门,运算符,数组,结构,二级,,tc,游戏,试题,问答,编译,视频教程

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

文章类别:C语言程序设计 | 发表日期:2008-9-24 14:43:40

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

/************************************************************************
该示例中的字模数组均由“点阵字模工具”生成,你可以用你自己需要的点阵信息来
替换示例中的字模信息,注重字模大小要一致,否则显示会出问题。

用WIN-TC的字模工具生成指定字模信息能给你提供方便的集成小型字库解决方案
************************************************************************/

#include "Conio.h"
#include "graphics.h"
#define closegr closegraph

void 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,0 x00,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[]={
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,0x0C,0x00,
0x07,0x80,0x08,0xC0,0x0C,0xA2,0x70,0xE0,
0x04,0x82,0x40,0x40,0x04,0x82,0x48,0x40,
0x04,0x9E,0x44,0x40,0x04,0x82,0x40,0xC0,
0x04,0x82,0x41,0x80,0x04,0x82,0x60,0x00,
0x07,0x9E,0x60,0x00,0x04,0x82,0x7F,0xF8,
0x08,0xA2,0x00,0x18,0x08,0xA2,0x00,0x18,
0x08,0xA2,0xFF,0x98,0x18,0x42,0x00,0x18,
0x30,0x86,0x00,0x18,0x61,0x06,0x00,0x70,
0x00,0x00,0x00,0xE0,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
};
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屏幕模式 */
}

上一篇:{实例}简单的画笔 人气:7100
下一篇:{实例}牛顿和拉格朗日插值算法 人气:7185
视频教程列表
文章教程搜索
 
C语言程序设计推荐教程
C语言程序设计热门教程
看全部视频教程
购买方式/价格
购买视频教程: 咨询客服
tel:15972130058