Beispiel #1
0
/*
 * hboxte_	(same as hboxtext_)
 */
void hboxte_(
	float	*x, float *y, float *l, float  *h,
	char	*s,
	int	*length,
	int	len)
{
	char		buf[BUFSIZ];
	register char   *p;

	strncpy(buf, s, len);
	buf[*length] = 0;

	hboxtext(*x, *y, *l, *h, buf);
}
Beispiel #2
0
/*
 * display all the hershey fonts and demonstrate textang
 */
main()
{
	char	buf[50];
	char	*str1 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" ;
	char	*str2 = "abcdefghijklmnopqrstuvwxyz" ;
	char	*str3 = "1234567890+-=!@#$%^&*(){}[]" ;
	char	*str4 = "<>,./?~`\\|_BONK,blark" ;
	int	i;
	short	val;

	vinit("mswin");
	winopen("circtxt");

	hleftjustify(1);

	unqdevice(INPUTCHANGE);
	qdevice(KEYBD);
	/* 
	 * Wait for REDRAW event ...
	 */
	while (qread(&val) != REDRAW)
		;

	color(BLACK);
	clear();

	ortho2(-14.0, 14.0, -14.0, 14.0);	/* define the world space */

	for(i = 0; i < 22; i++) {

		/*
		 * textang is used to specify the orientation of text. As
		 * we want the title to come out straight we make sure it is
		 * zero each time we go through this loop.
		 */
		htextang(0.0);

		/*
		 * do the title
		 */
		color(YELLOW);
		hfont("futura.m");
		sprintf(buf, "This is hershey font %s", fonts[i]);
		hboxtext(-11.0, 12.0, 20.0, 1.0, buf);

		/*
		 * draw a box around the title
		 */
		rect(-11.0, 12.0, 9.0, 13.0);

		color(GREEN);

		hfont(fonts[i]);		/* grab a font from the table */

		htextsize(1.5, 1.5);		/* show the outer ring */
		ShowCircularText(11.0, str1);

		htextsize(1.3, 1.3);		/* show the second ring */
		ShowCircularText(8.5, str2);

		htextsize(1.1, 1.1);		/* show the third ring */
		ShowCircularText(7.0, str3);

		htextsize(0.9, 0.9);		/* show the inside ring */
		ShowCircularText(5.0, str4);

		if (qread(&val)) {
			if (val == 'q') {
				gexit();
				exit(0);
			}
		}

		color(BLACK);
		clear();
	}

	gexit();
}
Beispiel #3
0
/*
 * Using polygons, hatching, and filling.
 */
main()
{
	short	val;

	winopen("poly");

	unqdevice(INPUTCHANGE);
	qdevice(KEYBD);		/* enable keyboard */
	/* 
	 * Wait for REDRAW event ...
	 */
	while (qread(&val) != REDRAW)
		;

	color(BLACK);		/* clear to black */
	clear();

	/*
	 * world coordinates are now in the range -10 to 10
	 * in x, y, and z. Note that positive z is towards us.
	 */
	ortho(-10.0, 10.0, -10.0, 10.0, 10.0, -10.0);

	color(YELLOW);

	/*
	 * write out the string "Polygon from poly()" in the
	 * starting at (-8.0, -4.0) and scaled to be 4.0 units long,
	 * 0.5 units high.
	 */
	hfont("futura.m");
	hboxtext(-8.0, -4.0, 4.0, 0.5, "Polygon from poly()/ polf()");

	color(GREEN);

	/*
	 * write out a scaled string starting at (0.0, 6.0)
	 */
	hboxtext(0.0, 6.0, 4.5, 0.5, "Polygon from bgnpoly()/ endpoly()");
	hboxtext(0.0, 5.0, 4.5, 0.5, "             pmv()/ pdr()/ pclos()");

	color(MAGENTA);

	/*
	 * write out a scaled string starting at (0.0, 6.0)
	 */
	hboxtext(3.5, -3.5, 1.9, 0.5, "Arc/ Arcf");

	/*
	 * draw some wire frame polygons
	 */
	drawpoly();

	/*
	 *  rotate so the next polygons will appear in a different place.
	 */
	rot(20.0, 'x');
	rot(30.0, 'y');

	/*
	 * draw some filled polygons.
	 */
	drawpolyf();

	gexit();
}