46 |
|
#define string(s) fputs(s, stdout) |
47 |
|
#define flush() fflush(stdout) |
48 |
|
|
49 |
< |
#define GAMMA 2.2 /* exponent for color correction */ |
49 |
> |
#define GAMMA 2.5 /* exponent for color correction */ |
50 |
|
|
51 |
< |
#define NCOLORS 244 /* our color table size */ |
51 |
> |
#define NCOLORS 248 /* our color table size */ |
52 |
|
#define MINPIX 8 /* minimum hardware color */ |
53 |
|
|
54 |
|
#define NCOLS 512 /* maximum # columns for output */ |
56 |
|
#define COMHT 16 /* height of command line */ |
57 |
|
#define COMCW 63 /* maximum chars on command line */ |
58 |
|
|
59 |
< |
static COLR colrmap[256]; /* our color map */ |
59 |
> |
int anewcolr(); |
60 |
|
|
61 |
– |
static COLR colrtbl[NCOLORS]; /* our color table */ |
62 |
– |
|
63 |
– |
static int colres = 64; /* color resolution */ |
64 |
– |
|
61 |
|
int aed_close(), aed_clear(), aed_paintr(), |
62 |
|
aed_getcur(), aed_comout(), aed_errout(); |
63 |
|
|
119 |
|
int x, y; |
120 |
|
{ |
121 |
|
command(FFD); |
122 |
< |
maketab(); /* init color table */ |
123 |
< |
longwait(1); |
122 |
> |
new_ctab(NCOLORS, anewcolr); /* init color table */ |
123 |
> |
flush(); |
124 |
|
} |
125 |
|
|
126 |
|
|
129 |
|
COLOR col; |
130 |
|
int xmin, ymin, xmax, ymax; |
131 |
|
{ |
132 |
< |
command(SEC); /* draw rectangle */ |
133 |
< |
byte(get_pixel(col)+MINPIX); |
132 |
> |
int ndx; |
133 |
> |
|
134 |
> |
ndx = get_pixel(col); /* may call anewcolr() */ |
135 |
> |
command(SEC); /* draw rectangle */ |
136 |
> |
byte(ndx+MINPIX); |
137 |
|
aedsetcap(xmin, ymin+COMHT); |
138 |
|
command(DFR); |
139 |
|
aedcoord(xmax-1, ymax+(-1+COMHT)); |
252 |
|
|
253 |
|
|
254 |
|
static |
255 |
< |
maketab() /* reinitialize the color table */ |
255 |
> |
anewcolr(index, r, g, b) /* enter a color into our table */ |
256 |
> |
int index; |
257 |
> |
int r, g, b; |
258 |
|
{ |
259 |
< |
extern COLR *get_ctab(); |
260 |
< |
register COLR *ctab; |
261 |
< |
register int i; |
262 |
< |
|
263 |
< |
ctab = get_ctab(NCOLORS); /* get colors */ |
264 |
< |
command(SCT); /* set color table */ |
265 |
< |
byte(MINPIX); /* starting index */ |
265 |
< |
byte(NCOLORS&255); /* number of colors (0==256) */ |
266 |
< |
for (i = 0; i < NCOLORS; i++) { |
267 |
< |
byte(ctab[i][RED]); |
268 |
< |
byte(ctab[i][GRN]); |
269 |
< |
byte(ctab[i][BLU]); |
270 |
< |
} |
259 |
> |
command(SCT); |
260 |
> |
byte((index+MINPIX)&255); |
261 |
> |
byte(1); |
262 |
> |
byte(r); |
263 |
> |
byte(g); |
264 |
> |
byte(b); |
265 |
> |
flush(); |
266 |
|
} |
267 |
|
|
268 |
|
|