BBjDrawPanel::drawArc

Description

In BBj 16.0 and higher, this method draws an open arc or closed pie slice on the BBjDrawPanel.

Syntax

Return Value

Method

void

drawArc(number x, number y, int r, double aspect, double startAngle, double endAngle, boolean pieFlag)

Parameters

Variable

Description

x

Horizontal position of the center of the circle or arc.

y

Vertical position of the center of the circle or arc.

r

The radius of the circle, or the longest radius of the arc.

aspect

The ratio of the radius along the x axis divided by the radius along the y axis. The default aspect ratio is 1 for a circle.

startAngle

Starting point of an arc, an angle specified in radians. The default is zero. When equal to endAngle, the complete curve is drawn.

endAngle

End point of an arc, an angle specified in radians The default is zero. When equal to startAngle, the complete curve is drawn.

pieFlag

Connects the start and end points of an arc to a center point to form a pie shape. If pieFlag is nonzero (the default is zero), a closed "pie slice" object is drawn (using the current pen and fill), instead of an arc (using only the current pen).

Return Value

None.

Remarks

BBj specifies angles in radians, counter-clockwise from 3 o'clock. 3 o'clock is 0.0 radians, 12 o'clock is PI*0.5 radians, 9 o'clock is PI*1.0 radians, and 6 o'clock is PI*1.5 radians. Values of PI*2.0 radians or greater are treated as MOD(value,PI*2.0).

Example

rem ' BBjDrawPanel::drawArc

sysgui = unt
open (sysgui)"X0"
sysgui! = bbjapi().getSysGui()
title$ = "BBjDrawPanel::drawArc"
window! = sysgui!.addWindow(25,25,1225,550,title$,$00090003$)
window!.setCallback(window!.ON_CLOSE,"eoj")
window!.setTrack(0)
window!.setFont(sysgui!.makeFont("Courier New",8,0))
drawpanel! = window!.getDrawPanel()
drawpanel!.setPenColor(BBjColor.BLUE)
drawpanel!.setFillColor(BBjColor.GREEN)
for i = 0 to 10
    x = i * 110
    w = (i+1) * 0.25
    drawpanel!.drawText(x+5,25,"setFillType("+str(i)+")")
    drawpanel!.drawText(x+5,50,"setPattern("+str(i)+")")
    drawpanel!.drawText(x+5,75,"setPenWidth("+str(w)+")")
    drawpanel!.setFillType(i)
    drawpanel!.setPattern(i)
    drawpanel!.setPenWidth(w)
    r1 = i * Math.PI / 2
    r2 = r1 + Math.PI / 2
    drawpanel!.drawArc(x+50,125,25,1,r1,r2,1)
    drawpanel!.drawArc(x+50,175,25,1,r1,r2,0)
    drawpanel!.drawArc(x+50,250,25,1,r1,r1,1)
    drawpanel!.drawArc(x+50,325,25,1,r1,r1,0)
    drawpanel!.drawArc(x+50,400,25,.5,r1,r1,1)
    drawpanel!.drawArc(x+50,475,25,2,r1,r1,0)
next i
process_events

eoj:
release

See Also

BBjAPI

BBjSysGui

BBjWindow

BBjDrawPanel

ARC Mnemonic - Draw Arc (SYSGUI)

See the BBj Object Diagram for an illustration of the relationship between BBj Objects.