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.15 by greg, Sat Jun 7 05:09:46 2025 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
10 > *              cc $(CFLAGS) -o ra_skel ra_skel.o -lrtrad -lm
11   *      ra_skel.o:      ../common/color.h ../common/resolu.h
12   *
13   *  If you like to do things the hard way, you can link directly
14   *  to the object files "color.o colrops.o resolu.o header.o" in
15 < *  the common subdirectory instead of using the -lrt library.
15 > *  the common subdirectory instead of using the -lrtrad library.
16   */
17  
18   #include  <stdio.h>
19 + #include  <math.h>
20 + #include  <time.h>
21 + #include  "platform.h"
22   #include  "color.h"
23   #include  "resolu.h"
24  
25 + double  gamcor = 2.2;                   /* gamma correction */
26  
24 double  gamma = 2.2;                    /* gamma correction */
25
27   int  bradj = 0;                         /* brightness adjustment */
28  
28 char  *progname;
29
29   int  xmax, ymax;
30  
31  
# Line 37 | Line 36 | char  *argv[];
36          int  reverse = 0;
37          int  i;
38          
39 <        progname = argv[0];
39 >        fixargv0(argv[0]);
40  
41          for (i = 1; i < argc; i++)
42                  if (argv[i][0] == '-')
43                          switch (argv[i][1]) {
44                          case 'g':               /* gamma correction */
45 <                                gamma = atof(argv[++i]);
45 >                                gamcor = atof(argv[++i]);
46                                  break;
47                          case 'e':               /* exposure adjustment */
48                                  if (argv[i+1][0] != '+' && argv[i+1][0] != '-')
# Line 67 | Line 66 | char  *argv[];
66                  exit(1);
67          }
68          if (i == argc-2 && freopen(argv[i+1], "w", stdout) == NULL) {
69 <                fprintf(stderr, "can't open output \"%s\"\n",
69 >                fprintf(stderr, "%s: can't open output \"%s\"\n",
70                                  progname, argv[i+1]);
71                  exit(1);
72          }
73 <        setcolrgam(gamma);              /* set up gamma correction */
73 >        SET_FILE_BINARY(stdin);
74 >        SET_FILE_BINARY(stdout);
75 >        setcolrgam(gamcor);             /* set up gamma correction */
76          if (reverse) {
77                                          /* get their image resolution */
78                  read_skel_head(&xmax, &ymax);
79                                          /* put our header */
80 +                newheader("RADIANCE", stdout);
81                  printargs(i, argv, stdout);
82                  fputformat(COLRFMT, stdout);
83                  putchar('\n');
# Line 123 | Line 125 | skel2ra()              /* convert 24-bit scanlines to Radiance pic
125                  quiterr("out of memory in skel2ra");
126                                                  /* convert image */
127          for (y = ymax-1; y >= 0; y--) {
128 <                scanout[x][RED] = getc(stdin);
129 <                scanout[x][GRN] = getc(stdin);
130 <                scanout[x][BLU] = getc(stdin);
131 <                if (feof(stdin) || ferror(stdin))
128 >                for (x = 0; x < xmax; x++) {
129 >                        scanout[x][RED] = getc(stdin);
130 >                        scanout[x][GRN] = getc(stdin);
131 >                        scanout[x][BLU] = getc(stdin);
132 >                }
133 >                if (feof(stdin) | ferror(stdin))
134                          quiterr("error reading skel image");
135                                                  /* undo gamma */
136                  gambs_colrs(scanout, xmax);
# Line 136 | Line 140 | skel2ra()              /* convert 24-bit scanlines to Radiance pic
140                          quiterr("error writing Radiance picture");
141          }
142                                                  /* free scanline */
143 <        free((char *)scanout);
143 >        free((void *)scanout);
144   }
145  
146  
# Line 165 | Line 169 | ra2skel()              /* convert Radiance scanlines to 24-bit */
169                          quiterr("error writing skel file");
170          }
171                                                  /* free scanline */
172 <        free((char *)scanin);
172 >        free((void *)scanin);
173   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines