Arc

2.x

  BOOL Arc(hdc, nLeftRect, nTopRect, nRightRect, nBottomRect, nXStartArc, nYStartArc, nXEndArc, nYEndArc)    
  HDC hdc; /* handle of device context */
  int nLeftRect; /* x-coordinate upper-left corner bounding rectangle */
  int nTopRect; /* y-coordinate upper-left corner bounding rectangle */
  int nRightRect; /* x-coordinate lower-right corner bounding rectangle */
  int nBottomRect; /* y-coordinate lower-right corner bounding rectangle */
  int nXStartArc; /* x-coordinate arc starting point */
  int nYStartArc; /* y-coordinate arc starting point */
  int nXEndArc; /* x-coordinate arc ending point */
  int nYEndArc; /* y-coordinate arc ending point */

The Arc function draws an elliptical arc.

Parameters

hdc

Identifies the device context.

nLeftRect

Specifies the logical x-coordinate of the upper-left corner of the bounding rectangle.

nTopRect

Specifies the logical y-coordinate of the upper-left corner of the bounding rectangle.

nRightRect

Specifies the logical x-coordinate of the lower-right corner of the bounding rectangle.

nBottomRect

Specifies the logical y-coordinate of the lower-right corner of the bounding rectangle.

nXStartArc

Specifies the logical x-coordinate of the point that defines the arc's starting point. This point need not lie exactly on the arc.

nYStartArc

Specifies the logical y-coordinate of the point that defines the arc's starting point. This point need not lie exactly on the arc.

nXEndArc

Specifies the logical x-coordinate of the point that defines the arc's endpoint. This point need not lie exactly on the arc.

nYEndArc

Specifies the logical y-coordinate of the point that defines the arc's endpoint. This point need not lie exactly on the arc.

Return Value

The return value is nonzero if the function is successful. Otherwise, it is zero.

Comments

The arc drawn by using the Arc function is a segment of the ellipse defined by the specified bounding rectangle. The starting point of the arc is the point at which a ray drawn from the center of the bounding rectangle through the specified starting point intersects the ellipse. The end point of the arc is the point at which a ray drawn from the center of the bounding rectangle through the specified end point intersects the ellipse. The arc is drawn in a counterclockwise direction. Since an arc is not a closed figure, it is not filled.

Both the width and the height of a rectangle must be greater than 2 units and less than 32,767 units.

Example

The following example uses a RECT structure to store the points defining the bounding rectangle and uses POINT structures to store the coordinates that specify the beginning and end of the arc:

HDC hdc;

RECT rc = { 10, 10, 180, 140 };
POINT ptStart = {  12,  12 };
POINT ptEnd = { 128, 135 };

Arc(hdc, rc.left, rc.top, rc.right, rc.bottom,
    ptStart.x, ptStart.y, ptEnd.x, ptEnd.y);

See Also

Chord