--- ray/src/px/ximage.c 1991/05/01 12:40:03 1.30 +++ ray/src/px/ximage.c 1991/12/23 23:20:06 2.3 @@ -23,6 +23,8 @@ static char SCCSid[] = "$SunId$ LBL"; #include "color.h" +#include "resolu.h" + #include "xraster.h" #include "view.h" @@ -35,7 +37,7 @@ static char SCCSid[] = "$SunId$ LBL"; #define FONTNAME "9x15" /* text font we'll use */ -#define CTRL(c) ('c'-'@') +#define CTRL(c) ((c)-'@') #define BORWIDTH 5 /* border width */ #define BARHEIGHT 25 /* menu bar size */ @@ -88,7 +90,7 @@ extern long ftell(); extern char *malloc(), *calloc(); -extern double atof(), pow(), log(); +extern double pow(), log(); main(argc, argv) @@ -365,7 +367,7 @@ XKeyEvent *ekey; return(0); switch (*cp) { /* interpret command */ case 'q': - case CTRL(D): /* quit */ + case CTRL('D'): /* quit */ quit(0); case '\n': case '\r': @@ -435,8 +437,8 @@ XKeyEvent *ekey; free_raster(ourras); getras(); /* fall through */ - case CTRL(R): /* redraw */ - case CTRL(L): + case CTRL('R'): /* redraw */ + case CTRL('L'): unmap_rcolors(ourras); XClear(wind); return(redraw(0, 0, width, height)); @@ -548,7 +550,7 @@ getmono() /* get monochrome data */ { register unsigned short *dp; register int x, err; - int y; + int y, errp; rgbpixel *inl; short *cerr; @@ -562,12 +564,14 @@ getmono() /* get monochrome data */ for (x = 0; x < xmax; x++) { if (!(x&0xf)) *++dp = 0; + errp = err; err += rgb_bright(&inl[x]) + cerr[x]; if (err > 127) err -= 255; else *dp |= 1<<(x&0xf); - cerr[x] = err >>= 1; + err /= 3; + cerr[x] = err + errp; } } free((char *)inl);