19 |
|
#include <string.h> |
20 |
|
|
21 |
|
#include "standard.h" |
22 |
+ |
#include "rhdisp.h" |
23 |
|
#include "color.h" |
24 |
|
/* histogram resolution */ |
25 |
|
#define NRED 24 |
52 |
|
/* initial color cube boundary */ |
53 |
|
static int CLRCUBE[3][2] = {{0,NRED},{0,NGRN},{0,NBLU}}; |
54 |
|
|
55 |
< |
static int split(), cut(); |
55 |
> |
static void cut(CNODE *tree, int level, int box[3][2], int c0, int c1); |
56 |
> |
static int split(int box[3][2]); |
57 |
|
|
58 |
|
|
59 |
< |
int |
60 |
< |
new_ctab(ncolors) /* start new color table with max ncolors */ |
61 |
< |
int ncolors; |
59 |
> |
|
60 |
> |
extern int |
61 |
> |
new_ctab( /* start new color table with max ncolors */ |
62 |
> |
int ncolors |
63 |
> |
) |
64 |
|
{ |
65 |
|
int treesize; |
66 |
|
|
88 |
|
} |
89 |
|
|
90 |
|
|
91 |
< |
int |
92 |
< |
get_pixel(rgb, set_pixel) /* get pixel for color */ |
93 |
< |
BYTE rgb[3]; |
94 |
< |
int (*set_pixel)(); |
91 |
> |
extern int |
92 |
> |
get_pixel( /* get pixel for color */ |
93 |
> |
BYTE rgb[3], |
94 |
> |
void (*set_pixel)(int h, int r, int g, int b) |
95 |
> |
) |
96 |
|
{ |
92 |
– |
extern char errmsg[]; |
97 |
|
int r, g, b; |
98 |
|
int cv[3]; |
99 |
|
register CNODE *tp; |
133 |
|
clrtab[h].ent[GRN] = g; /* reassign pixel */ |
134 |
|
clrtab[h].ent[BLU] = b; |
135 |
|
#ifdef DEBUG |
136 |
< |
sprintf(errmsg, "pixel %d = (%d,%d,%d) (%d refs)\n", |
137 |
< |
h, r, g, b, clrtab[h].n); |
138 |
< |
eputs(errmsg); |
136 |
> |
{ |
137 |
> |
extern char errmsg[]; |
138 |
> |
sprintf(errmsg, "pixel %d = (%d,%d,%d) (%d refs)\n", |
139 |
> |
h, r, g, b, clrtab[h].n); |
140 |
> |
eputs(errmsg); |
141 |
> |
} |
142 |
|
#endif |
143 |
|
(*set_pixel)(h, r, g, b); |
144 |
|
} |
146 |
|
} |
147 |
|
|
148 |
|
|
149 |
< |
static |
150 |
< |
cut(tree, level, box, c0, c1) /* partition color space */ |
151 |
< |
register CNODE *tree; |
152 |
< |
int level; |
153 |
< |
register int box[3][2]; |
154 |
< |
int c0, c1; |
149 |
> |
static void |
150 |
> |
cut( /* partition color space */ |
151 |
> |
register CNODE *tree, |
152 |
> |
int level, |
153 |
> |
register int box[3][2], |
154 |
> |
int c0, |
155 |
> |
int c1 |
156 |
> |
) |
157 |
|
{ |
158 |
|
int kb[3][2]; |
159 |
|
|
175 |
|
|
176 |
|
|
177 |
|
static int |
178 |
< |
split(box) /* find median cut for box */ |
179 |
< |
register int box[3][2]; |
178 |
> |
split( /* find median cut for box */ |
179 |
> |
register int box[3][2] |
180 |
> |
) |
181 |
|
{ |
182 |
|
#define c0 r |
183 |
|
register int r, g, b; |