注册 登录  
 加关注
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

简约男人

简约,不能简单

 
 
 

日志

 
 
关于我

一个过分渴望被理解的人其实就是一个软弱的人, 勇往直前的力量来自斩钉截铁的决心,不是来自别人的理解.

网易考拉推荐

DOS下交互式绘图系统  

2009-10-03 16:12:03|  分类: 我的软件作品 |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |

 

所需要的鼠标操作函数请参考鼠标编程中断号的意义  一文中的资源。 

所需要的汉字技术请参考TC中简单的汉字技术TC2.0中的汉字的显示

如果想将其扩展的更加绚丽多彩请参考DOS下的真彩色图形库DOS真彩色模式下真彩色图像显示技术

如果希望这些窗口具有3D效果请参考TR_CDOSG-DOS图形汉字编程接口

第二次图形学作业——交互式绘图系统 - tr0217 - 简约男人

主文件

/*********************************

作者:shawn

E-mail:tr0217@163.com

QQ:547591979

*********************************/

#include <stdio.h>

#include <conio.h>

#include <stdlib.h>

#include <math.h>

#include <Graphics.h>

#include <dos.h>

#include "Gmouse.h"

#include "char.h"

#define ESC 0x1b

/*其本图形元素结构体*/

typedef struct bfnode

{

    int X0,Y0,X1,Y1,color;

    struct bfnode *next;

}bfNode;

/*图形结构体,其中kind表示该图形的组成基本图形元素的类型

kind= 0 表示直线

kind= 1 表示弧线

kind= 2 表示曲线

kind= 3 表示方形

kind= 4 表示圆形

kind= 5 表示多边形

一幅图形有这样一个结构体组成的链表表示

图形中相同的基本图形元素则组成其子链表

*/

typedef struct fnode

{

    int kind;

    bfNode *graph;

    struct fnode *next;

}fNode;

/*图形结构体

roll 代表是否旋转*/

typedef struct figure

{

    int roll;

    fNode *gf;

}graph;

 

/*画圆*/

void bresenham_circle(int X,int Y,int R,int left, int top, int right, int bottom)

{

    int x,y,delta,delta1,direction;

    x=0;

    y=R;

    delta=2*(1-R);

    while (y>=0)

    {

        if (((X+x)>left)&&((X+x)<right)&&((Y+y)>top)&&((Y+y)<bottom))

            putpixel(X+x,Y+y,getcolor());

        if (((X+x)>left)&&((X+x)<right)&&((Y-y)>top)&&((Y-y)<bottom))

            putpixel(X+x,Y-y,getcolor());

        if (((X-x)>left)&&((X-x)<right)&&((Y+y)>top)&&((Y+y)<bottom))

            putpixel(X-x,Y+y,getcolor());

        if (((X-x)>left)&&((X-x)<right)&&((Y-y)>top)&&((Y-y)<bottom))

            putpixel(X-x,Y-y,getcolor());

        if (delta<0)

        {

            delta1=2*(delta+y)-y;

            if (delta1<=0) direction=1;

            else direction=2;

        }

        else if (delta>0)

        {

            delta1=2*(delta-x)-1;

            if (delta1<=0) direction=2;

            else direction=3;

        }

        else  direction=2;

        switch (direction)

        {

        case 1:

            x++;

            delta+=2*x+1;

            break;

        case 2:

            x++;

            y--;

            delta+=2*(x-y+1);

            break;

        case 3:

            y--;

            delta+=(-2*y+1);

            break;

        }

    }

}

 

/*画按钮

size表示按钮内汉字点阵大小

n 表示按钮内有几个汉字

m 表示按钮是几个汉字长度

color 表示按钮边框的颜色

charcolor 表示汉字的颜色*/

void button(int x,int y,char a[],int size,int n,int m,int color,int charcolor)

{

    int i,j,k;

    setcolor(color);

    line(x,y,x+m*size,y);

    line(x,y,x,y+size+2);

    line(x,y+size+2,x+m*size,y+size+2);

    line(x+m*size,y,x+m*size,y+size+2);

    j=(m-n)*16/(n-1);

    for (i = 0; i < n; i++)

    {

        if (i!=0)  k=1;

        else k=0;

        drawmat(a + i * 2*size,size, x+k*j+ i * 15, y+2,charcolor);/*该函数威胁汉字函数在汉字图文件里有说明*/

    }

}

/*画一个不填充的方框

用来分割出工作区域控制区*/

void drawsquare(int left, int top, int right, int bottom,int color)

{

    setcolor(color);

    line(left,top,right,top);

    line(left,top,left,bottom);

    line(right,top,right,bottom);

    line(right,bottom,left,bottom);

}

/*擦除一个方形区域,其实是填充一个方形区域*/

erasesquare(int left, int top, int right, int bottom,int color)

{

    setcolor(color);

    setfillstyle(0,color);

    bar(left,top,right,bottom);

}

/*生成对话框*/

void dialogbox(int left, int top,int outlinecolor,int charcolor)

{

    int right,bottom;

    right=left+144;

    bottom=top+80;

    drawsquare(left,top,right,bottom,outlinecolor);

    drawsquare(left+2,top+30,right-2,bottom-31,outlinecolor);

    button(left+2,top+7,lujing,16,2,3,outlinecolor,charcolor);

    button(left+2,top+53,queding,16,2,3,outlinecolor,charcolor);

    button(right-2-48,top+53,quxiao,16,2,3,outlinecolor,charcolor);

}

/*画窗口*/

void create_win()

{

    int x,y,i;

    x=getmaxx();

    y=getmaxy();

    drawsquare(1,1,x-1,y-1,15);/*画出整个窗口域*/

    line(1,23,x-1,23);

    drawsquare(3,3,x-3,21,15);/*画标题栏*/

    /*写标题*/

    for (i = 0; i < 2; i++)

        drawmat(title1 + i * 32, 16, 5 + i * 15, 5, 10);

    settextstyle(0,0,1);

    outtextxy(37,12,"CAD");

    for (i = 0; i < 2; i++)

        drawmat(title2 + i * 32, 16,  59+ i * 15, 5, 10);

    for (i = 0; i < 2; i++)

        drawmat(title3 + i * 32, 16, 167 + i * 15, 5, 10);

    for (i = 0; i < 2; i++)

        drawmat(title4 + i * 32, 16, 215 + i * 15, 5, 10);

    for (i = 0; i < 2; i++)

        drawmat(title5 + i * 32, 16, 292 + i * 15, 5, 10);

    settextstyle(0,0,1);

    outtextxy(330,12,"tr0217@163.com");

    /*画控制域,并生成控制按钮*/

    drawsquare(3,25,53,y-23,15);

    button(4,26,dakai,16,2,3,15,10);

    button(4,47,zhixian,16,2,3,15,10);

    button(4,68,huxian,16,2,3,15,10);

    button(4,89,quxian,16,2,3,15,10);

    button(4,110,fangxing,16,2,3,15,10);

    button(4,131,yuanxing,16,2,3,15,10);

    button(4,152,duobianxing,16,3,3,15,10);

    button(4,173,xuanzhuan,16,2,3,15,10);

    button(4,194,chexiao,16,2,3,15,10);

    button(4,215,qingping,16,2,3,15,10);

    button(4,236,baocun,16,2,3,15,10);

    button(4,257,tuichu,16,2,3,15,10);

    button(x-125,y-20,coordinate,16,4,4,15,10);/*画出坐标提示*/

    drawsquare(55,25,201,y-23,15);/*画出控制区*/

    /*画控制区提示标题,写标题*/

    line(55,44,201,44);

    i=0;

    drawmat(cao + i * 32, 16, 56 + i * 15,27, 10);

    drawmat(title3 + i * 32, 16, 72 + i * 15,27, 10);

    for (i = 0; i < 2; i++)

        drawmat(tishi + i * 32, 16, 88 + i * 15, 27, 10);

    drawsquare(203,25,x-3,y-23,15);/*画出工作区*/

    /*画工作区提示标题,写标题*/

    line(203,44,x-3,44);

    for (i=0;i<15;i++)

    {

        setfillstyle(1,i+1);

        bar(348+i*12,27,358+i*12,42);

    }

    drawmat(gong , 16, 204,27, 10);

    drawmat(title3 , 16, 220 ,27, 10);

    for (i = 0; i < 2; i++)

        drawmat(qujian + i * 32, 16,236+ i * 15,27, 10);

    line(1,y-21,x-1,y-21);

    line(37,y-21,37,y-1);

    for (i = 0; i < 2; i++)

        drawmat(minling + i * 32, 16, 3 + i * 15, y-18, 10);

}

 

main()

{

    int x,y,i,j,style=0,quit=1,kind,click,color=0,quit0=1;

    int figure[3][2],originx=197,originy=39;

    char X[3],Y[3];

    graph *grh;

    fNode *fhead,fp,fq;

    bfNode *bhead,bp,bq;

    grh=malloc(sizeof(graph));

    /*图形模式初始化*/

    initgraphic();

    x=getmaxx();

    y=getmaxy();

    create_win();

    mousesetY(1,y);

    mousesetX(1,x); /*设置鼠标移动范围*/

    mousesetXY(100,100);

    initmousesquare(style);/*初始化鼠标覆盖区域恢复数组*/

    /*主功能块*/

    while (quit!=0)

    {

        /*如果鼠标在工作区在坐标提示区输出转化后的坐标*/

        if (mouse_in_box(197,39,x-9,y-28))

        {

            /*将坐标整数转化成字符以便输出*/

            itoa(mousex-originx,X, 10);

            itoa(mousey-originy,Y, 10);

            erasesquare(x-58,y-10,x-3,y-2,0);

            setcolor(15);

            settextstyle(0,0,1);

            outtextxy(x-58,y-10,X);

            outtextxy(x-34,y-10,",");

            outtextxy(x-26,y-10,Y);

            delay(450);

        }

        else erasesquare(x-58,y-10,x-3,y-2,0);

        quit0=bioskey(2);

        /*保持鼠标存在状态*/

        InitMouse();

        /*判断鼠标是否移动,若移动则恢复鼠标原来覆盖区域,并保存鼠标当前覆盖区域*/

        if (mousemove())

        {

            mouseback();

            mouseon();

            initmousesquare();

        }

        /*判断鼠标是否在工作区域,若在,则显示工作状态鼠标,否则显示控制状态鼠标*/

        if (mouse_in_box(197,39,x-9,y-28))

            style=1;

        else  style=0;

        mouseshow(11,style);/*显示鼠标*/

        /*如果鼠标在打开或保存按钮区内并左击,初始化对话框区域并,弹出对话框*/

        if ((mouse_in_box(4,26,52,43)||mouse_in_box(4,236,52,253))&&leftpress())

        {

            erasesquare(56,46,200,y-25,0);

            erasesquare(269,26,318,43,0);

            dialogbox(56,46,15,10);

        }

        /*如果鼠标在对话框,左击保存钮,清除工作区,关闭对话框*/

        else if ((mouse_in_box(57,99,106,115))&&leftpress())

        {

            erasesquare(204,45,x-4,y-24,0);

            erasesquare(269,26,318,43,0);

            erasemousesquare(0);

            erasesquare(56,46,200,y-25,0);

            click=0;

        }

        /*鼠标在对话框,左击取消钮,不清除工作区,关闭对话框*/

        else if ((mouse_in_box(151,99,199,115))&&leftpress())

        {

            erasesquare(269,26,318,43,0);

            erasemousesquare(0);

            erasesquare(56,46,200,y-25,0);

        }

        /*选择清屏命令,清除工作区*/

        else if ((mouse_in_box(4,215,52,233))&&leftpress())

        {

            erasesquare(204,45,x-4,y-24,0);

            click=0;

        }

        else if ((mouse_in_box(4,236,53,253))&&leftpress());

        /*选择退出命令,将循环控制量置否*/

        else if ((mouse_in_box(4,256,53,274))&&leftpress())

            quit=0;

        /*鼠标选择基本图形元素命令,将图形元素表示量初始化,并给出提示*/

        if ((mouse_in_box(4,47,52,65))&&leftpress())

        {

            erasesquare(56,46,200,y-25,0);

            erasesquare(271,26,321,43,0);

            button(271,26,zhixian,16,2,3,15,10);

            kind=1;

            click=0;

        }

        else if ((mouse_in_box(4,67,52,86))&&leftpress())

        {

            erasesquare(56,46,200,y-25,0);

            erasesquare(271,26,321,43,0);

            button(271,26,huxian,16,2,3,15,10);

            kind=2;

            click=0;

        }

        else if ((mouse_in_box(4,89,52,107))&&leftpress())

        {

            erasesquare(56,46,200,y-25,0);

            erasesquare(271,26,321,43,0);

            button(271,26,quxian,16,2,3,15,10);

            kind=3;

            click=0;

        }

        else if ((mouse_in_box(4,110,52,129))&&leftpress())

        {

            erasesquare(56,46,200,y-25,0);

            erasesquare(271,26,321,43,0);

            button(271,26,fangxing,16,2,3,15,10);

            kind=4;

            click=0;

        }

        else if ((mouse_in_box(4,131,52,150))&&leftpress())

        {

            erasesquare(56,46,200,y-25,0);

            erasesquare(271,26,321,43,0);

            button(271,26,yuanxing,16,2,3,15,10);

            kind=5;

            click=0;

        }

        else if ((mouse_in_box(4,152,52,171))&&leftpress())

        {

            erasesquare(56,46,200,y-25,0);

            erasesquare(271,26,321,43,0);

            button(271,26,duobianxing,16,3,3,15,10);

            kind=6;

            click=0;

        }

        else if ((mouse_in_box(4,173,52,192))&&leftpress())

        {

            erasesquare(56,46,200,y-25,0);

            erasesquare(271,26,321,43,0);

            button(271,26,tingzhi,16,2,3,15,10);

            kind=7;

            click=0;

        }

        /*颜色控制命令*/

        if (mouse_in_box(348,27,358,42)&&leftpress())   color=1;

        else if (mouse_in_box(360,27,370,42)&&leftpress())   color=2;

        else if (mouse_in_box(372,27,382,42)&&leftpress())   color=3;

        else if (mouse_in_box(384,27,394,42)&&leftpress())   color=4;

        else if (mouse_in_box(396,27,406,42)&&leftpress())   color=5;

        else if (mouse_in_box(408,27,418,42)&&leftpress())   color=6;

        else if (mouse_in_box(420,27,430,42)&&leftpress())   color=7;

        else if (mouse_in_box(432,27,442,42)&&leftpress())   color=8;

        else if (mouse_in_box(444,27,454,42)&&leftpress())   color=9;

        else if (mouse_in_box(456,27,466,42)&&leftpress())   color=10;

        else if (mouse_in_box(468,27,478,42)&&leftpress())   color=11;

        else if (mouse_in_box(480,27,490,42)&&leftpress())   color=12;

        else if (mouse_in_box(492,27,502,42)&&leftpress())   color=13;

        else if (mouse_in_box(504,27,514,42)&&leftpress())   color=14;

        else if (mouse_in_box(516,27,526,42)&&leftpress())   color=15;

        /*根据命令作图*/

        switch (kind)

        {

        case 0:

            break;

        case 1:

            if (mouse_in_box(203,44,x-3,y-22)&&leftpress())

            {

                setcolor(0);

                if (click==0)

                {

                    figure[0][0]=mousex,figure[0][1]=mousey;

                    figure[1][0]=mousex;

                    figure[1][1]=mousey;

                    figure[2][0]=mousex;

                    figure[2][1]=mousey;

                }

                figure[1][0]=figure[2][0],figure[1][1]=figure[2][1];

                line(figure[0][0],figure[0][1],figure[1][0],figure[1][1]);

                figure[2][0]=mousex,figure[2][1]=mousey;

                setcolor(color);

                line(figure[0][0],figure[0][1],figure[2][0],figure[2][1]);

                if (click<3) {

                    click++;

                }

            }

            break;

        case 2:

            if (mouse_in_box(203,44,x-5,y-28)&&leftpress())

                ;

            break;

        case 3:

            if (mouse_in_box(203,44,x-5,y-28)&&leftpress())

                ;

            break;

        case 4:

            if (mouse_in_box(203,44,x-3,y-22)&&leftpress())

            {

                if (click==0)

                {

                    figure[0][0]=mousex,figure[0][1]=mousey;

                    figure[1][0]=mousex;

                    figure[1][1]=mousey;

                    figure[2][0]=mousex;

                    figure[2][1]=mousey;

                }

                figure[1][0]=figure[2][0],figure[1][1]=figure[2][1];

                drawsquare(figure[0][0],figure[0][1],figure[1][0],figure[1][1],0);

                figure[2][0]=mousex,figure[2][1]=mousey;

                drawsquare(figure[0][0],figure[0][1],figure[2][0],figure[2][1],color);

                if (click<3) {

                    click++;

                }

            }

            break;

        case 5:

            if (mouse_in_box(203,44,x-3,y-22)&&leftpress())

            {

                setcolor(0);

                if (click==0)

                {

                    figure[0][0]=mousex,figure[0][1]=mousey;

                    figure[1][0]=mousex;

                    figure[1][1]=mousey;

                    figure[2][0]=mousex;

                    figure[2][1]=mousey;

                }

                figure[1][0]=figure[2][0],figure[1][1]=figure[2][1];

                bresenham_circle(figure[0][0],figure[0][1],\

                                 sqrt((figure[1][0]-figure[0][0])*\

                                      (figure[1][0]-figure[0][0])+(figure[1][1]-figure[0][1])*\

                                      (figure[1][1]-figure[0][1])),203,44,x-3,y-22);

                figure[2][0]=mousex,figure[2][1]=mousey;

                setcolor(color);

                bresenham_circle(figure[0][0],figure[0][1],\

                                 sqrt((figure[2][0]-figure[0][0])*\

                                      (figure[2][0]-figure[0][0])+(figure[2][1]-figure[0][1])*\

                                      (figure[2][1]-figure[0][1])),203,44,x-3,y-22);

                if (click<3) {

                    click++;

                }

            }

            break;

        case 6:

            if (mouse_in_box(203,44,x-5,y-28)&&leftpress())

                ;

            break;

        }

    }

   

    closegraph();

    system("cls");

   

    return 0;

}

char.h文件

#ifndef CHAR_H_

#define CHAR_H_

char title1[]={

    /* 以下是 '微' 的 16点阵楷体_GB2312 字模,32 byte */

    0x22,0x10,0x32,0x18,0x2A,0x90,0x4A,0xA0,

    0xAF,0xBE,0x30,0x64,0x2F,0xA4,0x60,0x24,

    0xA7,0xA4,0x24,0x94,0x24,0x94,0x24,0x88,

    0x24,0xD4,0x28,0xA4,0x30,0x46,0x20,0x84,

    /* 以下是 '型' 的 16点阵隶书 字模,32 byte */

    0x00,0x04,0x7F,0x84,0x12,0x24,0x12,0x24,

    0xFF,0xE4,0x12,0x24,0x12,0x24,0x22,0x24,

    0x22,0x04,0x41,0x14,0x01,0x08,0x3F,0xFC,

    0x01,0x00,0x01,0x00,0xFF,0xFE,0x00,0x00,

};

char title2[]={

    /* 以下是 '系' 的 16点阵隶书 字模,32 byte */

    0x00,0x7C,0x3F,0x80,0x02,0x20,0x04,0x20,

    0x08,0x40,0x1F,0x80,0x03,0x20,0x0C,0x10,

    0x3F,0xF8,0x10,0x8C,0x04,0xA0,0x08,0x90,

    0x10,0x88,0x20,0x84,0x42,0x84,0x01,0x00,

    /* 以下是 '统' 的 16点阵隶书 字模,32 byte */

    0x10,0x40,0x10,0x20,0x23,0xFE,0x20,0x40,

    0x44,0x40,0xF8,0x88,0x09,0x04,0x13,0xFE,

    0x20,0x94,0x7C,0x90,0x00,0x90,0x00,0x90,

    0x1D,0x12,0xE1,0x12,0x02,0x0E,0x04,0x00,

};

char title3[]={

    /* 以下是 '作' 的 16点阵隶书 字模,32 byte */

    0x08,0x80,0x0C,0x80,0x09,0x00,0x13,0xFE,

    0x12,0x80,0x34,0x88,0x50,0xFC,0x90,0x80,

    0x10,0x80,0x10,0x84,0x10,0xFE,0x10,0x80,

    0x10,0x80,0x10,0x80,0x10,0x80,0x10,0x80,

    /* 以下是 '者' 的 16点阵隶书 字模,32 byte */

    0x01,0x00,0x01,0x08,0x3F,0xEC,0x01,0x10,

    0x01,0x20,0x7F,0xFE,0x00,0x80,0x03,0x00,

    0x07,0xF8,0x1C,0x08,0xE4,0x08,0x07,0xF8,

    0x04,0x08,0x04,0x08,0x07,0xF8,0x04,0x08,

};

char title4[]={

/* 以下是 '某' 的 16点阵隶书 字模,32 byte */

  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

  0x04,0x40,0x1F,0xF8,0x07,0xC0,0x04,0x40,

  0x07,0xC0,0x7F,0xFF,0x61,0x0E,0x0D,0x60,

  0x19,0x10,0x01,0x08,0x00,0x00,0x00,0x00,

/* 以下是 '人' 的 16点阵隶书 字模,32 byte */

  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

  0x01,0x00,0x01,0x00,0x01,0x00,0x03,0x00,

  0x03,0x80,0x06,0x60,0x0C,0x30,0x18,0x1C,

  0x70,0x0F,0x00,0x06,0x00,0x00,0x00,0x00,

};

char title5[]={

    /* 以下是 '邮' 的 16点阵隶书 字模,32 byte */

    0x08,0x00,0x08,0x7E,0x08,0x44,0x7F,0x48,

    0x49,0x48,0x49,0x50,0x49,0x48,0x7F,0x44,

    0x49,0x42,0x49,0x42,0x49,0x42,0x7F,0x5A,

    0x41,0x44,0x00,0x40,0x00,0x40,0x00,0x40,

    /* 以下是 '箱' 的 16点阵隶书 字模,32 byte */

    0x20,0x40,0x3F,0x7E,0x28,0x50,0x44,0x88,

    0x89,0x08,0x08,0xFC,0x08,0x84,0x7E,0x84,

    0x18,0xFC,0x1C,0x84,0x2A,0x84,0x2A,0xFC,

    0x48,0x84,0x88,0x84,0x08,0xFC,0x08,0x84,

};

