当前位置导航:炫浪网>>网络学院>>编程开发>>C++教程>>C++进阶与实例

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

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

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

    用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,

 

共2页 首页 上一页 1 2 下一页 尾页 跳转到
相关内容
赞助商链接