_arc Functions

Description

Draw elliptical arcs.

#include <graph.h>

short __far _arc( short x1, short y1, short x2, short y2, shortx3, short y3,
short x4, short y4);

short __far _arc_w( doublex1, doubley1, doublex2, doubley2, doublex3, doubley3, doublex4, doubley4 );

short __far _arc_wxy( struct _wxycoord __far *pwxy1,
struct _wxycoord __far *pwxy2, struct _wxycoord __far *pwxy3,
struct _wxycoord __far *pwxy4 );

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)  

Remarks

The _arc functions draw elliptical arcs. The center of the arc is the center of the bounding rectangle, which is defined by points (x1,y1) and (x2,y2) for _arc and _arc_w and by points pwxy1 and pwxy2 for _arc_wxy. The arc starts where it intersects an imaginary line extending from the center of the arc through (x3,y3) for _arc and _arc_w and through pwxy3 for _arc_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 _arc and _arc_w and through pwxy4 for _arc_wxy.

The _arc routine uses the view coordinate system. The _arc_w and _arc_wxy functions use the real-valued window coordinate system.

In each case, the arc is drawn using the current color. Since an arc does not define a closed area, it is not filled.

Return Value

These functions return a nonzero value if the arc is successfully drawn; otherwise, they return 0.

Compatibility

Standards:None

16-Bit:DOS

32-Bit:None

See Also

_ellipse functions, _lineto functions, _pie functions, _rectangle functions, _setcolor

Example

/* ARC.C: This program draws a simple arc. */

#include <graph.h>

#include <stdlib.h>

#include <conio.h>

void main( void )

{

short x, y;

struct _xycoord xystart, xyend, xyfill;

/* Find a valid graphics mode */

if( !_setvideomode( _MAXRESMODE ) )

exit( 1 );

/* Draw arcs */

x = 100; y = 100;

_arc( x - 60, y - 60, x, y, x - 30, y - 60, x - 60, y - 30 );

_arc( x + 60, y + 60, x, y, x, y + 30, x + 30, y );

/* Get endpoints of second arc and enclose the figure, then fill it. */

_getarcinfo( &xystart, &xyend, &xyfill );

_moveto( xystart.xcoord, xystart.ycoord );

_lineto( xyend.xcoord, xyend.ycoord );

_floodfill( xyfill.xcoord, xyfill.ycoord, _getcolor() );

_getch();

_setvideomode( _DEFAULTMODE );

}