#include "defs.h" /* * Produce a standard drawing grid. * * d = distance (tenths of an inch) between major rulings */ squares(head,d) DL head; { REG INT xx, yy, doti; if(d==0){ rule(head); } else{ clearview(head); mode(PPLOT); for(yy = 0; yy <= 90; yy += 1){ doti=10; if((yy%2)==0) doti=5; if((yy%5)==0) doti=2; if((yy%10)==0) doti=1; for(xx = 0; xx <= 120; xx += doti) wvec(point((xx<<7)+512, yy<<7)); } } } /* * Draw a cross-hatch with a specified distance between lines * and an intersection at a given point. * * p1 and p2 are positions of two intersections * h is header item for redrawing picture if necessary. */ LOC rule(h) DL h; { DL1 p1, p2; REG INT xx, yy, dd; must(cursor(p1)); wchar(p1, '+'); must(cursor(p2)); mode(PPLOT); dd = abs(p1->y - p2->y); if(dd) for(yy = p1->y % dd; yy <= 11520; yy += dd) for(xx = 512; xx <= 15872; xx += 128) wvec(point(xx, yy)); dd = abs(p1->x - p2->x); if (dd && dd != 128) for(xx = (p1->x - 512) % dd + 512; xx <= 15872; xx += dd) for(yy = 0; yy <= 11520; yy += 128) wvec(point(xx, yy)); } /* * redraw the picture if covered with freckles * * head is head addr for current mode */ LOC clearview(head) DL head; { if (!spotless) redraw(head); spotless = 0; }