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

Comparing ray/src/px/ra_bn.c (file contents):
Revision 1.7 by greg, Thu Apr 18 14:35:35 1991 UTC vs.
Revision 2.1 by greg, Tue Nov 12 16:05:07 1991 UTC

# Line 1 | Line 1
1 < /* Copyright (c) 1986 Regents of the University of California */
1 > /* Copyright (c) 1991 Regents of the University of California */
2  
3   #ifndef lint
4   static char SCCSid[] = "$SunId$ LBL";
# Line 14 | Line 14 | static char SCCSid[] = "$SunId$ LBL";
14  
15   #include  "color.h"
16  
17 + #include  "resolu.h"
18 +
19   extern double  atof(), pow();
20  
21   double  gamma = 2.0;                    /* gamma correction */
22  
23 + int  bradj = 0;                         /* brightness adjustment */
24 +
25   char  *progname;
26  
27   char  errmsg[128];
# Line 45 | Line 49 | char  *argv[];
49                          case 'r':
50                                  reverse = !reverse;
51                                  break;
52 +                        case 'e':
53 +                                if (argv[i+1][0] != '+' && argv[i+1][0] != '-')
54 +                                        goto userr;
55 +                                bradj = atoi(argv[++i]);
56 +                                break;
57                          default:
58                                  goto userr;
59                          }
# Line 71 | Line 80 | char  *argv[];
80                  printargs(i, argv, rafp);
81                  fputformat(COLRFMT, rafp);
82                  putc('\n', rafp);
83 <                fputresolu(YMAJOR|YDECR, xmax, ymax, rafp);
83 >                fprtresolu(xmax, ymax, rafp);
84                                          /* convert file */
85                  bn2ra();
86          } else {
# Line 86 | Line 95 | char  *argv[];
95                  }
96                                          /* get header */
97                  if (checkheader(rafp, COLRFMT, NULL) < 0 ||
98 <                        fgetresolu(&xmax, &ymax, rafp) != (YMAJOR|YDECR))
98 >                                fgetresolu(&xmax, &ymax, rafp) < 0)
99                          quiterr("bad RADIANCE format");
100                  if (openbarney(argv[i+1], "w") < 0) {
101                          sprintf(errmsg, "cannot open output \"%s\"", argv[i+1]);
# Line 97 | Line 106 | char  *argv[];
106          }
107          quiterr(NULL);
108   userr:
109 <        fprintf(stderr, "Usage: %s [-g gamma] {input|-} output\n", progname);
101 <        fprintf(stderr, "   or: %s -r [-g gamma] input [output|-]\n",
109 >        fprintf(stderr, "Usage: %s [-g gamma][-e +/-stops] {input|-} output\n",
110                          progname);
111 +        fprintf(stderr, "   or: %s -r [-g gamma][-e +/-stops] input [output|-]\n",
112 +                        progname);
113          exit(1);
114   }
115  
# Line 177 | Line 187 | ra2bn()                                        /* convert radiance to barneyscan */
187          for (j = 0; j < ymax; j++) {
188                  if (freadcolrs(inl, xmax, rafp) < 0)
189                          quiterr("error reading RADIANCE file");
190 +                if (bradj)
191 +                        shiftcolrs(inl, xmax, bradj);
192                  colrs_gambs(inl, xmax);
193                  for (i = 0; i < xmax; i++) {
194                          putc(inl[i][RED], bnfp[0]);
# Line 207 | Line 219 | bn2ra()                                        /* convert barneyscan to radiance */
219                  if (feof(bnfp[0]) || feof(bnfp[1]) || feof(bnfp[2]))
220                          quiterr("error reading barney file");
221                  gambs_colrs(outline, xmax);
222 +                if (bradj)
223 +                        shiftcolrs(outline, xmax, bradj);
224                  if (fwritecolrs(outline, xmax, rafp) < 0)
225                          quiterr("error writing RADIANCE file");
226          }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines