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

Comparing ray/src/px/ra_t16.c (file contents):
Revision 1.13 by greg, Wed Aug 7 08:36:35 1991 UTC vs.
Revision 2.6 by greg, Sat Feb 22 02:07:28 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_t16.c - program to convert between RADIANCE and
6   *              Targa 16, 24 and 32-bit images.
# Line 13 | Line 10 | static char SCCSid[] = "$SunId$ LBL";
10  
11   #include  <stdio.h>
12  
13 + #ifdef MSDOS
14 + #include  <fcntl.h>
15 + #endif
16 +
17 + #include  <time.h>
18 +
19 + #include  <math.h>
20 +
21   #include  "color.h"
22  
23 + #include  "resolu.h"
24 +
25   #include  "random.h"
26  
27   #include  "targa.h"
# Line 32 | Line 39 | static char SCCSid[] = "$SunId$ LBL";
39  
40   extern char     *ecalloc(), *emalloc();
41  
42 < extern double  atof(), pow();
42 > double  gamcor = 2.2;                   /* gamma correction */
43  
37 double  gamma = 2.0;                    /* gamma correction */
38
44   int  bradj = 0;                         /* brightness adjustment */
45  
46   char  *progname;
# Line 50 | Line 55 | char  *argv[];
55          struct hdStruct  head;
56          int  reverse = 0;
57          int  i;
58 <        
58 > #ifdef MSDOS
59 >        extern int  _fmode;
60 >        _fmode = O_BINARY;
61 >        setmode(fileno(stdin), O_BINARY);
62 >        setmode(fileno(stdout), O_BINARY);
63 > #endif
64          progname = argv[0];
65  
66          head.dataBits = 16;
# Line 58 | Line 68 | char  *argv[];
68                  if (argv[i][0] == '-')
69                          switch (argv[i][1]) {
70                          case 'g':
71 <                                gamma = atof(argv[++i]);
71 >                                gamcor = atof(argv[++i]);
72                                  break;
73                          case 'r':
74                                  reverse = !reverse;
# Line 93 | Line 103 | char  *argv[];
103                  quiterr(msg);
104          }
105                                          /* set gamma */
106 <        setcolrgam(gamma);
106 >        setcolrgam(gamcor);
107                                          /* convert */
108          if (reverse) {
109                                          /* get header */
# Line 102 | Line 112 | char  *argv[];
112                  if (!goodpic(&head))
113                          quiterr("incompatible format");
114                                          /* put header */
115 +                newheader("RADIANCE", stdout);
116                  printargs(i, argv, stdout);
117                  fputformat(COLRFMT, stdout);
118                  putchar('\n');
119 <                fputresolu(YMAJOR|YDECR, head.x, head.y, stdout);
119 >                fprtresolu(head.x, head.y, stdout);
120                                          /* convert file */
121                  tg2ra(&head);
122          } else {
123                  if (checkheader(stdin, COLRFMT, NULL) < 0 ||
124 <                        fgetresolu(&head.x, &head.y, stdin) != (YMAJOR|YDECR))
124 >                                fgetresolu(&head.x, &head.y, stdin) < 0)
125                          quiterr("bad picture file");
126                                          /* assign header */
127                  head.textSize = 0;
# Line 162 | Line 173 | char  *err;
173   }
174  
175  
176 + void
177   eputs(s)
178   char *s;
179   {
# Line 169 | Line 181 | char *s;
181   }
182  
183  
184 + void
185   quit(code)
186   int code;
187   {
# Line 279 | Line 292 | struct hdStruct  *hp;
292                  if (fwritecolrs(scanline, hp->x, stdout) < 0)
293                          quiterr("error writing RADIANCE file");
294          }
295 <        free((char *)scanline);
296 <        free((char *)tarData);
295 >        free((void *)scanline);
296 >        free((void *)tarData);
297   }
298  
299  
# Line 328 | Line 341 | struct hdStruct  *hp;
341                                                  /* write out targa data */
342          writetarga(hp, tarData, stdout);
343  
344 <        free((char *)inl);
345 <        free((char *)tarData);
344 >        free((void *)inl);
345 >        free((void *)tarData);
346   }
347  
348  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines