--- ray/src/rt/aed.c 1989/10/02 17:12:34 1.2 +++ ray/src/rt/aed.c 1991/11/12 17:09:19 2.1 @@ -46,35 +46,29 @@ static char SCCSid[] = "$SunId$ LBL"; #define string(s) fputs(s, stdout) #define flush() fflush(stdout) -#define GAMMA 2.2 /* exponent for color correction */ +#define GAMMA 2.5 /* exponent for color correction */ -#define NCOLORS 244 /* our color table size */ +#define NCOLORS 248 /* our color table size */ #define MINPIX 8 /* minimum hardware color */ #define NCOLS 512 /* maximum # columns for output */ -#define NROWS 512-COMHT /* maximum # rows for output */ +#define NROWS 483-COMHT /* maximum # rows for output */ #define COMHT 16 /* height of command line */ #define COMCW 63 /* maximum chars on command line */ -static COLR colrmap[256]; /* our color map */ - -static COLR colrtbl[NCOLORS]; /* our color table */ - -static int colres = 64; /* color resolution */ - int aed_close(), aed_clear(), aed_paintr(), aed_getcur(), aed_comout(), aed_errout(); static struct driver aed_driver = { aed_close, aed_clear, aed_paintr, aed_getcur, - aed_comout, NULL, - NCOLS, NROWS + aed_comout, NULL, NULL, + 1.0, NCOLS, NROWS }; struct driver * -aed_init(name) /* open AED */ -char *name; +aed_init(name, id) /* open AED */ +char *name, *id; { if (ttyset(&aed_driver, fileno(stdin)) < 0) { /* set tty driver */ stderr_v("cannot access terminal\n"); @@ -92,7 +86,7 @@ char *name; byte(BLK); byte(WHT); byte(15); command(SCP); byte('+'); byte(0); byte(1); - make_cmap(GAMMA); /* make color map */ + make_gmap(GAMMA); /* make color map */ errvec = aed_errout; /* set error vector */ cmdvec = aed_errout; if (wrnvec != NULL) @@ -123,8 +117,8 @@ aed_clear(x, y) /* clear AED */ int x, y; { command(FFD); - maketab(); /* init color table */ - longwait(1); + new_ctab(NCOLORS); /* init color table */ + flush(); } @@ -133,8 +127,12 @@ aed_paintr(col, xmin, ymin, xmax, ymax) /* paint a re COLOR col; int xmin, ymin, xmax, ymax; { - command(SEC); /* draw rectangle */ - byte(get_pixel(col)+MINPIX); + extern int anewcolr(); + int ndx; + + ndx = get_pixel(col, anewcolr); /* calls anewcolr() */ + command(SEC); /* draw rectangle */ + byte(ndx+MINPIX); aedsetcap(xmin, ymin+COMHT); command(DFR); aedcoord(xmax-1, ymax+(-1+COMHT)); @@ -253,21 +251,17 @@ int *xp, *yp; static -maketab() /* reinitialize the color table */ +anewcolr(index, r, g, b) /* enter a color into our table */ +int index; +int r, g, b; { - extern COLR *get_ctab(); - register COLR *ctab; - register int i; - - ctab = get_ctab(NCOLORS); /* get colors */ - command(SCT); /* set color table */ - byte(MINPIX); /* starting index */ - byte(NCOLORS&255); /* number of colors (0==256) */ - for (i = 0; i < NCOLORS; i++) { - byte(ctab[i][RED]); - byte(ctab[i][GRN]); - byte(ctab[i][BLU]); - } + command(SCT); + byte((index+MINPIX)&255); + byte(1); + byte(r); + byte(g); + byte(b); + flush(); }