Function GraArc() Foundation
Draws a circle, arc, or ellipse.
GraArc( [<oPS>], [<aCenter>], <nRadius>, ;
[<aEllipse>], [<nStartAngle>], ;
[<nSweepAngle>], [<nFill>] ) --> lSuccess
Constant | Description |
---|---|
GRA_FILL | Fills circle |
GRA_OUTLINE *) | Draws an outlined circle |
GRA_OUTLINEFILL | Draws an outlined and filled circle |
|
The return value of GraArc() is .T. (true) if the circle was drawn, otherwise it is .F. (false). If the return value is .F., the cause of error can be determined using GraError().
Circles, arcs and ellipses are drawn using the function GraArc(). By default a circle is drawn as an outline with the color and the line width set by the function GraSetAttrLine(). The fill pattern and fill color for a filled circle can be specified with GraSetAttrArea(). The default for the fill pattern is the #define constant GRA_SYM_SOLID.
Drawing ellipses
For drawing ellipses, the coordinates for the end points of the ellipse axes must be indicated in addition to the center point. These are calculated from the values in <aEllipse>. The length of the axis is calculated by multiplication with the radius. The following calls all result in the same ellipse:
It is recommended that the value 1 be set as the radius when drawing an ellipse, since this causes the values in <aEllipse> to exactly represent the relative coordinates for both ellipse axes. The origin for both axes is the center point of the ellipse.
If values not equal to zero are entered for the array elements <nY1> and <nX2>, the ellipse axes are tipped over and the ellipse drawn turned. To avoid a distorted ellipse be sure that the ellipse axes are always at a 90 angle to each other.
Drawing arcs
An arc begins with the starting angle <nStartAngle> and is drawn to the angle <nStartAngle> + <nSweepAngle>. It is drawn only as a line and cannot be filled. Thus, <nFill> cannot be used when drawing an arc. If it is included, a runtime error occurs.
As is apparent from the illustration, with an arc a straight line is always drawn beginning at the current pen position up to the intersection point with the radius of the arc. The arc is drawn out from this intersection point. The pen position does not change. To assure that the line begins at the center point of the arc, the pen position must be set to the center point with GraPos() before calling GraArc().
To fill arcs with a pattern they must be defined within a graphic path with GraPathBegin() / GraPathEnd(). The path can then be filled or outlined (see the third example for GraArc()).
If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.