home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
GRIPS 2: Government Rast…rocessing Software & Data
/
GRIPS_2.cdr
/
dos
/
seq
/
src
/
palbuild.c
< prev
next >
Wrap
C/C++ Source or Header
|
1990-01-07
|
1KB
|
55 lines
/* paload
*
* Program to create a color palette that can be used by program PALOAD
* to load into the hardware lookup table. Input file required for this
* program are lines in the form :
* entry_No red green blue
*
* Lam Chih Chao Oct, 1987
* National Centre for Supercomputing Applications
* University of Illinois
* This program is in the public domain
*/
#include "stdio.h"
#include <sys/file.h>
char rmap[256],bmap[256],gmap[256];
FILE *fp;
main(argc,argv)
int argc;
char *argv[];
{
register i;
int red,green,blue,entryNo;
if (argc < 2) {
printf("\n Usage: %s file \n",argv[0]);
exit(1);
}
if (NULL == (fp = fopen(argv[1],"w"))) {
puts("Error on palette file open ");
exit(2);
}
while (scanf("%d %d %d %d",&entryNo,&red,&green,&blue) == 4) {
printf ("red %d Green %d Blue %d\n", red, green, blue);
rmap[entryNo] = red;
gmap[entryNo] = green;
bmap[entryNo] = blue;
}
fwrite(rmap,1,256,fp);
fwrite(gmap,1,256,fp);
fwrite(bmap,1,256,fp);
fclose(fp);
}