ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/px/ra_skel.c
(Generate patch)

Comparing ray/src/px/ra_skel.c (file contents):
Revision 2.2 by greg, Thu Dec 19 14:52:19 1991 UTC vs.
Revision 2.12 by schorsch, Thu Jun 5 19:29:34 2003 UTC

# Line 1 | Line 1
1   #ifndef lint
2 < static char SCCSid[] = "$SunId$ LBL";
2 > static const char       RCSid[] = "$Id$";
3   #endif
4
4   /*
5   *  Skeletal 24-bit image conversion program.  Replace "skel"
6   *  in this file with a more appropriate image type identifier.
7   *
8 < *  The Makefile entry should look something like this:
8 > *  The Rmakefile entry should look something like this:
9   *      ra_skel:        ra_skel.o
10   *              cc $(CFLAGS) -o ra_skel ra_skel.o -lrt -lm
11   *      ra_skel.o:      ../common/color.h ../common/resolu.h
# Line 17 | Line 16 | static char SCCSid[] = "$SunId$ LBL";
16   */
17  
18   #include  <stdio.h>
19 + #include  <math.h>
20 + #include  <time.h>
21 +
22 + #include  "platform.h"
23   #include  "color.h"
24   #include  "resolu.h"
25  
26 + double  gamcor = 2.2;                   /* gamma correction */
27  
24 double  gamma = 2.2;                    /* gamma correction */
25
28   int  bradj = 0;                         /* brightness adjustment */
29  
30   char  *progname;
# Line 43 | Line 45 | char  *argv[];
45                  if (argv[i][0] == '-')
46                          switch (argv[i][1]) {
47                          case 'g':               /* gamma correction */
48 <                                gamma = atof(argv[++i]);
48 >                                gamcor = atof(argv[++i]);
49                                  break;
50                          case 'e':               /* exposure adjustment */
51                                  if (argv[i+1][0] != '+' && argv[i+1][0] != '-')
# Line 67 | Line 69 | char  *argv[];
69                  exit(1);
70          }
71          if (i == argc-2 && freopen(argv[i+1], "w", stdout) == NULL) {
72 <                fprintf(stderr, "can't open output \"%s\"\n",
72 >                fprintf(stderr, "%s: can't open output \"%s\"\n",
73                                  progname, argv[i+1]);
74                  exit(1);
75          }
76 <        setcolrgam(gamma);              /* set up gamma correction */
76 >        SET_FILE_BINARY(stdin);
77 >        SET_FILE_BINARY(stdout);
78 >        setcolrgam(gamcor);             /* set up gamma correction */
79          if (reverse) {
80                                          /* get their image resolution */
81                  read_skel_head(&xmax, &ymax);
82                                          /* put our header */
83 +                newheader("RADIANCE", stdout);
84                  printargs(i, argv, stdout);
85                  fputformat(COLRFMT, stdout);
86                  putchar('\n');
# Line 123 | Line 128 | skel2ra()              /* convert 24-bit scanlines to Radiance pic
128                  quiterr("out of memory in skel2ra");
129                                                  /* convert image */
130          for (y = ymax-1; y >= 0; y--) {
131 <                scanout[x][RED] = getc(stdin);
132 <                scanout[x][GRN] = getc(stdin);
133 <                scanout[x][BLU] = getc(stdin);
134 <                if (feof(stdin) || ferror(stdin))
131 >                for (x = 0; x < xmax; x++) {
132 >                        scanout[x][RED] = getc(stdin);
133 >                        scanout[x][GRN] = getc(stdin);
134 >                        scanout[x][BLU] = getc(stdin);
135 >                }
136 >                if (feof(stdin) | ferror(stdin))
137                          quiterr("error reading skel image");
138                                                  /* undo gamma */
139                  gambs_colrs(scanout, xmax);
# Line 136 | Line 143 | skel2ra()              /* convert 24-bit scanlines to Radiance pic
143                          quiterr("error writing Radiance picture");
144          }
145                                                  /* free scanline */
146 <        free((char *)scanout);
146 >        free((void *)scanout);
147   }
148  
149  
# Line 165 | Line 172 | ra2skel()              /* convert Radiance scanlines to 24-bit */
172                          quiterr("error writing skel file");
173          }
174                                                  /* free scanline */
175 <        free((char *)scanin);
175 >        free((void *)scanin);
176   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines