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.4 by greg, Thu Dec 17 15:50:13 1992 UTC vs.
Revision 2.11 by greg, Sat Feb 22 02:07:28 2003 UTC

# Line 1 | Line 1
1 /* Copyright (c) 1992 Regents of the University of California */
2
1   #ifndef lint
2 < static char SCCSid[] = "$SunId$ LBL";
2 > static const char       RCSid[] = "$Id$";
3   #endif
6
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 19 | Line 16 | static char SCCSid[] = "$SunId$ LBL";
16   */
17  
18   #include  <stdio.h>
19 + #include  <math.h>
20   #ifdef MSDOS
21   #include  <fcntl.h>
22   #endif
23 + #include  <time.h>
24   #include  "color.h"
25   #include  "resolu.h"
26  
27 < extern char  *malloc();
27 > double  gamcor = 2.2;                   /* gamma correction */
28  
30 double  gamma = 2.2;                    /* gamma correction */
31
29   int  bradj = 0;                         /* brightness adjustment */
30  
31   char  *progname;
# Line 49 | Line 46 | char  *argv[];
46                  if (argv[i][0] == '-')
47                          switch (argv[i][1]) {
48                          case 'g':               /* gamma correction */
49 <                                gamma = atof(argv[++i]);
49 >                                gamcor = atof(argv[++i]);
50                                  break;
51                          case 'e':               /* exposure adjustment */
52                                  if (argv[i+1][0] != '+' && argv[i+1][0] != '-')
# Line 73 | Line 70 | char  *argv[];
70                  exit(1);
71          }
72          if (i == argc-2 && freopen(argv[i+1], "w", stdout) == NULL) {
73 <                fprintf(stderr, "can't open output \"%s\"\n",
73 >                fprintf(stderr, "%s: can't open output \"%s\"\n",
74                                  progname, argv[i+1]);
75                  exit(1);
76          }
# Line 81 | Line 78 | char  *argv[];
78          setmode(fileno(stdin), O_BINARY);
79          setmode(fileno(stdout), O_BINARY);
80   #endif
81 <        setcolrgam(gamma);              /* set up gamma correction */
81 >        setcolrgam(gamcor);             /* set up gamma correction */
82          if (reverse) {
83                                          /* get their image resolution */
84                  read_skel_head(&xmax, &ymax);
85                                          /* put our header */
86 +                newheader("RADIANCE", stdout);
87                  printargs(i, argv, stdout);
88                  fputformat(COLRFMT, stdout);
89                  putchar('\n');
# Line 133 | Line 131 | skel2ra()              /* convert 24-bit scanlines to Radiance pic
131                  quiterr("out of memory in skel2ra");
132                                                  /* convert image */
133          for (y = ymax-1; y >= 0; y--) {
134 <                scanout[x][RED] = getc(stdin);
135 <                scanout[x][GRN] = getc(stdin);
136 <                scanout[x][BLU] = getc(stdin);
137 <                if (feof(stdin) || ferror(stdin))
134 >                for (x = 0; x < xmax; x++) {
135 >                        scanout[x][RED] = getc(stdin);
136 >                        scanout[x][GRN] = getc(stdin);
137 >                        scanout[x][BLU] = getc(stdin);
138 >                }
139 >                if (feof(stdin) | ferror(stdin))
140                          quiterr("error reading skel image");
141                                                  /* undo gamma */
142                  gambs_colrs(scanout, xmax);
# Line 146 | Line 146 | skel2ra()              /* convert 24-bit scanlines to Radiance pic
146                          quiterr("error writing Radiance picture");
147          }
148                                                  /* free scanline */
149 <        free((char *)scanout);
149 >        free((void *)scanout);
150   }
151  
152  
# Line 175 | Line 175 | ra2skel()              /* convert Radiance scanlines to 24-bit */
175                          quiterr("error writing skel file");
176          }
177                                                  /* free scanline */
178 <        free((char *)scanin);
178 >        free((void *)scanin);
179   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines