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"; |
12 |
|
|
13 |
|
#include <stdio.h> |
14 |
|
|
15 |
+ |
#ifdef MSDOS |
16 |
+ |
#include <fcntl.h> |
17 |
+ |
#endif |
18 |
+ |
|
19 |
+ |
#include <math.h> |
20 |
+ |
|
21 |
|
#include "color.h" |
22 |
|
|
23 |
< |
extern double atof(), pow(); |
23 |
> |
#include "resolu.h" |
24 |
|
|
25 |
< |
double gamma = 2.0; /* gamma correction */ |
25 |
> |
extern char *malloc(); |
26 |
|
|
27 |
+ |
double gamcor = 2.0; /* gamma correction */ |
28 |
+ |
|
29 |
|
int bradj = 0; /* brightness adjustment */ |
30 |
|
|
31 |
|
char *progname; |
43 |
|
{ |
44 |
|
int reverse = 0; |
45 |
|
int i; |
46 |
< |
|
46 |
> |
#ifdef MSDOS |
47 |
> |
extern int _fmode; |
48 |
> |
_fmode = O_BINARY; |
49 |
> |
setmode(fileno(stdin), O_BINARY); |
50 |
> |
setmode(fileno(stdout), O_BINARY); |
51 |
> |
#endif |
52 |
|
progname = argv[0]; |
53 |
|
|
54 |
|
for (i = 1; i < argc; i++) |
55 |
|
if (argv[i][0] == '-') |
56 |
|
switch (argv[i][1]) { |
57 |
|
case 'g': |
58 |
< |
gamma = atof(argv[++i]); |
58 |
> |
gamcor = atof(argv[++i]); |
59 |
|
break; |
60 |
|
case 'r': |
61 |
|
reverse = !reverse; |
71 |
|
else |
72 |
|
break; |
73 |
|
/* set gamma correction */ |
74 |
< |
setcolrgam(gamma); |
74 |
> |
setcolrgam(gamcor); |
75 |
|
|
76 |
|
if (reverse) { |
77 |
|
if (i > argc-1 || i < argc-2) |
91 |
|
printargs(i, argv, rafp); |
92 |
|
fputformat(COLRFMT, rafp); |
93 |
|
putc('\n', rafp); |
94 |
< |
fputresolu(YMAJOR|YDECR, xmax, ymax, rafp); |
94 |
> |
fprtresolu(xmax, ymax, rafp); |
95 |
|
/* convert file */ |
96 |
|
bn2ra(); |
97 |
|
} else { |
106 |
|
} |
107 |
|
/* get header */ |
108 |
|
if (checkheader(rafp, COLRFMT, NULL) < 0 || |
109 |
< |
fgetresolu(&xmax, &ymax, rafp) != (YMAJOR|YDECR)) |
109 |
> |
fgetresolu(&xmax, &ymax, rafp) < 0) |
110 |
|
quiterr("bad RADIANCE format"); |
111 |
|
if (openbarney(argv[i+1], "w") < 0) { |
112 |
|
sprintf(errmsg, "cannot open output \"%s\"", argv[i+1]); |