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