+
+
+/*
+The implementation would work like this:
+ zoom level method
+ 0 2 chars/pixel, 1 is "[]", 0 is " ".
+ 1 2 pixels/char 2x1, using " " "," "'" "|"
+ 2 8 pixels/char 4x2, using 16x16 table
+ 3 32 pixels/char 8x4, mapped into (2)
+ 4 and up similar, mapped into (2)
+
+The 16x16 table maps a 4x2 pattern into a printing ascii character which
+most closely approximates that pattern, e.g. the pattern
+ |'
+ ''
+would be represented by the character "[". I have such a table worked out.
+
+Grainer zoom levels would take the rule of reducing it into a smaller bitmap,
+or-ing the bits together. (e.g. level 3 would take a 2x2 chunk and map it
+into a single pixel: 0 if all 4 are 0, 1 otherwise.) These pixels would be
+displayed as in 2.
+*/
+
+/*
+ * graphtab: a table for rudimentary graphics on ordinary terminals.
+ * For each 4x2 bit pattern of the form:
+ * ae
+ * bf
+ * cg
+ * dh
+ * form the 4 bit quantities abcd and efgh and get table entry
+ * graphtab[abcd][efgh]
+ * to display in that character position.
+ *
+ * General philosophies: the dh bits are intended for descenders where
+ * possible. Characters with radically different appearance on different
+ * terminals (e.g. _ and ^) are avoided.
+ *
+ * Version 1.0, March 1981, Mark Horton.
+ */
+
+char tab1[4] = {
+ ' ', ',', '\'', '|'
+};
+
+char graphtab[16][16] = {
+' ', '.', '.', ',', '.', ';', ':', 'j', '\'', ':', ':', ';', '\'', ';', '!', '|',
+'.', '.', ':', ',', ';', ';', ';', 'j', '/', ';', ';', ';', 'j', 'j', 'j', 'j',
+'.', ',', '~', ',', 'r', '<', 'j', 'q', '/', ';', 'I', ';', '/', '|', 'I', '|',
+',', ',', 'r', 'x', '/', '/', '/', 'd', '/', '/', '/', 'd', '/', '/', '/', 'd',
+'.', ':', '\\', ';', '-', '=', 'v', 'q', '\'', ':', '<', '|', '\'', ':', '+', '+',
+';', ';', '>', ';', '=', '=', 'g', 'g', '\'', ':', 'S', 'S', '/', '/', '/', '+',
+':', '\\', '\\', '\\', 'r', '<', 'w', 'q', '/', '<', '6', '4', '/', '/', 'd', '+',
+'l', 'L', '+', 'b', 'y', '[', 'p', 'g', '/', '<', '/', '6', '/', '/', '/', '+',
+'`', ':', ':', ';', '`', '\\', '\\', '\\', '"', ':', ':', ';', '`', '\\', 'Y', 'T',
+';', ';', ';', ';', '`', '2', '>', '\\', ':', '=', ';', ';', '?', '?', ']', ']',
+':', ';', ';', ';', '>', '2', '>', '\\', 'F', ';', 'O', ';', '7', '?', ']', '7',
+';', ';', ';', ';', '?', '2', '>', 'b', ';', ';', ';', ';', '?', '?', ']', '#',
+'\'', '\\', '\\', '\\', '`', '\\', '\\', '\\', '\'', '\'', '<', '5', '"', '"', 'v', 'q',
+';', '\\', '\\', '\\', '`', '=', '\\', '\\', '\'', '\'', '5', '5', '"', '?', 'g', 'g',
+'I', 'L', 'L', 'L', 'D', '\\', 'b', 'f', 'F', '[', '[', '[', 'P', '?', '#', 'M',
+'|', '|', '|', '|', '|', '#', '+', '#', 'T', '[', 'F', 'F', 'P', '?', 'P', 'M'
+};
+
+
+shozoom()
+{
+ register i;
+
+ if (zoom == 0)
+ sho0();
+ else if (zoom == 1)
+ sho1();
+ else if (zoom == 2)
+ sho2();
+}
+
+sho0()
+{
+ register k,l;
+
+ for (k=0; k<H; k++) {
+ for (l=0; l<W; l++)
+ printf("%s", fbit(k,l)?"[]": " ");
+ printf("\n");
+ }
+ printf("\n");
+}
+
+sho1()
+{
+ register i,k,l;
+
+ k = 0;
+ while (k < H) {
+ for(l=0;l<W;l++) {
+ i = fbit(k,l)*2 + fbit(k+1,l);
+ printf("%c",tab1[i]);
+ l++;
+ }
+ printf("\n");
+ k += 2;
+ }
+ printf("\n");
+}
+
+sho2()
+{
+ register i,j,k,l;
+ int line = curline + (base+3)/4;
+ int col;
+
+ k = base%4;
+ if (k > 0) k -= 4;
+ while (k < H) {
+ l = 0;
+ col = curcol;
+ while (l<W) {
+ i = fbit(k,l)*8 + fbit(k+1,l)*4 +
+ fbit(k+2,l)*2 + fbit(k+3,l);
+ l++;
+ j = fbit(k,l)*8 + fbit(k+1,l)*4 +
+ fbit(k+2,l)*2 + fbit(k+3,l);
+
+ if (msgflag) {
+ if (graphtab[i][j] != ' ') {
+ if (line > maxline) maxline = line;
+ if (line < minline) minline = line;
+ if (col > maxcol) maxcol = col;
+ }
+ msgout[line][col] = graphtab[i][j];
+ } else
+ printf("%c",graphtab[i][j]);
+ l++;
+ col++;
+ }
+ if (msgflag == 0)
+ printf("\n");
+ k += 4;
+ line--;
+ }
+ if (msgflag == 0)
+ printf("\n");
+}