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.6 by greg, Mon Jul 12 12:41:16 1993 UTC vs.
Revision 2.13 by schorsch, Fri Mar 10 19:40:13 2006 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
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 < #ifdef MSDOS
21 < #include  <fcntl.h>
22 < #endif
20 > #include  <time.h>
21 >
22 > #include  "platform.h"
23   #include  "color.h"
24   #include  "resolu.h"
25  
29 extern char  *malloc();
30
26   double  gamcor = 2.2;                   /* gamma correction */
27  
28   int  bradj = 0;                         /* brightness adjustment */
# Line 74 | Line 69 | char  *argv[];
69                  exit(1);
70          }
71          if (i == argc-2 && freopen(argv[i+1], "w", stdout) == NULL) {
72 <                fprintf(stderr, "can't open output \"%s\"\n",
72 >                fprintf(stderr, "%s: can't open output \"%s\"\n",
73                                  progname, argv[i+1]);
74                  exit(1);
75          }
76 < #ifdef MSDOS
77 <        setmode(fileno(stdin), O_BINARY);
83 <        setmode(fileno(stdout), O_BINARY);
84 < #endif
76 >        SET_FILE_BINARY(stdin);
77 >        SET_FILE_BINARY(stdout);
78          setcolrgam(gamcor);             /* set up gamma correction */
79          if (reverse) {
80                                          /* get their image resolution */
81                  read_skel_head(&xmax, &ymax);
82                                          /* put our header */
83 +                newheader("RADIANCE", stdout);
84                  printargs(i, argv, stdout);
85                  fputformat(COLRFMT, stdout);
86                  putchar('\n');
# Line 134 | Line 128 | skel2ra()              /* convert 24-bit scanlines to Radiance pic
128                  quiterr("out of memory in skel2ra");
129                                                  /* convert image */
130          for (y = ymax-1; y >= 0; y--) {
131 <                scanout[x][RED] = getc(stdin);
132 <                scanout[x][GRN] = getc(stdin);
133 <                scanout[x][BLU] = getc(stdin);
134 <                if (feof(stdin) || ferror(stdin))
131 >                for (x = 0; x < xmax; x++) {
132 >                        scanout[x][RED] = getc(stdin);
133 >                        scanout[x][GRN] = getc(stdin);
134 >                        scanout[x][BLU] = getc(stdin);
135 >                }
136 >                if (feof(stdin) | ferror(stdin))
137                          quiterr("error reading skel image");
138                                                  /* undo gamma */
139                  gambs_colrs(scanout, xmax);
# Line 147 | Line 143 | skel2ra()              /* convert 24-bit scanlines to Radiance pic
143                          quiterr("error writing Radiance picture");
144          }
145                                                  /* free scanline */
146 <        free((char *)scanout);
146 >        free((void *)scanout);
147   }
148  
149  
# Line 176 | Line 172 | ra2skel()              /* convert Radiance scanlines to 24-bit */
172                          quiterr("error writing skel file");
173          }
174                                                  /* free scanline */
175 <        free((char *)scanin);
175 >        free((void *)scanin);
176   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines