home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ARM Club 3
/
TheARMClub_PDCD3.iso
/
hensa
/
graphics
/
sprtools_1
/
c
/
clr_info
< prev
next >
Wrap
Text File
|
1998-04-06
|
2KB
|
72 lines
/************************************************************************
* *
* clear bitmap information *
* *
* Version 2.01 (25-Aug-1993) *
* 2.02 (06-Apr-1998) File opened as binary *
* *
* (C) 1993-8 DEEJ Technology PLC *
* *
************************************************************************/
#include <stdio.h>
#include <string.h>
#include "io.h"
#include "clear.h"
int main(int argc, char** argv)
{
int i,r,g,b;
FILE *file;
clear_hdr hdr;
char creator[256];
if(argc>1 && strcmp(argv[argc-1],"-c")!=0)
file = fopen(argv[argc-1],"rb");
else
file = stdin;
if(file == 0)
{
fprintf(stderr,"Could not open file\n");
return(1);
}
i = 0;
while((creator[i++] = fgetc(file)) > 0);
read_struct(LE, (BYTE*)&hdr, clear_hdr_descr, file);
printf("Creator : %s\n",creator);
printf("Version : %d.%d\n",hdr.version/100,hdr.version%100);
printf("Width, Height : %d,%d\n",hdr.width,hdr.height);
printf("Bits Per Pixel : %d\n",hdr.bpp);
if(argc>1 && strcmp(argv[1],"-c")==0)
{
printf("\n");
if(hdr.bpp>8)
{
fprintf(stderr,"No colour map with BPP > 8\n");
}
else
{
printf("%-10s : %5s %5s %5s\n",
"Colour Map","Red","Green","Blue");
for(i=0; i<(1<<hdr.bpp); i++)
{
r = fgetc(file);
g = fgetc(file);
b = fgetc(file);
printf("%10d : %5d %5d %5d\n",i,r,g,b);
}
}
}
fclose(file);
return(0);
}