Syntax
DrawPathStrokeFill(Brush, Flags=#Null)
Description
Draws the outline (stroke) of the shape defined by the current path using the specified brush (image or gradient). The appearance of the stroke (width, dash style, caps, joins) is determined by the current stroke settings defined by DrawSetStroke().
Parameters
Brush
The handle of the brush (created with CreateBrushImg(), CreateBrushGradientLinear(), etc.) used to draw the
outline.
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 the Brush handle is invalid or the path is empty.
Remarks
This function must be called between BeginDraw() and EndDraw(), after defining a path using commands like PathMoveTo(), PathAddLine(), etc. Use DrawSetStroke() before calling this function to customize the line's
appearance. The appearance of the stroke depends on the brush type and its properties (position, scale,
rotation, extend mode, opacity). 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()
; Create an image brush
MyImage = CreateImg(20, 20, #PG_Img_Transparent)
If BeginDraw(OutputImg(MyImage))
DrawClear(0,0)
DrawBox(0,0,10,10,RGB(255,0,0)) ; Red square
DrawBox(10,10,10,10,RGB(0,0,255)) ; Blue square
EndDraw()
EndIf
Global ImageBrush = CreateBrushImg(MyImage)
BrushSetExtendMode(ImageBrush, #PG_Brush_ExtendMode_Repeat, #PG_Brush_ExtendMode_Repeat)
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(15) ; Thick stroke
; Stroke the path using the image brush
DrawPathStrokeFill(ImageBrush)
; Restore default stroke
DrawSetStroke(1)
EndProcedure
MyWindow = CreateWindow(0, 0, 250, 200, "DrawPathStrokeFill Example")
If MyWindow
AddEventHandler(MyWindow, #PG_Event_Draw, @DrawHandler())
WindowShow(MyWindow, #True, #PG_Window_ScreenCentered)
Repeat
Event = WaitWindowEvent()
Until Event = #PB_Event_CloseWindow
EndIf
FreeBrush(ImageBrush)
FreeImg(MyImage)
StopProGUI()
See Also
DrawPath, DrawPathFill, DrawPathStroke, DrawSetStroke, CreateBrushImg, CreateBrushGradientLinear, PathMoveTo, PathAddLine, BeginDraw, EndDraw
Supported OS
Windows (Direct2D only), Linux (Cairo only)