PathReset

Syntax

PathReset()

Description

Clears the current path definition within the active drawing context. Any previously added lines, curves, or arcs are removed, and the path cursor position is reset (typically to 0,0).

Parameters

This command takes no parameters.

Return Value

This command does not return a value.

Remarks

It is used to discard the current path geometry and start defining a new one without needing to draw the old one first. This is useful if you build a path incrementally but decide not to render it, or if you want to ensure you are starting a completely new path definition. Any cached geometry associated with the path is also cleared.

Example

IncludeFile "ProGUI_PB.pbi"

StartProGUI()

Procedure DrawHandler(Window, EventType, *EventData.PG_EventDraw, *UserData)
  
    DrawClear(RGB(255, 255, 255), 1)

    DrawSetStroke(2, #PG_Stroke_Center)

    ; Define part of a path
    PathMoveTo(20, 20)
    PathAddLine(100, 20)
    PathAddLine(100, 100)

    ; Decide not to draw it, reset the path
    PathReset()

    ; Define a new path (a simple line)
    PathMoveTo(150, 50)
    PathAddLine(250, 150)

    ; Draw the new path
    DrawPathStroke(RGB(0, 150, 0))

    DrawSetStroke(1)
    
EndProcedure

MyWindow = CreateWindow(0, 0, 300, 200, "PathReset 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, PathAddArc, PathClose, BeginDraw, EndDraw

Supported OS

Windows (Direct2D only), Linux (Cairo only)