tc中显示汉字

#include <conio.h>       /*用到了RED宏定义*/
#include <graphics.h>   /*进入图形显示模式*/
char han16S[]={
/* 以下是‘ 汉 ’字的点阵数组,32 byte(利用WIN TC点阵工具生成的,直接复制) */
  0x20,0x00,0x10,0x00,0x17,0xFC,0x02,0x08,
  0x82,0x08,0x49,0x10,0x49,0x10,0x11,0x10,
  0x10,0xA0,0x20,0xA0,0xE0,0x40,0x20,0xA0,
  0x21,0x18,0x26,0x0E,0x28,0x04,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)) 
     putpixel(x+i*8+k,y+j,color);
}
void initGraph()
{
    /* request auto detection */
    int gdriver = DETECT, gmode, errorcode;
    /* initialize graphics mode */
    initgraph(&gdriver, &gmode, "C://Win-TC//projects");
    /* read result of initialization */
    errorcode = graphresult();
    if (errorcode != grOk) /* an error occurred */
    {
        printf("Graphics error: %s/n", grapherrormsg(errorcode));
        printf("ress any key to halt:");
        getch();
        exit(1); /* return with error code */
    }
}
void main(void)
{
    initGraph();
    drawmat(han16S,16,300,250,RED);
    getch();
}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值