CIRCLE(3L)

NAME
circle, disc, discture, arc - circle routines

SYNOPSIS
#include <dmd.h>

void circle (b, p, r, f)

void disc (b, p, r, f)

void discture (b, p, r, t, f)

void arc (b, p, p1, p2, f)

Bitmap *b;
Point p, p1, p2;
int r;
Texture16 *t;
Code f;

DESCRIPTION
The circle function draws the best approximate circle of radius r centered at Point p in the Bitmap b with Code f. The circle is guaranteed to be symmetrical about the horizontal, vertical, and diagonal axes.

The disc function draws a disc of radius r centered at Point p in the Bitmap b with Code f. A disc is a circle which has been completely filled.

The discture function draws a disc of radius r centered at Point p in the Bitmap b using the Texture16 t with Code f. The discture function is similar to the disc function except it allows one to specify a pattern to fill the disc.

The arc function draws a circular arc centered on p, traveling counter-clockwise from p1 to the point on the circle closest to p2.

EXAMPLE
The following routine draws a ``smiling face'' in the display Bitmap with center specified by clicking button 1.

    #include <dmd.h>
    main()
    {
    	int radius;
    	extern Texture16 T_darkgrey;
    	Point s;

     	request(MOUSE);
    	wait(MOUSE);
    	bttns(1);
    	s = mouse.xy;
    	radius = 50;
    	/* smiling will draw the face.  The nose will be
    	 * placed wherever the mouse is clicked in
    	 * the window.
    	 */

    	smiling(&display, s, radius, &T_darkgrey, F_XOR);
    	request(KBD);
    	wait(KBD);
    }
    smiling(b, c, rad, t, f)
    Bitmap  *b;
    Point    c;
    int      rad;
    Texture16 *t;
    Code     f;
    {
        int mino, e; /* offsets for placing */
    	         /* eyes, nose and mouth */
        int enrad;   /* radius of eyes and nose */
        mino = rad/2;
        e = rad/3;
        enrad = e/3;
        circle (b, c, rad, f); /* face outline */
        disc (b, Pt(c.x-e, c.y-mino),
             enrad, f);        /* left eye */
        disc (b, Pt(c.x+e, c.y-mino),
             enrad, f);        /* right eye */
        discture (b, c, enrad, t, f); /* nose */
        arc (b, c, Pt(c.x-mino, c.y+mino),
    	Pt(c.x+mino, c.y+mino),f);
         /* mouth */
    }

SEE ALSO
ellipse(3L), jcircle(3L), jellipse(3L), texture(3R).