Le format PCX comporte l'image compactée ainsi que la palette de couleur lors de sa sauvegarde.
Cette routine se limite aux images de 320x200x256c donc ne lui en faite pas charger d'autres !!.
LA ROUTINE DE CHARGEMENT
L'APPEL DE LA ROUTINE


LA ROUTINE DE CHARGEMENT

unsigned char loadpcx(char *name,unsigned char *pal,unsigned char *scrn)
{
long amt,bpos=0;
int i,j;
int pos=0;
unsigned char v,x;
f=fopen(name,"rb");
fseek(f,-768L,SEEK_END);
amt=ftell(f)-128;
fread(pal,1,768,f);
for(i=0;i<768;i++)
{
*(pal+i)=*(pal+i)>>2;
};
fseek(f,128,SEEK_SET);
fread(&buffer_io[0],1,amt,f);
fclose(f);
while(pos<64000) {
v=buffer_io[bpos];
bpos=bpos+1;
if((v&0xC0)==0xC0) {
x=v&0x3F;
v=buffer_io[bpos];
bpos=bpos+1;
while((x--)>0)
{
*(scrn+pos)=v;
pos=pos+1;
};
} else *(scrn+(pos++))=v;
}
return 0;
}


L'APPEL DE LA ROUTINE

static unsigned char pal[768];
static unsigned char buffer_io[64000];
(Déclarer dans Routine.h).

char *name
unsigned char *pal
unsigned char *scrn

Si:
unsigned char pal[768];
unsigned char ecran[64000];
loadpcx("image.pcx",&pal[0],&ecran[0]);