typedef struct {
char PcxFlag ;
char Version ;
char Encoding ;
char Bitsperpixel ;
int Xmin ;
int Ymin ;
int Xmax ;
int Ymax ;
int Hres ;
int Vres ;
char palette ;
char reserved ;
char planes ;
int width ;
int palettetype ;
char filler ;
}PCXHEAD;
void pcx256display(int x,int y,int status, char * name)
{
FILE *phonefp;
unsigned long phonewidth,phoneheigh;
unsigned char phonedata,phoneline;
long phonelen,phonetemp,linebit;
unsigned char ColorTable ;
int i,j , m , b;
unsigned char data;
int count, total , height ;
PCXHEAD pcxheader;
if((phonefp=fopen(name,"rb"))==NULL){
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 ) ;
if(status)
{
setfillstyle(1,BLACK);
bar(x+pcxheader.width-1,y+6,x+pcxheader.width+4,y+height+4);
bar(x+4,y+height,x+pcxheader.width+4,y+height+4);
}
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);
}