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.8 by greg, Wed Aug 7 08:36:29 1991 UTC vs.
Revision 2.7 by greg, Sat Feb 22 02:07:27 2003 UTC

# Line 1 | Line 1
1 /* Copyright (c) 1991 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   *  ra_bn.c - program to convert between RADIANCE and barneyscan picture format.
6   *
# Line 12 | Line 9 | static char SCCSid[] = "$SunId$ LBL";
9  
10   #include  <stdio.h>
11  
12 + #ifdef MSDOS
13 + #include  <fcntl.h>
14 + #endif
15 +
16 + #include  <time.h>
17 +
18 + #include  <math.h>
19 +
20   #include  "color.h"
21  
22 < extern double  atof(), pow();
22 > #include  "resolu.h"
23  
24 < double  gamma = 2.0;                    /* gamma correction */
24 > double  gamcor = 2.0;                   /* gamma correction */
25  
26   int  bradj = 0;                         /* brightness adjustment */
27  
# Line 35 | Line 40 | char  *argv[];
40   {
41          int  reverse = 0;
42          int  i;
43 <        
43 > #ifdef MSDOS
44 >        extern int  _fmode;
45 >        _fmode = O_BINARY;
46 >        setmode(fileno(stdin), O_BINARY);
47 >        setmode(fileno(stdout), O_BINARY);
48 > #endif
49          progname = argv[0];
50  
51          for (i = 1; i < argc; i++)
52                  if (argv[i][0] == '-')
53                          switch (argv[i][1]) {
54                          case 'g':
55 <                                gamma = atof(argv[++i]);
55 >                                gamcor = atof(argv[++i]);
56                                  break;
57                          case 'r':
58                                  reverse = !reverse;
# Line 58 | Line 68 | char  *argv[];
68                  else
69                          break;
70                                                  /* set gamma correction */
71 <        setcolrgam(gamma);
71 >        setcolrgam(gamcor);
72  
73          if (reverse) {
74                  if (i > argc-1 || i < argc-2)
# Line 75 | Line 85 | char  *argv[];
85                          quiterr(errmsg);
86                  }
87                                          /* put header */
88 +                newheader("RADIANCE", stdout);
89                  printargs(i, argv, rafp);
90                  fputformat(COLRFMT, rafp);
91                  putc('\n', rafp);
92 <                fputresolu(YMAJOR|YDECR, xmax, ymax, rafp);
92 >                fprtresolu(xmax, ymax, rafp);
93                                          /* convert file */
94                  bn2ra();
95          } else {
# Line 93 | Line 104 | char  *argv[];
104                  }
105                                          /* get header */
106                  if (checkheader(rafp, COLRFMT, NULL) < 0 ||
107 <                        fgetresolu(&xmax, &ymax, rafp) != (YMAJOR|YDECR))
107 >                                fgetresolu(&xmax, &ymax, rafp) < 0)
108                          quiterr("bad RADIANCE format");
109                  if (openbarney(argv[i+1], "w") < 0) {
110                          sprintf(errmsg, "cannot open output \"%s\"", argv[i+1]);
# Line 196 | Line 207 | ra2bn()                                        /* convert radiance to barneyscan */
207                  if (ferror(bnfp[0]) || ferror(bnfp[1]) || ferror(bnfp[2]))
208                          quiterr("error writing Barney files");
209          }
210 <        free((char *)inl);
210 >        free((void *)inl);
211   }
212  
213  
# Line 222 | Line 233 | bn2ra()                                        /* convert barneyscan to radiance */
233                  if (fwritecolrs(outline, xmax, rafp) < 0)
234                          quiterr("error writing RADIANCE file");
235          }
236 <        free((char *)outline);
236 >        free((void *)outline);
237   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines