typedef struct {
char PcxFlag ;
char Version ;
char Encoding ;
char Bitsperpixel ;
int Xmin ;
int Ymin ;
int Xmax ;
int Ymax ;
int Hres ;
int Vres ;
char palette[48] ;
char reserved ;
char planes ;
int width ;
int palettetype ;
char filler[58] ;
}PCXHEAD;
void pcx256display(int x,int y,int status, char * name)
{
FILE *phonefp;
unsigned long phonewidth,phoneheigh;
unsigned char phonedata,phoneline[1000];
long phonelen,phonetemp,linebit;
unsigned char ColorTable[256][3] ;
int i,j , m , b[3];
unsigned char data;
int count, total , height ;
PCXHEAD pcxheader;
if((phonefp=fopen(name,"rb"))==NULL){
//printf("cannot open file %s \n",name);
exit(0);
}
fseek( phonefp ,-768L,SEEK_END);
fread( ColorTable , 1 , 768 , phonefp ) ;
fseek( phonefp ,0L,SEEK_SET);
fread( (char *)&pcxheader , sizeof(PCXHEAD), 1, phonefp) ;
height = pcxheader.Ymax - pcxheader.Ymin +1 ;
fseek( phonefp , 128L , SEEK_SET ) ;
//printf("+++++++++++++++++++++++++++++++++%d,%d\n",height,pcxheader.width);
//getch();
if(status)
{
setfillstyle(1,BLACK); //hm_disable
bar(x+pcxheader.width-1,y+6,x+pcxheader.width+4,y+height+4); //hm_disable
bar(x+4,y+height,x+pcxheader.width+4,y+height+4); //hm_disable
}
for( i = 0 ; i<height ; i++)
{
total = 0 ;
while( total < pcxheader.width )
{
count = 1 ;
data = fgetc(phonefp);
if ( 0xc0 == ( 0xc0 & data) )
{
count = 0x3f & data ;
data = fgetc( phonefp );
}
for( j = 0 ; j < count ; j++)
if(j+total!=pcxheader.width-1) putpixel(x+j+total , y+i , data);
total += count ;
}
}
fclose(phonefp);
}