Draw wedge-shaped figures.
#include <graph.h>
short __far _pie( short control, short x1, short y1, short x2, short y2, short x3, short y3, short x4, short y4 );
short __far _pie_w( short control, double x1, double y1, double x2, double y2,
double x3, double y3, double x4, double y4 );
short __far _pie_wxy( short control, struct _wxycoord __far *pwxy1,
struct _wxycoord __far *pwxy2, struct _wxycoord __far *pwxy3,
struct _wxycoord __far*pwxy4);
control | Fill-control constant | |
x1, y1 | Upper-left corner of bounding rectangle | |
x2, y2 | Lower-right corner of bounding rectangle | |
x3, y3 | Second point of start vector (center of bounding rectangle is first point) | |
x4, y4 | Second point of end vector (center of bounding rectangle is first point) | |
pwxy1 | Upper-left corner of bounding rectangle | |
pwxy2 | Lower-right corner of bounding rectangle | |
pwxy3 | Second point of start vector (center of bounding rectangle is first point) | |
pwxy4 | Second point of end vector (center of bounding rectangle is first point) |
The _pie functions draw a pie-shaped wedge by drawing an elliptical arc whose center and two endpoints are joined by lines.
The center of the pie is the center of the bounding rectangle, which is defined by points (x1,y1) and (x2,y2) for _pie and _pie_w and by points pwxy1 and pwxy2 for _pie_wxy. The pie starts where it intersects an imaginary line extending from the center of the arc through (x3,y3) for _pie and _pie_w and through pwxy3 for _pie_wxy. It is drawn counterclockwise about the center of the arc, ending where it intersects an imaginary line extending from the center of the arc through (x4,y4) for _pie and _pie_w and through pwxy4 for _pie_wxy.
The _pie routine uses the view coordinate system. The _pie_w and _pie_wxy functions use the real-valued window coordinate system. The arc is drawn using the current color. Since an arc does not define a closed area, it is not filled.
The _wxycoord structure is defined in GRAPH.H and contains the following elements:
Element | Description |
double wx | Window x coordinate |
double wy | Window y coordinate |
The wedge is drawn using the current color moving in a counterclockwise direction. The control parameter can be one of the following manifest constants:
Constant | Action |
_GFILLINTERIOR | Fills the figure using the current color and fill mask |
_GBORDER | Does not fill the figure |
The control option given by _GFILLINTERIOR is equivalent to a subsequent call to the _floodfill function using the approximate center of the pie as the starting point and the current color (set by _setcolor) as the boundary color. Use the _getarcinfo function to find the exact starting point.
These functions return a nonzero value if successful; otherwise, they return 0.
Standards:None
16-Bit:DOS
32-Bit:None
_arc functions, _ellipse functions, _floodfill, _getarcinfo, _getcolor, _lineto functions, _rectangle functions, _setcolor, _setfillmask
/* PIE.C: This program draws a pie-shaped figure. */
#include <stdlib.h>
#include <conio.h>
#include <graph.h>
void main( void )
{
/* Find a valid graphics mode. */
if( !_setvideomode( _MAXRESMODE ) )
exit( 1 );
_pie( _GBORDER, 80, 50, 240, 150, 240, 12, 0, 150 );
_getch();
_setvideomode( _DEFAULTMODE );
exit( 0 );
}