Function Reference


_GDIPlus_PathAddLine2

Adds a sequence of lines to the current figure of a path

#include <GDIPlus.au3>
_GDIPlus_PathAddLine2 ( $hPath, $aPoints )

Parameters

$hPath Pointer to a GraphicsPath object
$aPoints Array of points that define the lines:
    [0][0] - Number of points
    [1][0] - Point 1 X position
    [1][1] - Point 1 Y position
    [2][0] - Point 2 X position
    [2][1] - Point 2 Y position
    [n][0] - Point n X position
    [n][1] - Point n Y position

Return Value

Success: True.
Failure: False and sets the @error flag to non-zero, @extended may contain GPSTATUS error code ($GPID_ERR*).

Related

_GDIPlus_PathAddLine

See Also

Search GdipAddPathLine2 in MSDN Library.

Example

#include <GDIPlus.au3>
#include <GUIConstantsEx.au3>

Example()

Func Example()
    Local $hGUI, $hGraphics, $hPath, $hCustomLineCap, $hClonedLineCap, $hPen
    Local $avPoints[4][2] = [[3], [-15, -15], [0, 0], [15, -15]]

    ; Initialize GDI+
    _GDIPlus_Startup()

    ;create a Graphics object from a window handle
    $hGUI = GUICreate("_GDIPlus_CustomLineCapCreate Example", 400, 200)
    GUISetState(@SW_SHOW)

    $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGUI)

    ;sets the graphics object rendering quality (antialiasing)
    _GDIPlus_GraphicsSetSmoothingMode($hGraphics, $GDIP_SMOOTHINGMODE_HIGHQUALITY)

    ; Create GraphicsPath and add two lines to it.
    $hPath = _GDIPlus_PathCreate()
    _GDIPlus_PathAddLine2($hPath, $avPoints)

    ; Create a CustomLineCap object.
    $hCustomLineCap = _GDIPlus_CustomLineCapCreate(0, $hPath)

    ; Create a clone CustomLineCap object.
    $hClonedLineCap = _GDIPlus_CustomLineCapClone($hCustomLineCap)

    ; Create a Pen object, assign cloned cap as the custom end cap, and draw a line.
    $hPen = _GDIPlus_PenCreate(0xFFFF0000)
    _GDIPlus_PenSetCustomEndCap($hPen, $hClonedLineCap)

    _GDIPlus_GraphicsDrawLine($hGraphics, 50, 50, 350, 150, $hPen)

    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE

    ; Clean up
    _GDIPlus_PenDispose($hPen)
    _GDIPlus_CustomLineCapDispose($hClonedLineCap)
    _GDIPlus_CustomLineCapDispose($hCustomLineCap)
    _GDIPlus_PathDispose($hPath)
    _GDIPlus_GraphicsDispose($hGraphics)

    ; Uninitialize GDI+
    _GDIPlus_Shutdown()
EndFunc   ;==>Example