1 |
– |
/* Copyright (c) 1992 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 |
|
* |
8 |
|
*/ |
9 |
|
|
10 |
|
#include <stdio.h> |
11 |
< |
|
15 |
< |
#ifdef MSDOS |
16 |
< |
#include <fcntl.h> |
17 |
< |
#endif |
18 |
< |
|
11 |
> |
#include <time.h> |
12 |
|
#include <math.h> |
13 |
|
|
14 |
+ |
#include "platform.h" |
15 |
|
#include "color.h" |
22 |
– |
|
16 |
|
#include "resolu.h" |
17 |
|
|
18 |
< |
extern char *malloc(); |
18 |
> |
double gamcor = 2.0; /* gamma correction */ |
19 |
|
|
27 |
– |
double gamma = 2.0; /* gamma correction */ |
28 |
– |
|
20 |
|
int bradj = 0; /* brightness adjustment */ |
21 |
|
|
22 |
|
char *progname; |
34 |
|
{ |
35 |
|
int reverse = 0; |
36 |
|
int i; |
37 |
< |
#ifdef MSDOS |
38 |
< |
extern int _fmode; |
39 |
< |
_fmode = O_BINARY; |
49 |
< |
setmode(fileno(stdin), O_BINARY); |
50 |
< |
setmode(fileno(stdout), O_BINARY); |
51 |
< |
#endif |
37 |
> |
SET_DEFAULT_BINARY(); |
38 |
> |
SET_FILE_BINARY(stdin); |
39 |
> |
SET_FILE_BINARY(stdout); |
40 |
|
progname = argv[0]; |
41 |
|
|
42 |
|
for (i = 1; i < argc; i++) |
43 |
|
if (argv[i][0] == '-') |
44 |
|
switch (argv[i][1]) { |
45 |
|
case 'g': |
46 |
< |
gamma = atof(argv[++i]); |
46 |
> |
gamcor = atof(argv[++i]); |
47 |
|
break; |
48 |
|
case 'r': |
49 |
|
reverse = !reverse; |
59 |
|
else |
60 |
|
break; |
61 |
|
/* set gamma correction */ |
62 |
< |
setcolrgam(gamma); |
62 |
> |
setcolrgam(gamcor); |
63 |
|
|
64 |
|
if (reverse) { |
65 |
|
if (i > argc-1 || i < argc-2) |
76 |
|
quiterr(errmsg); |
77 |
|
} |
78 |
|
/* put header */ |
79 |
+ |
newheader("RADIANCE", stdout); |
80 |
|
printargs(i, argv, rafp); |
81 |
|
fputformat(COLRFMT, rafp); |
82 |
|
putc('\n', rafp); |
198 |
|
if (ferror(bnfp[0]) || ferror(bnfp[1]) || ferror(bnfp[2])) |
199 |
|
quiterr("error writing Barney files"); |
200 |
|
} |
201 |
< |
free((char *)inl); |
201 |
> |
free((void *)inl); |
202 |
|
} |
203 |
|
|
204 |
|
|
224 |
|
if (fwritecolrs(outline, xmax, rafp) < 0) |
225 |
|
quiterr("error writing RADIANCE file"); |
226 |
|
} |
227 |
< |
free((char *)outline); |
227 |
> |
free((void *)outline); |
228 |
|
} |