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

Comparing ray/src/px/pvalue.c (file contents):
Revision 2.4 by greg, Fri May 8 11:55:42 1992 UTC vs.
Revision 2.6 by greg, Thu Jul 29 13:36:19 1993 UTC

# Line 1 | Line 1
1 < /* Copyright (c) 1991 Regents of the University of California */
1 > /* Copyright (c) 1992 Regents of the University of California */
2  
3   #ifndef lint
4   static char SCCSid[] = "$SunId$ LBL";
# Line 16 | Line 16 | static char SCCSid[] = "$SunId$ LBL";
16  
17   #include  "resolu.h"
18  
19 < #define  min(a,b)               ((a)<(b)?(a):(b))
19 > #define  min(a,b)               ((a)<(b)?(a):(b))
20  
21 < RESOLU  picres;                 /* resolution of picture */
21 > RESOLU  picres;                 /* resolution of picture */
22  
23   int  uniq = 0;                  /* print only unique values? */
24  
# Line 39 | Line 39 | int  resolution = 1;           /* put/get resolution string? */
39  
40   int  wrongformat = 0;           /* wrong input format? */
41  
42 < double  gamcor = 1.0;           /* gamma correction */
42 > double  gamcor = 1.0;           /* gamma correction */
43  
44   int  ord[3] = {RED, GRN, BLU};  /* RGB ordering */
45   int  rord[4];                   /* reverse ordering */
# Line 127 | Line 127 | char  **argv;
127                                  }
128                                  break;
129                          case 'x':               /* x resolution */
130 +                        case 'X':               /* x resolution */
131                                  resolution = 0;
132                                  if (argv[i][0] == '-')
133                                          picres.or |= XDECR;
134                                  picres.xr = atoi(argv[++i]);
135                                  break;
136                          case 'y':               /* y resolution */
137 +                        case 'Y':               /* y resolution */
138                                  resolution = 0;
139                                  if (argv[i][0] == '-')
140                                          picres.or |= YDECR;
# Line 176 | Line 178 | unkopt:
178          set_io();
179  
180          if (reverse) {
181 + #ifdef MSDOS
182 +                setmode(fileno(stdout), O_BINARY);
183 +                if (format != 'a' && format != 'i')
184 +                        setmode(fileno(fin), O_BINARY);
185 + #endif
186                                          /* get header */
187                  if (header && checkheader(fin, fmtid, stdout) < 0) {
188                          fprintf(stderr, "%s: wrong input format\n", progname);
# Line 194 | Line 201 | unkopt:
201                  fputsresolu(&picres, stdout);   /* always put resolution */
202                  valtopix();
203          } else {
204 + #ifdef MSDOS
205 +                setmode(fileno(fin), O_BINARY);
206 +                if (format != 'a' && format != 'i')
207 +                        setmode(fileno(stdout), O_BINARY);
208 + #endif
209                                                  /* get header */
210                  getheader(fin, checkhead, NULL);
211                  if (wrongformat) {
# Line 244 | Line 256 | char  *line;
256  
257   pixtoval()                              /* convert picture to values */
258   {
259 <        register COLOR  *scanln;
259 >        register COLOR  *scanln;
260          int  dogamma;
261          COLOR  lastc;
262          FLOAT  hv[2];
# Line 299 | Line 311 | pixtoval()                             /* convert picture to values */
311   valtopix()                      /* convert values to a pixel file */
312   {
313          int  dogamma;
314 <        register COLOR  *scanln;
314 >        register COLOR  *scanln;
315          int  y;
316          register int  x;
317  
# Line 343 | Line 355 | getcascii(col, fp)             /* get an ascii color value from f
355   COLOR  col;
356   FILE  *fp;
357   {
358 <        double  vd[3];
358 >        double  vd[3];
359  
360          if (fscanf(fp, "%lf %lf %lf", &vd[0], &vd[1], &vd[2]) != 3)
361                  return(-1);
# Line 356 | Line 368 | getcdouble(col, fp)            /* get a double color value from
368   COLOR  col;
369   FILE  *fp;
370   {
371 <        double  vd[3];
371 >        double  vd[3];
372  
373          if (fread((char *)vd, sizeof(double), 3, fp) != 3)
374                  return(-1);
# Line 410 | Line 422 | getbascii(col, fp)             /* get an ascii brightness value f
422   COLOR  col;
423   FILE  *fp;
424   {
425 <        double  vd;
425 >        double  vd;
426  
427          if (fscanf(fp, "%lf", &vd) != 1)
428                  return(-1);
# Line 423 | Line 435 | getbdouble(col, fp)            /* get a double brightness value
435   COLOR  col;
436   FILE  *fp;
437   {
438 <        double  vd;
438 >        double  vd;
439  
440          if (fread((char *)&vd, sizeof(double), 1, fp) != 1)
441                  return(-1);
# Line 450 | Line 462 | COLOR  col;
462   FILE  *fp;
463   {
464          int  vi;
465 <        double  d;
465 >        double  d;
466  
467          if (fscanf(fp, "%d", &vi) != 1)
468                  return(-1);
# Line 465 | Line 477 | COLOR  col;
477   FILE  *fp;
478   {
479          BYTE  vb;
480 <        double  d;
480 >        double  d;
481  
482          if (fread((char *)&vb, sizeof(BYTE), 1, fp) != 1)
483                  return(-1);
# Line 507 | Line 519 | putcdouble(col, fp)                    /* put a double color to fp */
519   COLOR  col;
520   FILE  *fp;
521   {
522 <        double  vd[3];
522 >        double  vd[3];
523  
524          vd[0] = colval(col,ord[0]);
525          vd[1] = colval(col,ord[1]);
# Line 577 | Line 589 | putbdouble(col, fp)                    /* put a double brightness to fp
589   COLOR  col;
590   FILE  *fp;
591   {
592 <        double  vd;
592 >        double  vd;
593  
594          vd = bright(col);
595          fwrite((char *)&vd, sizeof(double), 1, fp);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines