10 |
|
|
11 |
|
#include <stdio.h> |
12 |
|
|
13 |
+ |
#include <math.h> |
14 |
+ |
|
15 |
|
#include "tiffio.h" |
16 |
|
|
17 |
|
#include "color.h" |
18 |
|
|
19 |
< |
extern double atof(); |
19 |
> |
#include "resolu.h" |
20 |
|
|
21 |
+ |
|
22 |
|
extern char *malloc(), *realloc(); |
23 |
|
|
24 |
|
int lzcomp = 0; /* use Lempel-Ziv compression? */ |
25 |
|
|
26 |
|
int greyscale = 0; /* produce greyscale image? */ |
27 |
|
|
28 |
< |
double gamma = 2.2; /* gamma correction */ |
28 |
> |
double gamcor = 2.2; /* gamma correction */ |
29 |
|
|
30 |
|
int bradj = 0; /* brightness adjustment */ |
31 |
|
|
45 |
|
if (argv[i][0] == '-') |
46 |
|
switch (argv[i][1]) { |
47 |
|
case 'g': |
48 |
< |
gamma = atof(argv[++i]); |
48 |
> |
gamcor = atof(argv[++i]); |
49 |
|
break; |
50 |
|
case 'z': |
51 |
|
lzcomp = !lzcomp; |
69 |
|
else |
70 |
|
break; |
71 |
|
doneopts: |
72 |
< |
setcolrgam(gamma); |
72 |
> |
setcolrgam(gamcor); |
73 |
|
|
74 |
|
if (reverse) |
75 |
|
if (i != argc-2 && i != argc-1) |
139 |
|
if (outf != NULL && strcmp(outf, "-") && |
140 |
|
freopen(outf, "w", stdout) == NULL) |
141 |
|
quiterr("cannot open Radiance output file"); |
142 |
+ |
newheader("RADIANCE", stdout); |
143 |
|
fputs(progname, stdout); |
144 |
|
if (bradj) |
145 |
|
printf(" -e %+d", bradj); |
146 |
|
fputs(" -r\n", stdout); |
147 |
|
fputformat(COLRFMT, stdout); |
148 |
|
putchar('\n'); |
149 |
< |
fputresolu(YDECR|YMAJOR, xmax, ymax, stdout); |
149 |
> |
fprtresolu((int)xmax, (int)ymax, stdout); |
150 |
|
/* convert image */ |
151 |
|
if (nsamps == 1) |
152 |
|
pconfig = 1; |
208 |
|
if (strcmp(inpf, "-") && freopen(inpf, "r", stdin) == NULL) |
209 |
|
quiterr("cannot open Radiance input file"); |
210 |
|
if (checkheader(stdin, COLRFMT, NULL) < 0 || |
211 |
< |
fgetresolu(&xmax, &ymax, stdin) != (YDECR|YMAJOR)) |
211 |
> |
fgetresolu(&xmax, &ymax, stdin) < 0) |
212 |
|
quiterr("bad Radiance picture"); |
213 |
|
/* open TIFF file */ |
214 |
|
if ((tif = TIFFOpen(outf, "w")) == NULL) |