Utah Raster Toolkit  9999-git
URT Development version (post-3.1b)
qcrldmap.c
Go to the documentation of this file.
1 /*
2  * qcrldmap.c - Load a color map on the QCR-Z
3  *
4  * Author: John W. Peterson
5  * Computer Science Dept.
6  * University of Utah
7  * Date: Thu Jan 21 1988
8  * Copyright (c) 1988, University of Utah
9  */
10 
11 #include <stdio.h>
12 
14 int argc;
15 char ** argv;
16 {
17  int file_flag = 0, mapflag = 0, map_num, verbose_flag = 0, i;
18  char * filename;
19  FILE * mapfile;
20  unsigned char lut_data[1536];
21  unsigned char * lutptr;
22  int num;
23 
24  if (! scanargs( argc, argv, "% f%-file!s m%-stdmap!d v%-", &file_flag,
25  &filename, &mapflag, &map_num, &verbose_flag ))
26  {
27  fprintf(stderr, "std color maps are: 1=linear, 2=Polaroid 59,\n");
28  fprintf(stderr, " 3=Ektachrome 100, 4=Ektachrome 100 (4K),\n");
29  fprintf(stderr, " 5=Polaroid 59 (4K), 6=Polaroid 809 (4K)\n");
30  exit(-2);
31  }
32 
33  if (mapflag && file_flag)
34  {
35  fprintf(stderr, "qcrldmap: only one of -f or -m\n");
36  exit(-2);
37  }
38 
39  init_qcr( verbose_flag );
40 
41  if (mapflag)
42  {
43  qcr_load_i_luts( map_num );
44  }
45 
46  if (file_flag)
47  {
48  if (! (mapfile = fopen( filename, "r" )))
49  {
50  perror("qcrldmap");
51  exit(-2);
52  }
53 
54  lutptr = lut_data;
55  for (i = 0; i < 3*256; i++)
56  {
57  fscanf( mapfile, "%d", &num );
58  *lutptr++ = (num >> 8) & 0xFF;
59  *lutptr++ = num & 0xFF;
60  }
61  qcr_ld_lut12( lut_data );
62  }
63 }
void main(int argc, char **argv)
Definition: aliastorle.c:121