23 |
|
|
24 |
|
#include "color.h" |
25 |
|
|
26 |
+ |
#include "resolu.h" |
27 |
+ |
|
28 |
|
#include "xraster.h" |
29 |
|
|
30 |
|
#include "view.h" |
37 |
|
|
38 |
|
#define FONTNAME "9x15" /* text font we'll use */ |
39 |
|
|
40 |
< |
#define CTRL(c) ('c'-'@') |
40 |
> |
#define CTRL(c) ((c)-'@') |
41 |
|
|
42 |
|
#define BORWIDTH 5 /* border width */ |
43 |
|
#define BARHEIGHT 25 /* menu bar size */ |
90 |
|
|
91 |
|
extern char *malloc(), *calloc(); |
92 |
|
|
93 |
< |
extern double atof(), pow(), log(); |
93 |
> |
extern double pow(), log(); |
94 |
|
|
95 |
|
|
96 |
|
main(argc, argv) |
367 |
|
return(0); |
368 |
|
switch (*cp) { /* interpret command */ |
369 |
|
case 'q': |
370 |
< |
case CTRL(D): /* quit */ |
370 |
> |
case CTRL('D'): /* quit */ |
371 |
|
quit(0); |
372 |
|
case '\n': |
373 |
|
case '\r': |
437 |
|
free_raster(ourras); |
438 |
|
getras(); |
439 |
|
/* fall through */ |
440 |
< |
case CTRL(R): /* redraw */ |
441 |
< |
case CTRL(L): |
440 |
> |
case CTRL('R'): /* redraw */ |
441 |
> |
case CTRL('L'): |
442 |
|
unmap_rcolors(ourras); |
443 |
|
XClear(wind); |
444 |
|
return(redraw(0, 0, width, height)); |
550 |
|
{ |
551 |
|
register unsigned short *dp; |
552 |
|
register int x, err; |
553 |
< |
int y; |
553 |
> |
int y, errp; |
554 |
|
rgbpixel *inl; |
555 |
|
short *cerr; |
556 |
|
|
564 |
|
for (x = 0; x < xmax; x++) { |
565 |
|
if (!(x&0xf)) |
566 |
|
*++dp = 0; |
567 |
+ |
errp = err; |
568 |
|
err += rgb_bright(&inl[x]) + cerr[x]; |
569 |
|
if (err > 127) |
570 |
|
err -= 255; |
571 |
|
else |
572 |
|
*dp |= 1<<(x&0xf); |
573 |
< |
cerr[x] = err >>= 1; |
573 |
> |
err /= 3; |
574 |
> |
cerr[x] = err + errp; |
575 |
|
} |
576 |
|
} |
577 |
|
free((char *)inl); |