char minling[]={

    /* 以下是 '命' 的 16点阵隶书 字模,32 byte */

    0x01,0x00,0x02,0x80,0x04,0x40,0x08,0x20,

    0x10,0x18,0x2F,0xEE,0xC0,0x04,0x3E,0xF8,

    0x22,0x88,0x22,0x88,0x22,0x88,0x3E,0x88,

    0x22,0xB8,0x20,0x90,0x00,0x80,0x00,0x80,

    /* 以下是 '令' 的 16点阵隶书 字模,32 byte */

    0x01,0x00,0x01,0x00,0x02,0x80,0x02,0x40,

    0x04,0x20,0x09,0x18,0x30,0x8E,0xC0,0x14,

    0x1F,0xF8,0x00,0x10,0x00,0x20,0x04,0x40,

    0x02,0x80,0x01,0x80,0x00,0xC0,0x00,0x80,

};

char cao[]={

    /* 以下是 '操' 的 16点阵隶书 字模,32 byte */

    0x21,0xF8,0x21,0x08,0x21,0xF8,0xF8,0x00,

    0x23,0xBC,0x22,0xA4,0x2A,0xA4,0x33,0xBC,

    0x60,0x40,0xA7,0xFE,0x20,0x60,0x20,0xD0,

    0x21,0x48,0x22,0x4E,0xAC,0x44,0x40,0x40,

};

char tishi[]={

    /* 以下是 '提' 的 16点阵隶书 字模,32 byte */

    0x10,0x00,0x11,0xF8,0x11,0x08,0xFD,0xF8,

    0x11,0x08,0x11,0xF8,0x18,0x00,0x37,0xFC,

    0x50,0x40,0x92,0x40,0x12,0x7C,0x12,0x40,

    0x16,0x40,0x15,0xC0,0x58,0x7E,0x20,0x00,

    /* 以下是 '示' 的 16点阵隶书 字模,32 byte */

    0x00,0x00,0x1F,0xF8,0x00,0x00,0x00,0x00,

    0x00,0x00,0x7F,0xFE,0x01,0x00,0x01,0x00,

    0x11,0x20,0x11,0x10,0x21,0x08,0x41,0x0C,

    0x81,0x04,0x01,0x00,0x05,0x00,0x02,0x00,

};

char file[]={

    /* 以下是 '文' 的 16点阵隶书 字模,32 byte */

    0x02,0x00,0x01,0x00,0x01,0x00,0xFF,0xFE,

    0x08,0x20,0x08,0x20,0x08,0x20,0x04,0x40,

    0x04,0x40,0x02,0x80,0x01,0x00,0x02,0x80,

    0x04,0x60,0x18,0x1E,0xE0,0x08,0x00,0x00,

    /* 以下是 '件' 的 16点阵隶书 字模,32 byte */

    0x10,0x40,0x1A,0x40,0x13,0x40,0x32,0x40,

    0x23,0xFC,0x64,0x40,0xA4,0x40,0x28,0x40,

    0x2F,0xFE,0x20,0x40,0x20,0x40,0x20,0x40,

    0x20,0x40,0x20,0x40,0x20,0x40,0x20,0x40,

};

char dakai[]={

    /* 以下是 '打' 的 16点阵隶书 字模,32 byte */

    0x10,0x00,0x10,0x00,0x13,0xFE,0x10,0x20,

    0xFE,0x20,0x10,0x20,0x14,0x20,0x18,0x20,

    0x30,0x20,0xD0,0x20,0x10,0x20,0x10,0x20,

    0x10,0x20,0x10,0x20,0x50,0xA0,0x20,0x40,

    /* 以下是 '开' 的 16点阵隶书 字模,32 byte */

    0x00,0x00,0x7F,0xFE,0x04,0x20,0x04,0x20,

    0x04,0x20,0x04,0x20,0xFF,0xFE,0x04,0x20,

    0x04,0x20,0x04,0x20,0x08,0x20,0x08,0x20,

    0x10,0x20,0x20,0x20,0x40,0x20,0x00,0x00,

};

char baocun[]={

    /* 以下是 '保' 的 16点阵隶书 字模,32 byte */

    0x10,0x00,0x1B,0xF8,0x12,0x08,0x22,0x08,

    0x32,0x08,0x63,0xF8,0xA0,0x40,0x2F,0xFE,

    0x20,0xE0,0x21,0x60,0x21,0x50,0x22,0x58,

    0x24,0x4E,0x28,0x44,0x20,0x40,0x00,0x00,

    /* 以下是 '存' 的 16点阵隶书 字模,32 byte */

    0x03,0x00,0x02,0x00,0x7F,0xFC,0x04,0x00,

    0x04,0x00,0x0B,0xF8,0x18,0x10,0x10,0x20,

    0x30,0x20,0x57,0xFE,0x90,0x20,0x10,0x20,

    0x10,0x20,0x10,0x20,0x10,0xA0,0x10,0x40,

};

char shanguang[]={

    /* 以下是 '闪' 的 16点阵隶书 字模,32 byte */

    0x20,0x00,0x13,0xFC,0x10,0x04,0x40,0x04,

    0x41,0x04,0x41,0x04,0x41,0x04,0x41,0x04,

    0x42,0x84,0x42,0x44,0x44,0x24,0x58,0x24,

    0x40,0x04,0x40,0x04,0x40,0x14,0x40,0x08,

    /* 以下是 '光' 的 16点阵隶书 字模,32 byte */

    0x01,0x00,0x21,0x10,0x19,0x18,0x0D,0x10,

    0x09,0x20,0x01,0x04,0x7F,0xFE,0x04,0x40,

    0x04,0x40,0x04,0x40,0x04,0x40,0x08,0x42,

    0x08,0x42,0x10,0x42,0x20,0x3E,0x40,0x00,

};

