PathMoveTo

Syntax

PathMoveTo(x.d, y.d, Flags=#Null)

Description

Starts a new figure within the current path or moves the current point to the specified coordinates (x, y) without adding a line segment. This is typically the first command used when defining a new path or starting a disconnected part of a path.

Parameters

x.d
The horizontal coordinate for the new current point in device-independent pixels (DIPs).

y.d
The vertical coordinate for the new current 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. If used as the first command, it's relative to (0,0).

Return Value

This command does not return a value.

Remarks

It sets the starting point for subsequent path commands like PathAddLine(), PathAddCurve(), or PathAddArc(). Coordinates are in DIPs and scaled internally. The current path cursor position is updated to (x, y).

Example

IncludeFile "ProGUI_PB.pbi"

StartProGUI()

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

    DrawSetStroke(2, #PG_Stroke_RoundEnd | #PG_Stroke_Center)

    ; First Figure (Triangle)
    PathMoveTo(50, 150)
    PathAddLine(150, 50)
    PathAddLine(250, 150)
    PathClose()
    DrawPathStroke(RGB(255, 0, 0)) ; Draw first figure

    ; Second Figure (Line - disconnected from the first)
    PathMoveTo(50, 180) ; Move cursor without drawing
    PathAddLine(250, 180)
    DrawPathStroke(RGB(0, 0, 255)) ; Draw second figure

    DrawSetStroke(1)
EndProcedure

MyWindow = CreateWindow(0, 0, 300, 200, "PathMoveTo 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

PathAddLine, PathAddCurve, PathAddArc, PathClose, PathReset, DrawPath, DrawPathStroke, DrawPathFill

Supported OS

Windows (Direct2D only), Linux (Cairo only)