Beispiel #1
0
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 */
}
Beispiel #2
0
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");
}
Beispiel #3
0
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 */
}
Beispiel #4
0
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");
}
Beispiel #5
0
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;
}
Beispiel #6
0
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;
}
Beispiel #7
0
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;
}
Beispiel #8
0
void move(double x, double y)	/* go to position x, y in external coords */
{
	hgoto(xconv(x));
	vgoto(yconv(y));
}
Beispiel #9
0
move(xi,yi){
		movep(xconv(xsc(xi)),yconv(ysc(yi)));
		return;
}
Beispiel #10
0
void
cont(int x0, int y0)
{
	iline(xnow,ynow,xconv(xsc(x0)),yconv(ysc(y0)));
	return;
}
Beispiel #11
0
void
line(int x0, int y0, int x1, int y1)
{
	iline(xconv(xsc(x0)),yconv(ysc(y0)),xconv(xsc(x1)),yconv(ysc(y1)));
		return;
}
Beispiel #12
0
cont(x0,y0){
	iline(xnow,ynow,xconv(xsc(x0)),yconv(ysc(y0)));
	return;
}
Beispiel #13
0
line(x0,y0,x1,y1){
	iline(xconv(xsc(x0)),yconv(ysc(y0)),xconv(xsc(x1)),yconv(ysc(y1)));
		return;
}