www.pudn.com > c.rar > HZK16.C, change:1996-12-22,size:1234b


#include "stdio.h" 
#include "graphics.h" 
#include "dos.h" 
unsigned char dot[16][2]; 
FILE *fp1; 
void hz_string1(char *s,int x,int y,int m,int n,int col); 
void hz_single1(int x,int y,int m,int n,int col); 
main() 
{ 
char *s="结构设计程序"; 
int m=4,n=6; 
int graphdrive=DETECT,graphmode=0; 
initgraph(&graphdrive,&graphmode,""); 
hz_string1(s,10,200,m,n,2); 
getch(); 
closegraph(); 
} 
 
void hz_string1(char *s,int x,int y,int m,int n,int col) 
{ 
long offset1; 
if((fp1=(fopen("c:\\ucdos\\hzk16","rb")))==NULL) 
  { 
  restorecrtmode(); 
  printf("cannot open the file hzk16\n"); 
  exit(1); 
  } 
while(*s) 
{ 
offset1=(long)((*s+95)*94+(*(s+1)+95))*32; 
fseek(fp1,offset1,SEEK_SET); 
hz_single1(x,y,m,n,col); 
x+=16*n; 
s+=2; 
} 
rewind(fp1); 
fclose(fp1); 
} 
/****************************************************/ 
void hz_single1(int x,int y,int m,int n,int col) 
{ 
register i,j,k,mm,nn,mask; 
for(i=0;i<=15;i++) 
  { 
  for(j=0;j<=1;j++) 
     { 
     dot[i][j]=getc(fp1); 
     mask=0x80; 
     for(k=0;k<=7;k++) 
	{ 
	if(dot[i][j]&mask) 
	    { 
	    for(nn=0;nn<n;nn++) 
	       { 
	       for(mm=0;mm<m;mm++) 
	       putpixel(x+(j*8+k)*n+nn,y+i*m+mm,col); 
	       } 
	} 
	mask=mask>>1; 
     } 
     } 
     } 
}