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

Comparing ray/src/px/ra_pr24.c (file contents):
Revision 2.4 by greg, Wed Sep 23 09:17:53 1992 UTC vs.
Revision 2.11 by schorsch, Thu Jul 3 22:41:44 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   *  program to convert between RADIANCE and 24-bit rasterfiles.
6   */
7  
8   #include  <stdio.h>
9 + #include  <time.h>
10 + #include  <math.h>
11 + #include  <string.h>
12  
13 < #ifdef MSDOS
14 < #include  <fcntl.h>
15 < #endif
16 <
13 > #include  "platform.h"
14   #include  "rasterfile.h"
18
15   #include  "color.h"
20
16   #include  "resolu.h"
17  
18 < extern double  pow();
18 > double  gamcor = 2.2;                   /* gamma correction */
19  
25 extern char  *malloc();
26
27 double  gamma = 2.2;                    /* gamma correction */
28
20   int  bradj = 0;                         /* brightness adjustment */
21  
22   char  *progname;
# Line 40 | Line 31 | char  *argv[];
31          struct rasterfile  head;
32          int  reverse = 0;
33          int  i;
34 < #ifdef MSDOS
35 <        extern int  _fmode;
36 <        _fmode = O_BINARY;
46 <        setmode(fileno(stdin), O_BINARY);
47 <        setmode(fileno(stdout), O_BINARY);
48 < #endif
34 >        SET_DEFAULT_BINARY();
35 >        SET_FILE_BINARY(stdin);
36 >        SET_FILE_BINARY(stdout);
37          progname = argv[0];
38  
39          head.ras_type = RT_STANDARD;
# Line 53 | Line 41 | char  *argv[];
41                  if (argv[i][0] == '-')
42                          switch (argv[i][1]) {
43                          case 'g':
44 <                                gamma = atof(argv[++i]);
44 >                                gamcor = atof(argv[++i]);
45                                  break;
46                          case 'e':
47                                  if (argv[i+1][0] != '+' && argv[i+1][0] != '-')
# Line 80 | Line 68 | char  *argv[];
68                  exit(1);
69          }
70          if (i == argc-2 && freopen(argv[i+1], "w", stdout) == NULL) {
71 <                fprintf(stderr, "can't open output \"%s\"\n",
71 >                fprintf(stderr, "%s: can't open output \"%s\"\n",
72                                  progname, argv[i+1]);
73                  exit(1);
74          }
75 <        setcolrgam(gamma);
75 >        setcolrgam(gamcor);
76          if (reverse) {
77                                          /* get header */
78                  if (fread((char *)&head, sizeof(head), 1, stdin) != 1)
# Line 99 | Line 87 | char  *argv[];
87                                  || head.ras_depth != 24)
88                          quiterr("incompatible format");
89                                          /* put header */
90 +                newheader("RADIANCE", stdout);
91                  printargs(i, argv, stdout);
92                  fputformat(COLRFMT, stdout);
93                  putchar('\n');
# Line 176 | Line 165 | int    pad;
165                          quiterr("error writing Radiance picture");
166          }
167                                                  /* free scanline */
168 <        free((char *)scanout);
168 >        free((void *)scanout);
169   }
170  
171  
# Line 222 | Line 211 | int    pad;
211                          quiterr("error writing rasterfile");
212          }
213                                                  /* free scanline */
214 <        free((char *)scanin);
214 >        free((void *)scanin);
215   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines