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

Comparing ray/src/px/ra_ppm.c (file contents):
Revision 2.8 by gwlarson, Wed Feb 10 08:43:41 1999 UTC vs.
Revision 2.11 by schorsch, Sun Jul 27 22:12:03 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 Poskanzer Pixmaps
6   */
7  
8   #include  <stdio.h>
12
13 #ifdef MSDOS
14 #include  <fcntl.h>
15 #endif
16
9   #include  <math.h>
18
10   #include  <ctype.h>
11 + #include  <time.h>
12  
13 + #include  "platform.h"
14   #include  "color.h"
22
15   #include  "resolu.h"
16  
17  
26 extern char  *malloc();
27
18   int  agryscan(), bgryscan(), aclrscan(), bclrscan();
19   int  agryscan2(), bgryscan2(), aclrscan2(), bclrscan2();
20   int  normval();
# Line 104 | Line 94 | char  *argv[];
94                  if (read(fileno(stdin), inpbuf, 2) != 2 || inpbuf[0] != 'P')
95                          quiterr("input not a Poskanzer Pixmap");
96                  ptype = inpbuf[1];
97 < #ifdef MSDOS
97 > #ifdef _WIN32
98                  if (ptype > 4)
99 <                        setmode(fileno(stdin), O_BINARY);
100 <                setmode(fileno(stdout), O_BINARY);
99 >                        SET_FILE_BINARY(stdin);
100 >                SET_FILE_BINARY(stdout);
101   #endif
102                  xmax = scanint(stdin);
103                  ymax = scanint(stdin);
# Line 154 | Line 144 | char  *argv[];
144                                  quiterr("unsupported Pixmap type");
145                          }
146          } else {
147 < #ifdef MSDOS
148 <                setmode(fileno(stdin), O_BINARY);
147 > #ifdef _WIN32
148 >                SET_FILE_BINARY(stdin);
149                  if (binflag)
150 <                        setmode(fileno(stdout), O_BINARY);
150 >                        SET_FILE_BINARY(stdout);
151   #endif
152                                          /* get header info. */
153                  if (checkheader(stdin, COLRFMT, NULL) < 0 ||
# Line 212 | Line 202 | int  (*getscan)();
202                          quiterr("error writing Radiance picture");
203          }
204                                                  /* free scanline */
205 <        free((char *)scanout);
205 >        free((void *)scanout);
206   }
207  
208  
# Line 258 | Line 248 | int  binary, grey;
248                          quiterr("error writing Pixmap");
249          }
250                                                  /* free scanline */
251 <        free((char *)scanin);
251 >        free((void *)scanin);
252   }
253  
254  
# Line 279 | Line 269 | int  (*getscan)();
269          for (y = ymax-1; y >= 0; y--) {
270                  if ((*getscan)(scanout, xmax, stdin) < 0)
271                          quiterr("error reading Pixmap");
272 <                for (x = gamcor>1.01|gamcor<0.99?xmax:0; x--; ) {
272 >                for (x = (gamcor>1.01)|(gamcor<0.99)?xmax:0; x--; ) {
273                          colval(scanout[x],RED) =
274                                          pow(colval(scanout[x],RED), gamcor);
275                          colval(scanout[x],GRN) =
# Line 293 | Line 283 | int  (*getscan)();
283                          quiterr("error writing Radiance picture");
284          }
285                                                  /* free scanline */
286 <        free((char *)scanout);
286 >        free((void *)scanout);
287   }
288  
289  
# Line 319 | Line 309 | int  binary, grey;
309                  for (x = grey?xmax:0; x--; )
310                          colval(scanin[x],GRN) = bright(scanin[x]);
311                  d = 1./gamcor;
312 <                for (x = d>1.01|d<0.99?xmax:0; x--; ) {
312 >                for (x = (d>1.01)|(d<0.99)?xmax:0; x--; ) {
313                          colval(scanin[x],GRN) = pow(colval(scanin[x],GRN), d);
314                          if (!grey) {
315                                  colval(scanin[x],RED) =
# Line 357 | Line 347 | int  binary, grey;
347                          quiterr("error writing Pixmap");
348          }
349                                                  /* free scanline */
350 <        free((char *)scanin);
350 >        free((void *)scanin);
351   }
352  
353  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines