Syntax
DrawPathStroke(Color.l, Opacity.f=1, Flags=#Null)
Description
Draws the outline (stroke) of the shape defined by the current path using the specified solid color and opacity. The appearance of the stroke (width, dash style, caps, joins) is determined by the current stroke settings defined by DrawSetStroke().
Parameters
Color.l
The color of the stroke in RGB format (e.g., using
RGB(r, g, b)).
Opacity.f (optional)
The opacity of the stroke, ranging from 0.0 (fully
transparent) to 1.0 (fully opaque). Default is 1.0.
Flags (optional)
Flags modifying the behavior:
#PG_Path_Preserve : Keeps the path geometry defined after this drawing command is executed. Without this flag, the path is consumed and reset.
Return Value
This command does not return a value. It returns internally if Opacity is zero or less, or if the path is empty.
Remarks
This function must be called between BeginDraw() and EndDraw(), after defining a path using commands like PathMoveTo(), PathAddLine(), etc. It uses
an internal solid color brush. Use DrawSetStroke() before calling this
function to customize the line's appearance. By default, the path geometry is cleared after drawing; use
#PG_Path_Preserve if you need to draw the same path again (e.g., fill it afterwards).
Example
IncludeFile "ProGUI_PB.pbi"
StartProGUI()
Procedure DrawHandler(Window, EventType, *EventData.PG_EventDraw, *UserData)
DrawClear(RGB(255, 255, 255), 1)
; Define a path (curve and line)
PathMoveTo(20, 100)
PathAddCurve(70, 20, 130, 180, 180, 100)
PathAddLine(220, 100)
; Set stroke style
DrawSetStroke(4, #PG_Stroke_Dash | #PG_Stroke_RoundEnd)
; Stroke the path with a dashed green line
DrawPathStroke(RGB(0, 180, 0), 0.8) ; Path is consumed here by default
; Restore default stroke
DrawSetStroke(1)
EndProcedure
MyWindow = CreateWindow(0, 0, 250, 200, "DrawPathStroke 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
DrawPath, DrawPathFill, DrawPathStrokeFill, DrawSetStroke, PathMoveTo, PathAddLine, PathClose, BeginDraw, EndDraw
Supported OS
Windows (Direct2D only), Linux (Cairo only)