char xuanzhuan[]={

    /* 以下是 '旋' 的 16点阵隶书 字模,32 byte */

    0x20,0x80,0x10,0x80,0x10,0xFE,0xFD,0x00,

    0x22,0x00,0x21,0xFE,0x3C,0x24,0x25,0x20,

    0x25,0x20,0x25,0x3C,0x25,0x20,0x45,0x20,

    0x45,0xA0,0xAA,0x60,0x12,0x1E,0x04,0x00,

    /* 以下是 '转' 的 16点阵隶书 字模,32 byte */

    0x10,0x20,0x10,0x20,0x20,0x20,0xFE,0xFC,

    0x20,0x40,0x50,0x40,0x91,0xFE,0xFE,0x40,

    0x10,0x80,0x11,0xFC,0x3C,0x08,0xD0,0x88,

    0x10,0x50,0x10,0x20,0x10,0x10,0x10,0x10,

};

char yuanxing[]={

    /* 以下是 '圆' 的 16点阵隶书 字模,32 byte */

    0x7F,0xFC,0x40,0x04,0x4F,0xE4,0x48,0x24,

    0x4F,0xE4,0x40,0x04,0x4F,0xE4,0x48,0x24,

    0x49,0x24,0x49,0x24,0x49,0x24,0x42,0x84,

    0x44,0x44,0x48,0x24,0x7F,0xFC,0x40,0x04,

    /* 以下是 '形' 的 16点阵隶书 字模,32 byte */

    0x00,0x04,0x7F,0x86,0x12,0x0C,0x12,0x10,

    0x12,0x20,0x12,0x08,0xFF,0xCC,0x12,0x18,

    0x12,0x20,0x12,0x44,0x12,0x86,0x12,0x0C,

    0x22,0x10,0x22,0x20,0x42,0x40,0x80,0x80,

};

char zhixian[]={

    /* 以下是 '直' 的 16点阵隶书 字模,32 byte */

    0x01,0x00,0x01,0x00,0x7F,0xFC,0x02,0x00,

    0x1F,0xF0,0x10,0x10,0x10,0x10,0x1F,0xF0,

    0x10,0x10,0x1F,0xF0,0x10,0x10,0x1F,0xF0,

    0x10,0x10,0x10,0x10,0xFF,0xFE,0x00,0x00,

    /* 以下是 '线' 的 16点阵隶书 字模,32 byte */

    0x10,0x40,0x18,0x50,0x10,0x4C,0x20,0x48,

    0x23,0xFC,0x48,0x40,0xF8,0x40,0x13,0xFE,

    0x20,0x40,0x7C,0x48,0x00,0x30,0x00,0x22,

    0x1C,0xD2,0xE3,0x0A,0x00,0x06,0x00,0x02,

};

char huxian[]={

    /* 以下是 '弧' 的 16点阵隶书 字模,32 byte */

    0x00,0x00,0xF8,0x3C,0x0B,0xD0,0x0A,0x50,

    0x0A,0x50,0x7A,0x50,0x42,0x50,0x42,0x50,

    0xFA,0x48,0x4A,0x48,0x0A,0x48,0x0A,0x54,

    0x0A,0x74,0x2A,0xD6,0x14,0x44,0x08,0x00,

    /* 以下是 '线' 的 16点阵隶书 字模,32 byte */

    0x10,0x40,0x18,0x50,0x10,0x4C,0x20,0x48,

    0x23,0xFC,0x48,0x40,0xF8,0x40,0x13,0xFE,

    0x20,0x40,0x7C,0x48,0x00,0x30,0x00,0x22,

    0x1C,0xD2,0xE3,0x0A,0x00,0x06,0x00,0x02,

};

char quxian[]={

    /* 以下是 '曲' 的 16点阵隶书 字模,32 byte */

    0x04,0x40,0x04,0x40,0x04,0x40,0x3F,0xFC,

    0x24,0x44,0x24,0x44,0x24,0x44,0x24,0x44,

    0x3F,0xFC,0x24,0x44,0x24,0x44,0x24,0x44,

    0x24,0x44,0x3F,0xFC,0x20,0x04,0x00,0x00,

    /* 以下是 '线' 的 16点阵隶书 字模,32 byte */

    0x10,0x40,0x18,0x50,0x10,0x4C,0x20,0x48,

    0x23,0xFC,0x48,0x40,0xF8,0x40,0x13,0xFE,

    0x20,0x40,0x7C,0x48,0x00,0x30,0x00,0x22,

    0x1C,0xD2,0xE3,0x0A,0x00,0x06,0x00,0x02,

};

char fangxing[]={

    /* 以下是 '方' 的 16点阵隶书 字模,32 byte */

    0x02,0x00,0x01,0x00,0x00,0x80,0xFF,0xFE,

    0x02,0x00,0x02,0x00,0x03,0xF0,0x02,0x10,

    0x04,0x10,0x04,0x10,0x08,0x10,0x08,0x10,

    0x10,0x10,0x20,0x90,0xC0,0x60,0x00,0x00,

    /* 以下是 '形' 的 16点阵隶书 字模,32 byte */

    0x00,0x04,0x7F,0x86,0x12,0x0C,0x12,0x10,

    0x12,0x20,0x12,0x08,0xFF,0xCC,0x12,0x18,

    0x12,0x20,0x12,0x44,0x12,0x86,0x12,0x0C,

    0x22,0x10,0x22,0x20,0x42,0x40,0x80,0x80,

};

char duobianxing[]={

    /* 以下是 '多' 的 16点阵隶书 字模,32 byte */

    0x01,0x00,0x01,0xF8,0x02,0x08,0x04,0x10,

    0x0B,0x20,0x10,0xC0,0x03,0x00,0x0C,0x80,

    0x71,0xFE,0x02,0x04,0x0D,0x08,0x30,0x90,

    0x00,0x60,0x01,0x80,0x0E,0x00,0x70,0x00,

    /* 以下是 '边' 的 16点阵隶书 字模,32 byte */

    0x40,0x80,0x20,0x80,0x30,0x80,0x20,0x80,

    0x07,0xF8,0x00,0x88,0xF0,0x88,0x10,0x88,

    0x11,0x08,0x11,0x08,0x12,0x08,0x14,0x70,

    0x10,0x20,0x28,0x00,0x47,0xFE,0x00,0x00,

    /* 以下是 '形' 的 16点阵隶书 字模,32 byte */

    0x00,0x04,0x7F,0x86,0x12,0x0C,0x12,0x10,

    0x12,0x20,0x12,0x08,0xFF,0xCC,0x12,0x18,

    0x12,0x20,0x12,0x44,0x12,0x86,0x12,0x0C,

    0x22,0x10,0x22,0x20,0x42,0x40,0x80,0x80,

};

char tuoyuan[]={

    /* 以下是 '椭' 的 16点阵隶书 字模,32 byte */

    0x20,0x10,0x27,0x90,0x24,0xFE,0xFD,0x10,

    0x25,0x20,0x76,0x3C,0x6D,0x64,0xA4,0xBC,

    0xA4,0xA4,0x24,0xA4,0x26,0xBC,0x25,0x24,

    0x24,0x24,0x24,0x24,0x24,0x2C,0x24,0x24,

    /* 以下是 '圆' 的 16点阵隶书 字模,32 byte */

    0x7F,0xFC,0x40,0x04,0x4F,0xE4,0x48,0x24,

    0x4F,0xE4,0x40,0x04,0x4F,0xE4,0x48,0x24,

    0x49,0x24,0x49,0x24,0x49,0x24,0x42,0x84,

    0x44,0x44,0x48,0x24,0x7F,0xFC,0x40,0x04,

};

char gong[]={

    /* 以下是 '工' 的 16点阵隶书 字模,32 byte */

    0x00,0x00,0x3F,0xFC,0x01,0x00,0x01,0x00,

    0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,

    0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,

    0x01,0x00,0xFF,0xFE,0x00,0x00,0x00,0x00,

};

char qujian[]={

    /* 以下是 '区' 的 16点阵隶书 字模,32 byte */

    0x00,0x00,0x7F,0xFC,0x40,0x20,0x40,0x30,

    0x48,0x20,0x46,0x40,0x41,0x40,0x40,0x80,

    0x41,0x40,0x42,0x20,0x44,0x30,0x48,0x18,

    0x50,0x10,0x7F,0xFC,0x00,0x00,0x00,0x00,

    /* 以下是 '间' 的 16点阵隶书 字模,32 byte */

    0x20,0x00,0x13,0xFC,0x10,0x04,0x40,0x04,

    0x47,0xE4,0x44,0x24,0x44,0x24,0x47,0xE4,

    0x44,0x24,0x44,0x24,0x47,0xE4,0x40,0x04,

    0x40,0x04,0x40,0x04,0x40,0x14,0x40,0x08,

};

char queding[]={

    /* 以下是 '确' 的 16点阵宋体 字模,32 byte */

    0x00,0x80,0x00,0xFC,0x7C,0x88,0x11,0x10,

    0x13,0xFC,0x21,0x24,0x3D,0x24,0x65,0xFC,

    0xA5,0x24,0x25,0x24,0x25,0xFC,0x3D,0x24,

    0x22,0x24,0x22,0x24,0x04,0x14,0x08,0x08,

    /* 以下是 '定' 的 16点阵宋体 字模,32 byte */

    0x02,0x00,0x01,0x00,0x3F,0xFE,0x20,0x04,

    0x40,0x08,0x1F,0xF0,0x01,0x00,0x11,0x00,

    0x11,0x00,0x11,0xF0,0x11,0x00,0x29,0x00,

    0x25,0x00,0x43,0x00,0x81,0xFC,0x00,0x00,

};

char quxiao[]={

    /* 以下是 '取' 的 16点阵宋体 字模,32 byte */

    0x00,0x00,0xFF,0x80,0x22,0x7E,0x22,0x44,

    0x3E,0x44,0x22,0x44,0x22,0x44,0x3E,0x28,

    0x22,0x28,0x22,0x90,0x27,0x10,0x3A,0x28,

    0xC2,0x46,0x02,0x84,0x02,0x00,0x02,0x00,

    /* 以下是 '消' 的 16点阵宋体 字模,32 byte */

    0x20,0x40,0x10,0x40,0x12,0x44,0x81,0x48,

    0x49,0x50,0x4B,0xFC,0x12,0x04,0x12,0x04,

    0x23,0xFC,0x22,0x04,0xE2,0x04,0x23,0xFC,

    0x22,0x04,0x22,0x04,0x22,0x14,0x22,0x08,

};

char  lujing[]={

    /* 以下是 '路' 的 16点阵宋体 字模,32 byte */

    0x00,0x80,0x78,0x80,0x48,0xFC,0x49,0x88,

    0x4A,0x48,0x7C,0x50,0x50,0x20,0x10,0x58,

    0x5D,0x86,0x53,0xFC,0x51,0x08,0x51,0x08,

    0x5D,0x08,0xE1,0xF8,0x01,0x08,0x00,0x00,

    /* 以下是 '径' 的 16点阵宋体 字模,32 byte */

    0x10,0x00,0x1B,0xF8,0x20,0x10,0x40,0x20,

    0x90,0x40,0x18,0xB0,0x33,0x0C,0x6C,0x06,

    0xA7,0xFC,0x20,0x40,0x20,0x40,0x20,0x40,

    0x20,0x40,0x20,0x40,0x2F,0xFE,0x20,0x00,

};

char tuichu[]={

    /* 以下是 '退' 的 16点阵隶书 字模,32 byte */

    0x40,0x00,0x27,0xF0,0x24,0x10,0x07,0xF0,

    0x04,0x10,0x04,0x10,0xE7,0xF0,0x24,0x88,

    0x24,0x50,0x24,0x20,0x25,0x10,0x26,0x18,

    0x24,0x08,0x50,0x00,0x8F,0xFE,0x00,0x00,

    /* 以下是 '出' 的 16点阵隶书 字模,32 byte */

    0x01,0x00,0x01,0x00,0x21,0x04,0x21,0x04,

    0x21,0x04,0x21,0x04,0x3F,0xFC,0x21,0x04,

    0x01,0x00,0x21,0x04,0x21,0x04,0x21,0x04,

    0x21,0x04,0x3F,0xFC,0x20,0x04,0x00,0x00,

};

