Syntax
PathAddCurve(x1.d, y1.d, x2.d, y2.d, x3.d, y3.d, Flags=#Null)
Description
Adds a cubic Bezier curve segment to the current path. The curve starts from the current path point and ends at the specified end point (x3, y3), using two control points (x1, y1) and (x2, y2) to define its shape.
Parameters
x1.d, y1.d
The coordinates of the first control point in device-independent
pixels (DIPs).
x2.d, y2.d
The coordinates of the second control point in DIPs.
x3.d, y3.d
The coordinates of the curve's end point in DIPs.
Flags (optional)
Flags modifying the behavior. Currently defined:
#PG_Path_Relative : Coordinates are relative to the current path point instead of absolute.
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 connects the current point to the end point (x3, y3)
with a smooth curve influenced by the positions of the two control points. Coordinates are in DIPs and
scaled internally. The current path point is updated to (x3, y3) after the curve 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, #PG_Stroke_Center)
; Start point
PathMoveTo(50, 100)
; Add a Bezier curve
; Control Point 1: (100, 20) - Pulls the curve up
; Control Point 2: (200, 180) - Pulls the curve down
; End Point: (250, 100)
PathAddCurve(100, 20, 200, 180, 250, 100)
; Draw the path outline
DrawPathStroke(RGB(0, 0, 255))
; Restore default stroke
DrawSetStroke(1)
EndProcedure
MyWindow = CreateWindow(0, 0, 300, 200, "PathAddCurve 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, PathAddArc, PathClose, PathReset, DrawPath, DrawPathStroke, DrawPathFill
Supported OS
Windows (Direct2D only), Linux (Cairo only)