⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 hanzi24.c.bak

📁 显示24*24点阵汉字的小程序
💻 BAK
字号:
#include <stdio.h> 
#include <graphics.h>
#include <conio.h>
#include <PROCESS.H>

FILE *hzk_p;
void open_hzk(void);
void get_hz(char incode[],char bytes[]);
void dishz(int x,int y,char code[],int color);
void main()
{
 int x=20;
    int y=100;
 char *s="昨日之日不可留,今日之日多烦忧";
 
int driver=DETECT;  //图型模式初始化
 int mode;
    initgraph(&driver,&mode,"j:/bc/bgi");

 open_hzk();

 while (*s!=NULL)
 {
    while (x<640 && (*s!=NULL))
  {
   dishz(x,y,s,LIGHTRED);
   x+=25;
   s+=2;
  }
  x=25;y+=25;//下一行显示
 }
 getch();
 fclose(hzk_p);
 closegraph();
}

void open_hzk()
{

 hzk_p=fopen("j:/BC/WORK/HZK24","rb");
 if (!hzk_p){
    printf("The file HZK16 not exist! Enter to system\n");
      getch();
  closegraph();
  exit(1);
 }
}

void get_hz(char incode[],char bytes[])
{
  unsigned char qh,wh;
  unsigned long offset;
 qh=incode[0]-0xa0;    /*得到区号*/
 wh=incode[1]-0xa0;   /*得到位号*/
 offset=(94*(qh-1)+(wh-1))*72L; /*得到偏移位置*/
 fseek(hzk_p,offset,SEEK_SET); /*移文件指针到要读取的汉字字模处*/
 fread(bytes,72,1,hzk_p);   /*读取 32 个汉字的汉字字模*/
}

void dishz(int x0,int y0,char code[],int color)
{

 int i,j;
 char mat[72];//一个汉字占32字节
 get_hz(code,mat);
 //y=y0;
 for (i=0;i<24;i++)
 {//x=x0;

   for(j=0;j<24;j++)

      {if ((mat[i*3+j/8]&(0x80>>j%8))!=NULL)    putpixel(x0+j,y0+i,color);
     //  ++x;
      }
 // ++y;
 }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -