#include #include #include #define res 8 int threshold[res][res] = { { 0,128,32,160,8,136,40,168}, { 192,64,224,96,200,72,232,104 }, { 48,176,16,144,56,184,24,152 }, { 240,112,208,80,248,120,216,88 }, { 12,140,44,172,4,132,36,164 }, { 204,76,236,108,196,68,228,100 }, { 60,188,28,156,52,180,20,148 }, { 252,124,220,92,244,116,212,84 } }; main(int ac, char **av) { FILE *infile; Point p; Event ev; register int x, y; if (ac < 2) { fprintf(stderr, "usage: %s filename\n", *av); exit(1); } if (! (infile = fopen(*(av+1), "r"))) { fprintf(stderr, "can't open %s\n", *(av+1)); exit(1); } ac--; av++; xtbinit(0,0, &ac, av, 0); einit(Ekeyboard|Emouse); for (x = 0; x < 248; x++) for (y = 0; y < 248; y++) { int c; p = add(screen.r.min, Pt(y,x)); if ((c = getc(infile)) == EOF) break; if (c <= threshold[x%res][y%res]) point(&screen, p, ~0, S); } while(event(&ev) != Ekeyboard) continue; exit(0); } void ereshaped(Rectangle r) { }