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

Comparing ray/src/px/ra_pict.c (file contents):
Revision 2.5 by greg, Fri Oct 30 09:14:04 1992 UTC vs.
Revision 2.9 by schorsch, Thu Jun 5 19:29:34 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   /*              Convert an Radiance image to APPLE pict format.
5   *
6   *                      Orginally Iris to PICT by       Paul Haeberli - 1990
# Line 20 | Line 17 | static char SCCSid[] = "$SunId$ LBL";
17   */
18  
19   #include <stdio.h>
20 < #ifdef MSDOS
21 < #include <fcntl.h>
25 < #endif
20 > #include <math.h>
21 > #include  <time.h>
22  
23 + #include "platform.h"
24   #include "pict.h"
25   #include "color.h"
26   #include "resolu.h"
27  
31 extern char     *malloc();
32
28   int     outbytes;                   /* This had better be 32 bits! */
29   char    *progname;
30   int     verbose = 0;
31 < float   gamma = 2.0;
31 > float   gamcor = 2.0;
32   int     bradj = 0;
33  
34          /* First some utility routines */
# Line 100 | Line 95 | char **argv;
95      int xsize, ysize;
96      int i, picsize;
97      int ssizepos, lsizepos;
98 < #ifdef MSDOS
99 <    extern int  _fmode;
100 <    _fmode = O_BINARY;
106 <    setmode(fileno(stdin), O_BINARY);
107 <    setmode(fileno(stdout), O_BINARY);
108 < #endif
98 >        SET_DEFAULT_BINARY();
99 >    SET_FILE_BINARY(stdin);
100 >    SET_FILE_BINARY(stdout);
101      progname = argv[0];
102  
103      for (i = 1; i < argc ; i++)
104          if (argv[i][0] ==  '-')
105              switch (argv[i][1]) {
106 <                case 'g':       gamma = atof(argv[++i]);
106 >                case 'g':       gamcor = atof(argv[++i]);
107                                  break;
108  
109                  case 'e':       if (argv[i+1][0] != '+' && argv[i+1][0] != '-')
# Line 157 | Line 149 | outofparse:
149   #ifdef DEBUG
150          fprintf(stderr, "Input file: %s\n", i <= argc - 1 ? argv[i] : "stdin");
151          fprintf(stderr, "Outut file: %s\n", i <= argc - 2 ? argv[i+1] : "stdout" );
152 <        fprintf(stderr, "Gamma: %f\n", gamma);
152 >        fprintf(stderr, "Gamma: %f\n", gamcor);
153          fprintf(stderr, "Brightness adjust: %d\n", bradj);
154          fprintf(stderr, "Verbose: %s\n", verbose ? "on" : "off");
155   #endif
# Line 172 | Line 164 | outofparse:
164  
165              /* Set the gamma correction */
166  
167 <    setcolrgam(gamma);
167 >    setcolrgam(gamcor);
168  
169      for(i=0; i<HEADER_SIZE; i++)
170          putbyte(0);
# Line 195 | Line 187 | outofparse:
187  
188      if (verbose)
189          fprintf(stderr, "%s: The picture is %d by %d, with a gamma of %f\n",
190 <            progname, xsize, ysize, gamma);
190 >            progname, xsize, ysize, gamcor);
191  
192  
193      putpict(xsize, ysize);      /* Here is where all the work is done */
# Line 223 | Line 215 | int ysize;
215      int     nbytes, rowbytes;
216      char    *cbuf, *pbuf;
217  
218 <    cbuf = malloc(4 * xsize);
218 >    cbuf = (char *)malloc(4 * xsize);
219  
220      if (cbuf == NULL) {
221          fprintf(stderr, "%s: not enough memory\n", progname);
222          exit(1);
223          }
224  
225 <    pbuf = malloc(4 * xsize);
225 >    pbuf = (char *)malloc(4 * xsize);
226  
227      if (pbuf == NULL) {
228          fprintf(stderr, "%s: not enough memory\n", progname);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines