我想做个24点阵的汉字显示,原本显示不出来,后来上网查了一下原来是24点阵字模横竖方向给倒了过来,我又用了个矩阵倒置的方摆正字模,不料显示是能显示了却不是原来的字了,"中"字变成了"逍",怎么回事?
#include<stdio.h>
#include<graphics.h>
void hanzi16(int x,int y,char *s,int colour)
{
FILE *fp;
char buffer[24][3];
register i,j,k;
unsigned char qh,wh;
unsigned long location;
if((fp=fopen("c:\\hzk24K","rb"))==NULL)
{
printf("can't open hzk16");
getch();
exit(0);
}
/*while(*s)
{ */
qh=*s-0xa0;
wh=*(s+1)-0xa0;
location=(94*(qh-1)+(wh-1))*72L;
fseek(fp,location,SEEK_SET);
fread(buffer,72,1,fp);
for(i=0;i<24;i++)
for(j=0;j<24;j++)
if(buffer[j][i/8]&(0x80>>i%8))
putpixel(x+j,y+i,colour);
/*s+=2;
x+=24;*/
fclose(fp);
}
main()
{
int gd=DETECT,gm;
initgraph(&gd,&gm,"");
hanzi16(246,200,"中",BROWN);
getch();
closegraph();
}