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.4 by greg, Thu Dec 19 14:52:09 1991 UTC vs.
Revision 2.5 by greg, Fri Oct 30 09:14:04 1992 UTC

# Line 1 | Line 1
1 + /* Copyright (c) 1992 Regents of the University of California */
2 +
3   #ifndef lint
4 < static char SCCSid[] = "$SunId$ Auckuni";
4 > static char SCCSid[] = "$SunId$ LBL";
5   #endif
6  
7 < /*
6 < *      rad2pict -
7 < *              Convert an Radiance image to APPLE pict format.
7 > /*              Convert an Radiance image to APPLE pict format.
8   *
9   *                      Orginally Iris to PICT by       Paul Haeberli - 1990
10   *                      Hacked into Rad to PICT by Russell Street 1990
# Line 20 | Line 20 | static char SCCSid[] = "$SunId$ Auckuni";
20   */
21  
22   #include <stdio.h>
23 + #ifdef MSDOS
24 + #include <fcntl.h>
25 + #endif
26  
27   #include "pict.h"
28   #include "color.h"
# Line 97 | Line 100 | char **argv;
100      int xsize, ysize;
101      int i, picsize;
102      int ssizepos, lsizepos;
103 <
103 > #ifdef MSDOS
104 >    extern int  _fmode;
105 >    _fmode = O_BINARY;
106 >    setmode(fileno(stdin), O_BINARY);
107 >    setmode(fileno(stdout), O_BINARY);
108 > #endif
109      progname = argv[0];
110  
111      for (i = 1; i < argc ; i++)
112 <        if (argv[i][0] ==  '-')
112 >        if (argv[i][0] ==  '-')
113              switch (argv[i][1]) {
114                  case 'g':       gamma = atof(argv[++i]);
115                                  break;
# Line 148 | Line 156 | outofparse:
156          
157   #ifdef DEBUG
158          fprintf(stderr, "Input file: %s\n", i <= argc - 1 ? argv[i] : "stdin");
159 <        fprintf(stderr, "Outut file: %s\n", i <= argc - 2 ? argv[i+1] : "stdout" );
159 >        fprintf(stderr, "Outut file: %s\n", i <= argc - 2 ? argv[i+1] : "stdout" );
160          fprintf(stderr, "Gamma: %f\n", gamma);
161          fprintf(stderr, "Brightness adjust: %d\n", bradj);
162 <        fprintf(stderr, "Verbose: %s\n", verbose ? "on" : "off");
162 >        fprintf(stderr, "Verbose: %s\n", verbose ? "on" : "off");
163   #endif
164  
165  
166 <             /* OK. Now we read the size of the Radiance picture */
166 >             /* OK. Now we read the size of the Radiance picture */
167      if (checkheader(stdin, COLRFMT, NULL) < 0 ||
168 <            fgetresolu(&xsize, &ysize, stdin) < 0 /* != (YMAJOR|YDECR) */ ) {
169 <        fprintf(stderr, "%s: not a radiance picture\n", progname);
170 <        exit(1);
168 >            fgetresolu(&xsize, &ysize, stdin) < 0 /* != (YMAJOR|YDECR) */ ) {
169 >        fprintf(stderr, "%s: not a radiance picture\n", progname);
170 >        exit(1);
171          }
172  
173              /* Set the gamma correction */
# Line 170 | Line 178 | outofparse:
178          putbyte(0);
179  
180      ssizepos = outbytes;
181 <    putashort(0);               /* low 16 bits of file size less HEADER_SIZE */
181 >    putashort(0);               /* low 16 bits of file size less HEADER_SIZE */
182      putrect(0,0,xsize,ysize);   /* bounding box of picture */
183      putashort(PICT_picVersion);
184      putashort(0x02ff);          /* version 2 pict */
185      putashort(PICT_reservedHeader);     /* reserved header opcode */
186  
187      lsizepos = outbytes;
188 <    putalong(0);                /* full size of the file */
189 <    putfprect(0,0,xsize,ysize); /* fixed point bounding box of picture */
190 <    putalong(0);                /* reserved */
188 >    putalong(0);                /* full size of the file */
189 >    putfprect(0,0,xsize,ysize); /* fixed point bounding box of picture */
190 >    putalong(0);                /* reserved */
191  
192 <    putashort(PICT_clipRgn);    /* the clip region */
192 >    putashort(PICT_clipRgn);    /* the clip region */
193      putashort(10);
194      putrect(0,0,xsize,ysize);
195  
# Line 236 | Line 244 | int ysize;
244  
245      if(rowbytes&1)
246          rowbytes++;
247 <    putashort(rowbytes|0x8000); /* rowbytes */
247 >    putashort(rowbytes|0x8000); /* rowbytes */
248      putrect(0,0,xsize,ysize);   /* bounds */
249      putashort(0);               /* version */
250  
# Line 285 | Line 293 | FILE *in;
293   char *cbuf;
294   int xsize;
295   {
296 <    extern char *tempbuffer();          /* defined in color.c */
296 >    extern char *tempbuffer();          /* defined in color.c */
297      COLR    *scanin = NULL;
298      int     x;
299  
# Line 295 | Line 303 | int xsize;
303      }
304  
305      if (freadcolrs(scanin, xsize, in) < 0) {
306 <        fprintf(stderr, "%s: read error\n", progname);
307 <        exit(1);
308 <        }
306 >        fprintf(stderr, "%s: read error\n", progname);
307 >        exit(1);
308 >        }
309  
310      if (bradj)      /* Adjust exposure level */
311          shiftcolrs(scanin, xsize, bradj);
# Line 331 | Line 339 | int nbits;
339          ibits += 2;
340          while((ibits<ibitsend)&&((ibits[-2]!=ibits[-1])||(ibits[-1]!=ibits[0])))
341              ibits++;
342 <        if(ibits != ibitsend) {
342 >        if(ibits != ibitsend) {
343              ibits -= 2;
344          }
345          count = ibits-sptr;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines