Syntax
PathAddArc(x.d, y.d, rx.d, ry.d, rotationAngle.d=0, isSweepClockwise.b=#True, isLargeArc.b=#False)
Description
Adds an elliptical arc segment to the current path, connecting the current path point to the specified end point (x, y).
Parameters
x.d
The horizontal coordinate of the arc's end point in device-independent pixels
(DIPs).
y.d
The vertical coordinate of the arc's end point in DIPs.
rx.d
The horizontal radius of the ellipse in DIPs.
ry.d
The vertical radius of the ellipse in DIPs.
rotationAngle.d (optional)
The rotation angle of the ellipse's x-axis relative to
the coordinate system's x-axis, in degrees. Default is 0.
isSweepClockwise.b (optional)
Determines the direction of the arc sweep.
#True for clockwise, #False for counter-clockwise. Default is
#True.
isLargeArc.b (optional)
Determines which of the two possible arcs is chosen.
#True selects the arc spanning 180 degrees or more, #False selects the arc
spanning less than 180 degrees. Default is #False.
Return Value
This command does not return a value.
Remarks
This function must be called after a PathMoveTo() or another path drawing
command (PathAddLine(), PathAddCurve(),
PathAddArc). It creates an arc segment from the current path point to the new point (x, y).
The shape of the arc is determined by the radii (rx, ry), the rotation angle, and the sweep/large arc
flags. There are always two possible ellipses and two possible arcs for any given start point, end
point, and radii; the flags select which one to draw. Coordinates and radii are in DIPs and scaled
internally. The current path point is updated to (x, y) after the arc is added.
Example
IncludeFile "ProGUI_PB.pbi"
StartProGUI()
Procedure DrawHandler(Window, EventType, *EventData.PG_EventDraw, *UserData)
DrawClear(RGB(255, 255, 255), 1)
; Draw a thick blue stroke for the path
DrawSetStroke(3)
; Example 1: Simple arc (part of a circle)
PathMoveTo(50, 100)
PathAddArc(150, 100, 50, 50, 0, #True) ; 180 degree arc downwards
DrawPathStroke(RGB(0, 0, 255)) ; Draw and consume path
; Example 2: Large arc segment of an ellipse
PathMoveTo(200, 50)
PathAddArc(300, 150, 80, 40, 30, #False) ; Rotated ellipse, counter-clockwise
DrawPathStroke(RGB(255, 0, 0)) ; Draw and consume path
; Restore default stroke
DrawSetStroke(1)
EndProcedure
MyWindow = CreateWindow(0, 0, 350, 200, "PathAddArc Example")
If MyWindow
AddEventHandler(MyWindow, #PG_Event_Draw, @DrawHandler())
WindowShow(MyWindow, #True, #PG_Window_ScreenCentered)
Repeat
Event = WaitWindowEvent()
Until Event = #PB_Event_CloseWindow
EndIf
StopProGUI()
See Also
PathMoveTo, PathAddLine, PathAddCurve, PathClose, PathReset, DrawPath, DrawPathStroke, DrawPathFill
Supported OS
Windows (Direct2D only), Linux (Cairo only)