Purpose |
Draw a pie section on a host printer page. | ||||||||||||||
Syntax |
XPRINT PIE (x1!, y1!) - (x2!, y2!), arcStart!, arcEnd! [, [rgbColor&] [, [fillcolor&] [, [fillstyle&]]]] | ||||||||||||||
Remarks |
A pie section is an arc, with a line drawn from each end point to the center of the circle or ellipse. To specify a pie section, you would first define the full circle or ellipse of which it is a part, and then specify the points on the ellipse where the arc starts and stops. The full circle or ellipse is defined by its bounding rectangle, which is defined as the smallest rectangle which can be drawn around the circle or ellipse. For example, if the circle is centered at position (400,400), with a radius of 100 pixels, the upper left corner (x1,y1) of the bounding rectangle is (300,300), and the lower right corner (x2,y2) is (500,500). The start point and end point of the arc are specified by their angle, which must be given in radians. A complete circle or ellipse is 2*pi radians. On a 12-hour clock-face, the values 0 and 2*pi both refer to the position of 3 o'clock, while the value 1*pi refers to the position of 9 o'clock. Other positions are specified by a radian value relative to these. In PowerBASIC, arcs are always drawn counter-clockwise from the starting point to the ending point. Prior to any
| ||||||||||||||
x1!, y1! |
The upper left corner of the bounding rectangle of the full circle or ellipse. | ||||||||||||||
x2!, y2! |
The lower right corner of the bounding rectangle of the full circle or ellipse. | ||||||||||||||
ArcStart! |
The starting angle of the arc, in radians, from 0 to 2*pi. | ||||||||||||||
ArcEnd! |
The ending angle of the arc, in radians, from 0 to 2*pi radians. Note that arcs are always drawn counter-clockwise from arcStart! to arcEnd!. Compared with a 12-hour clock-face, 0 or 2*pi radians is at 3 o'clock, and 1*pi radians is at 9 o'clock. | ||||||||||||||
rgbColor& |
Optional RGB color of the pie edge. If omitted (or -1), the edge color defaults to the current foreground color for the host printer page. | ||||||||||||||
fillcolor& |
Optional RGB color of the pie interior. If fillcolor& is omitted (or -2), the interior of the pie is not filled, allowing the background to show through. If fillcolor& is -1, the interior is painted with the same color as the edge. Otherwise, fillcolor& specifies the RGB color to be used. | ||||||||||||||
fillstyle& |
Optional fill style (pattern) to be used. If fillstyle& is omitted, the default fill style is solid (0). If a hatch pattern is chosen (1 to 6), the foreground color is specified by the fillcolor&, while the background is specified by the default background color for the host printer page. The optional fillstyle& may be:
| ||||||||||||||
See also |
XPRINT ARC, XPRINT ATTACH, XPRINT BOX, XPRINT COLOR, XPRINT ELLIPSE, XPRINT LINE, XPRINT STYLE, XPRINT WIDTH | ||||||||||||||
Example |
' A full circle is 2*pi radians (100%). ' To show a 25% Pie, use the formula 0.25 * 2 * pi. ' The following divides a full circle into four 25% parts, each ' with its own colors, each slightly separated from the others. ' Note: 0 is at 3 o'clock, then it builds counter-clockwise. LOCAL Pi2 AS DOUBLE Pi2 = ATN(1)* 8 ' 2 * Pi can be useful here XPRINT PIE (10, 9)-(110, 109), 0, Pi2 * 0.25, %BLUE, %LTGRAY, 3 XPRINT PIE (9, 9)-(109, 109), Pi2 * 0.25, Pi2 * 0.50, %RED, %LTGRAY, 4 XPRINT PIE (9, 10)-(109, 110), Pi2 * 0.5, Pi2 * 0.75, RGB(0,127,0), %LTGRAY, 3 XPRINT PIE (10, 10)-(110, 110), Pi2 * 0.75, 0, %GRAY, %LTGRAY, 4 |