char shengcheng[]={

    /* 以下是 '生' 的 16点阵隶书 字模,32 byte */

    0x00,0x80,0x10,0xC0,0x10,0x80,0x10,0x88,

    0x1F,0xFC,0x20,0x80,0x20,0x80,0x40,0x88,

    0x9F,0xFC,0x00,0x80,0x00,0x80,0x00,0x80,

    0x00,0x80,0x00,0x84,0x7F,0xFE,0x00,0x00,

    /* 以下是 '成' 的 16点阵隶书 字模,32 byte */

    0x00,0xA0,0x00,0x90,0x00,0x80,0x3F,0xFE,

    0x20,0x80,0x20,0x80,0x3E,0x88,0x22,0x8C,

    0x22,0x48,0x22,0x50,0x22,0x20,0x2A,0x60,

    0x44,0x92,0x41,0x0A,0x86,0x06,0x00,0x02,

};

char coordinate[]={

    /* 以下是 '当' 的 16点阵隶书 字模,32 byte */

    0x00,0x80,0x10,0x90,0x08,0x98,0x0C,0x90,

    0x08,0xA0,0x00,0x80,0x3F,0xFC,0x00,0x04,

    0x00,0x04,0x1F,0xFC,0x00,0x04,0x00,0x04,

    0x00,0x04,0x3F,0xFC,0x00,0x04,0x00,0x00,

    /* 以下是 '前' 的 16点阵隶书 字模,32 byte */

    0x08,0x10,0x06,0x18,0x04,0x20,0xFF,0xFE,

    0x00,0x00,0x3E,0x08,0x22,0x48,0x3E,0x48,

    0x22,0x48,0x22,0x48,0x3E,0x48,0x22,0x48,

    0x22,0x48,0x2A,0x08,0x24,0x28,0x00,0x10,

    /* 以下是 '坐' 的 16点阵隶书 字模,32 byte */

    0x01,0x00,0x01,0x00,0x11,0x10,0x11,0x10,

    0x11,0x10,0x29,0x10,0x25,0x28,0x45,0x44,

    0x81,0x80,0x01,0x00,0x3F,0xF8,0x01,0x00,

    0x01,0x00,0x01,0x00,0xFF,0xFE,0x00,0x00,

    /* 以下是 '标' 的 16点阵隶书 字模,32 byte */

    0x10,0x00,0x11,0xFC,0x10,0x00,0x10,0x00,

    0xFC,0x00,0x13,0xFE,0x38,0x20,0x34,0x20,

    0x55,0x28,0x51,0x24,0x92,0x26,0x14,0x22,

    0x10,0x22,0x10,0x20,0x10,0xA0,0x10,0x40,

};

char qingping[]={

    /* 以下是 '清' 的 16点阵宋体 字模,32 byte */

    0x40,0x40,0x23,0xFC,0x20,0x40,0x0B,0xFC,

    0x88,0x40,0x57,0xFC,0x50,0x00,0x13,0xF8,

    0x22,0x08,0x23,0xF8,0xE2,0x08,0x23,0xF8,

    0x22,0x08,0x22,0x08,0x22,0x28,0x22,0x10,

    /* 以下是 '屏' 的 16点阵宋体 字模,32 byte */

    0x3F,0xFC,0x20,0x04,0x20,0x04,0x3F,0xFC,

    0x24,0x10,0x22,0x20,0x2F,0xFC,0x22,0x20,

    0x22,0x20,0x3F,0xFE,0x22,0x20,0x22,0x20,

    0x44,0x20,0x44,0x20,0x88,0x20,0x10,0x20,

};

char chexiao[]={

    /* 以下是 '撤' 的 16点阵宋体 字模,32 byte */

    0x22,0x10,0x21,0x18,0x2F,0xD0,0xF2,0x20,

    0x24,0xBE,0x2F,0xC4,0x28,0x44,0x37,0xA4,

    0x64,0xA8,0xA7,0xA8,0x24,0x90,0x27,0x90,

    0x24,0xA8,0x24,0xA6,0xA5,0xC4,0x44,0x80,

    /* 以下是 '消' 的 16点阵宋体 字模,32 byte */

    0x20,0x40,0x10,0x40,0x12,0x44,0x81,0x48,

    0x49,0x50,0x4B,0xFC,0x12,0x04,0x12,0x04,

    0x23,0xFC,0x22,0x04,0xE2,0x04,0x23,0xFC,

    0x22,0x04,0x22,0x04,0x22,0x14,0x22,0x08,

};

char tingzhi[]={

    /* 以下是 '停' 的 16点阵宋体 字模,32 byte */

    0x08,0x40,0x0C,0x20,0x0B,0xFE,0x10,0x00,

    0x11,0xF8,0x31,0x08,0x51,0xF8,0x90,0x00,

    0x17,0xFE,0x14,0x02,0x11,0xFC,0x10,0x20,

    0x10,0x20,0x10,0x20,0x10,0xA0,0x10,0x40,

    /* 以下是 '止' 的 16点阵宋体 字模,32 byte */

    0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,

    0x08,0x80,0x08,0x80,0x08,0xFC,0x08,0x80,

    0x08,0x80,0x08,0x80,0x08,0x80,0x08,0x80,

    0x08,0x80,0x08,0x80,0xFF,0xFE,0x00,0x00,

};

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);

}

#endif

 

  评论这张
 
阅读(574)| 评论(0)
推荐 转载

历史上的今天

在LOFTER的更多文章

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2017