www.pudn.com > hddlock.rar > HZCALL3.C


//******************************************** 
//文件名:HZCALL3.C 
//功能:1. 函数outhz()判断是否为汉字,若是则将 
//汉字传给函数disp()处理,若是字符则输出 
//   2. 函数disp()调用画点函数输出汉字 
//******************************************** 
#include 
#include"hzku3.h" 
int disp(int,int,unsigned char, 
         unsigned char,int); 
int outhz(int x,int y,char *p,int color) 
{ 
  int oldcolor; 
  oldcolor=getcolor(); 
  setcolor(color); 
  while(*p) 
  { 
    if(((unsigned char)*p>=0xa1&& 
      (unsigned char)*p<=0xfe)&& 
      ((unsigned char)*(p+1)>=0xa1&& 
      (unsigned char)*(p+1)<=0xfe)) 
    { 
      if((x+16-1)>getmaxx()|| 
        (y+16-1)>getmaxy()) 
        return 0; 
      disp(x,y,*p,*(p+1),color); 
      p+=2; 
      x+=16+2; 
      moveto(x,y); 
    } 
    else 
    { 
      char q[2]; 
      moveto(x,y); 
      *q=*p; 
      *(q+1)='\0'; 
      settextstyle(DEFAULT_FONT,HORIZ_DIR,1); 
      outtextxy(x,y+4,q); 
      x+=8+1;  p++; 
    } 
  } 
  setcolor(oldcolor); 
  return 1; 
} 
 
int disp(int left,int top,unsigned char byte1, 
         unsigned char byte2,int color) 
{ 
  unsigned char mark; 
  unsigned k; 
  int y,i,j,m; 
  if((byte1>=0xa1&&byte1<=0xfe)&& 
    (byte2>=0xa1&&byte2<=0xfe)) 
  { 
    k=byte1+byte2*256; 
    for(m=0;sb[m]!=0;m++) 
    { 
      if(k==sb[m]) 
      break; 
    } 
    for(i=0,y=top;i<31;i+=2,y++) 
      for(mark=0x80,j=0;mark>0;mark=mark>>1,j++) 
      { 
        if((buff[m][i]&mark)!=0) 
          putpixel(left+j,y,color); 
        if((buff[m][i+1]&mark)!=0) 
          putpixel(left+j+8,y,color); 
      } 
  } 
  return 1; 
}