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.5 by greg, Mon Sep 21 12:14:37 1992 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 176 | Line 176 | unkopt:
176          set_io();
177  
178          if (reverse) {
179 + #ifdef MSDOS
180 +                setmode(fileno(stdout), O_BINARY);
181 +                if (format != 'a' && format != 'i')
182 +                        setmode(fileno(fin), O_BINARY);
183 + #endif
184                                          /* get header */
185                  if (header && checkheader(fin, fmtid, stdout) < 0) {
186                          fprintf(stderr, "%s: wrong input format\n", progname);
# Line 194 | Line 199 | unkopt:
199                  fputsresolu(&picres, stdout);   /* always put resolution */
200                  valtopix();
201          } else {
202 + #ifdef MSDOS
203 +                setmode(fileno(fin), O_BINARY);
204 +                if (format != 'a' && format != 'i')
205 +                        setmode(fileno(stdout), O_BINARY);
206 + #endif
207                                                  /* get header */
208                  getheader(fin, checkhead, NULL);
209                  if (wrongformat) {
# Line 244 | Line 254 | char  *line;
254  
255   pixtoval()                              /* convert picture to values */
256   {
257 <        register COLOR  *scanln;
257 >        register COLOR  *scanln;
258          int  dogamma;
259          COLOR  lastc;
260          FLOAT  hv[2];
# Line 299 | Line 309 | pixtoval()                             /* convert picture to values */
309   valtopix()                      /* convert values to a pixel file */
310   {
311          int  dogamma;
312 <        register COLOR  *scanln;
312 >        register COLOR  *scanln;
313          int  y;
314          register int  x;
315  
# Line 343 | Line 353 | getcascii(col, fp)             /* get an ascii color value from f
353   COLOR  col;
354   FILE  *fp;
355   {
356 <        double  vd[3];
356 >        double  vd[3];
357  
358          if (fscanf(fp, "%lf %lf %lf", &vd[0], &vd[1], &vd[2]) != 3)
359                  return(-1);
# Line 356 | Line 366 | getcdouble(col, fp)            /* get a double color value from
366   COLOR  col;
367   FILE  *fp;
368   {
369 <        double  vd[3];
369 >        double  vd[3];
370  
371          if (fread((char *)vd, sizeof(double), 3, fp) != 3)
372                  return(-1);
# Line 410 | Line 420 | getbascii(col, fp)             /* get an ascii brightness value f
420   COLOR  col;
421   FILE  *fp;
422   {
423 <        double  vd;
423 >        double  vd;
424  
425          if (fscanf(fp, "%lf", &vd) != 1)
426                  return(-1);
# Line 423 | Line 433 | getbdouble(col, fp)            /* get a double brightness value
433   COLOR  col;
434   FILE  *fp;
435   {
436 <        double  vd;
436 >        double  vd;
437  
438          if (fread((char *)&vd, sizeof(double), 1, fp) != 1)
439                  return(-1);
# Line 450 | Line 460 | COLOR  col;
460   FILE  *fp;
461   {
462          int  vi;
463 <        double  d;
463 >        double  d;
464  
465          if (fscanf(fp, "%d", &vi) != 1)
466                  return(-1);
# Line 465 | Line 475 | COLOR  col;
475   FILE  *fp;
476   {
477          BYTE  vb;
478 <        double  d;
478 >        double  d;
479  
480          if (fread((char *)&vb, sizeof(BYTE), 1, fp) != 1)
481                  return(-1);
# Line 507 | Line 517 | putcdouble(col, fp)                    /* put a double color to fp */
517   COLOR  col;
518   FILE  *fp;
519   {
520 <        double  vd[3];
520 >        double  vd[3];
521  
522          vd[0] = colval(col,ord[0]);
523          vd[1] = colval(col,ord[1]);
# Line 577 | Line 587 | putbdouble(col, fp)                    /* put a double brightness to fp
587   COLOR  col;
588   FILE  *fp;
589   {
590 <        double  vd;
590 >        double  vd;
591  
592          vd = bright(col);
593          fwrite((char *)&vd, sizeof(double), 1, fp);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines