void openpl(char *s) /* initialize device; s is residue of .PS invocation line */ { double maxw, maxh, ratio = 1; double odeltx = deltx, odelty = delty; hpos = vpos = 0; maxw = getfval("maxpswid"); maxh = getfval("maxpsht"); if (deltx > maxw) { /* shrink horizontal */ ratio = maxw / deltx; deltx *= ratio; delty *= ratio; } if (delty > maxh) { /* shrink vertical */ ratio = maxh / delty; deltx *= ratio; delty *= ratio; } if (ratio != 1) { fprintf(stderr, "pic: %g X %g picture shrunk to", odeltx, odelty); fprintf(stderr, " %g X %g\n", deltx, delty); } space(xmin, ymin, xmax, ymax); printf(".\\\" %g %g %g %g\n", xmin, ymin, xmax, ymax); printf(".\\\" %.3fi %.3fi %.3fi %.3fi\n", xconv(xmin), yconv(ymin), xconv(xmax), yconv(ymax)); printf(".nr 00 \\n(.u\n"); printf(".nf\n"); printf(".PS %.3fi %.3fi %s", yconv(ymin), xconv(xmax), s); /* assumes \n comes as part of s */ }
void closepl(char *PEline) /* clean up after finished */ { movehv(0.0, 0.0); /* get back to where we started */ if (strchr(PEline, 'F') == NULL) { printf(".sp 1+%.3fi\n", yconv(ymin)); } printf("%s\n", PEline); printf(".if \\n(00 .fi\n"); }
void openpl(char *s) /* initialize device */ /* char *s; / * residue of .PS invocation line */ { double maxw, maxh, ratio = 1; double odeltx = deltx, odelty = delty; hpos = vpos = 0; maxw = getfval("maxpswid"); maxh = getfval("maxpsht"); /* if (deltx > getfval("maxpswid") || delty > getfval("maxpsht")) { / * 8.5x11 inches max * / * fprintf(stderr, "pic: %g X %g picture shrunk to", deltx, delty); * maxdelt = max(deltx, delty); * deltx *= 7/maxdelt; / * screwed up anyway; * / * delty *= 7/maxdelt; / * make it 7x7 so someone can see it * / * fprintf(stderr, " %g X %g\n", deltx, delty); * } */ if (deltx > maxw) { /* shrink horizontal */ ratio = maxw / deltx; deltx *= ratio; delty *= ratio; } if (delty > maxh) { /* shrink vertical */ ratio = maxh / delty; deltx *= ratio; delty *= ratio; } if (ratio != 1) { fprintf(stderr, "pic: %g X %g picture shrunk to", odeltx, odelty); fprintf(stderr, " %g X %g\n", deltx, delty); } space(xmin, ymin, xmax, ymax); printf("... %g %g %g %g\n", xmin, ymin, xmax, ymax); printf("... %.3fi %.3fi %.3fi %.3fi\n", xconv(xmin), yconv(ymin), xconv(xmax), yconv(ymax)); printf(".nr 00 \\n(.u\n"); printf(".nf\n"); printf(".PS %.3fi %.3fi %s", yconv(ymin), xconv(xmax), s); /* assumes \n comes as part of s */ }
void closepl(int type) /* clean up after finished */ { movehv(0.0, 0.0); /* get back to where we started */ if (type == 'F') printf(".PF\n"); else { printf(".sp 1+%.3fi\n", yconv(ymin)); printf(".PE\n"); } printf(".if \\n(00 .fi\n"); }
void cont(double x, double y) /* continue line from here to x,y */ { double h1, v1; double dh, dv; h1 = xconv(x); v1 = yconv(y); dh = h1 - hpos; dv = v1 - vpos; hvflush(); printf("\\D'l%.3fi %.3fi'\n", dh, dv); flyback(); /* expensive */ hpos = h1; vpos = v1; }
int iscontained(int gno, double wx, double wy) { int i; double xconv(double x), yconv(double y); double x = xconv(wx), y = yconv(wy); for (i = 0; i < maxgraph; i++) { if (g[i].active == ON) { if ((g[i].v.xv1 <= x && g[i].v.xv2 >= x) && (g[i].v.yv1 <= y && g[i].v.yv2 >= y)) { return i; } } } return gno; }
void cont(double x, double y) /* continue line from here to x,y */ { double h1, v1; double dh, dv; int rh = 0; h1 = xconv(x); v1 = yconv(y); dh = h1 - hpos; dv = v1 - vpos; if (dh > 0 && !dv) { rh = 1; move(x, y); dh = -dh; } hvflush(); printf("\\D'l%.3fi %.3fi'\n", dh, dv); if (rh) move(x, y); flyback(); /* expensive */ hpos = h1; vpos = v1; }
void move(double x, double y) /* go to position x, y in external coords */ { hgoto(xconv(x)); vgoto(yconv(y)); }
move(xi,yi){ movep(xconv(xsc(xi)),yconv(ysc(yi))); return; }
void cont(int x0, int y0) { iline(xnow,ynow,xconv(xsc(x0)),yconv(ysc(y0))); return; }
void line(int x0, int y0, int x1, int y1) { iline(xconv(xsc(x0)),yconv(ysc(y0)),xconv(xsc(x1)),yconv(ysc(y1))); return; }
cont(x0,y0){ iline(xnow,ynow,xconv(xsc(x0)),yconv(ysc(y0))); return; }
line(x0,y0,x1,y1){ iline(xconv(xsc(x0)),yconv(ysc(y0)),xconv(xsc(x1)),yconv(ysc(y1))); return; }