Syntax
PathAddLine(x.d, y.d, Flags=#Null)
Description
Adds a straight line segment to the current path, connecting the current path point to the specified end point (x, y).
Parameters
x.d
The horizontal coordinate of the line's end point in device-independent
pixels (DIPs).
y.d
The vertical coordinate of the line'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 (PathAddCurve(), PathAddArc(),
PathAddLine). It creates a straight line from the current point to the new point (x, y).
Coordinates are in DIPs and scaled internally. The current path point is updated to (x, y) after the
line 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)
; Define a path: Move, Line, Line
PathMoveTo(50, 50)
PathAddLine(150, 50)
PathAddLine(150, 150)
; Draw the path outline
DrawPathStroke(RGB(0, 0, 255))
; Restore default stroke
DrawSetStroke(1)
EndProcedure
MyWindow = CreateWindow(0, 0, 200, 200, "PathAddLine 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, PathAddCurve, PathAddArc, PathClose, PathReset, DrawPath, DrawPathStroke, DrawPathFill
Supported OS
Windows (Direct2D only), Linux (Cairo only)