7 |
|
|
8 |
|
#include <stdio.h> |
9 |
|
#include <time.h> |
10 |
+ |
|
11 |
+ |
#include "platform.h" |
12 |
|
#include "color.h" |
13 |
+ |
#include "rtio.h" |
14 |
|
#include "resolu.h" |
15 |
|
|
16 |
|
char *progname; |
14 |
– |
|
17 |
|
int xmax, ymax; |
16 |
– |
|
18 |
|
double thresh = 0.5; /* threshold value */ |
18 |
– |
|
19 |
|
COLR threshclr; |
20 |
|
|
21 |
|
#define abovethresh(c) ((c)[EXP]>threshclr[EXP] || \ |
22 |
|
((c)[EXP]==threshclr[EXP] && (c)[GRN]>threshclr[GRN])) |
23 |
|
|
24 |
+ |
static void quiterr(char *err); |
25 |
+ |
static void ra2hex(void); |
26 |
|
|
27 |
< |
main(argc, argv) |
28 |
< |
int argc; |
29 |
< |
char *argv[]; |
27 |
> |
|
28 |
> |
int |
29 |
> |
main( |
30 |
> |
int argc, |
31 |
> |
char *argv[] |
32 |
> |
) |
33 |
|
{ |
34 |
|
int i; |
35 |
|
|
61 |
|
} |
62 |
|
/* assign threshold color */ |
63 |
|
setcolr(threshclr, thresh, thresh, thresh); |
64 |
+ |
/* binary input */ |
65 |
+ |
SET_FILE_BINARY(stdin); |
66 |
|
/* get our header */ |
67 |
|
if (checkheader(stdin, COLRFMT, NULL) < 0 || |
68 |
|
fgetresolu(&xmax, &ymax, stdin) < 0) |
77 |
|
} |
78 |
|
|
79 |
|
|
80 |
< |
quiterr(err) /* print message and exit */ |
81 |
< |
char *err; |
80 |
> |
static void |
81 |
> |
quiterr( /* print message and exit */ |
82 |
> |
char *err |
83 |
> |
) |
84 |
|
{ |
85 |
|
if (err != NULL) { |
86 |
|
fprintf(stderr, "%s: %s\n", progname, err); |
90 |
|
} |
91 |
|
|
92 |
|
|
93 |
< |
ra2hex() /* convert Radiance scanlines to 4x1 bit hex */ |
93 |
> |
static void |
94 |
> |
ra2hex(void) /* convert Radiance scanlines to 4x1 bit hex */ |
95 |
|
{ |
96 |
|
static char cmap[] = "0123456789ABCDEF"; |
97 |
|
COLR *scanin; |