Function Reference


Adds a cardinal spline to the current figure of a path

#include <GDIPlus.au3>
_GDIPlus_PathAddCurve3 ( $hPath, $aPoints, $iOffset, $iNumOfSegments [, $nTension = 0.5] )


$hPath Pointer to a GraphicsPath object
$aPoints Array of points that define the cardinal spline:
    [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
$iOffset The index of the array element that is used as the first point of the cardinal spline, this is the index of the specific point in the array minus 1
$iNumOfSegments Number of segments in the cardinal spline. Segments are the curves that connect consecutive points in the array
$nTension [optional] Nonnegative real number that controls the length of the curve and how the curve bends.
As the value increases, the curve becomes fuller.

Return Value

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


The cardinal spline is a curve that passes through a subset (specified by the $iOffset and $iNumOfSegments parameters) of the points in the array


_GDIPlus_PathAddCurve, _GDIPlus_PathAddCurve2

See Also

Search GdipAddPathCurve3 in MSDN Library.


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

Global $g_hGUI, $g_hGraphics, $g_hBmp_Buffer, $g_hGfx_Buffer, $g_hPen, $g_hPen2, $g_hPath, $g_hPath2


Func Example()
    AutoItSetOption("GUIOnEventMode", 1)

    Local Const $iW = 400, $iH = 400

    $g_hGUI = GUICreate("GDI+", $iW, $iH)
    GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")

    $g_hGraphics = _GDIPlus_GraphicsCreateFromHWND($g_hGUI) ;Create a graphics object from a window handle
    $g_hBmp_Buffer = _GDIPlus_BitmapCreateFromGraphics($iW, $iH, $g_hGraphics)
    $g_hGfx_Buffer = _GDIPlus_ImageGetGraphicsContext($g_hBmp_Buffer)
    _GDIPlus_GraphicsSetSmoothingMode($g_hGfx_Buffer, $GDIP_SMOOTHINGMODE_HIGHQUALITY) ;Sets the graphics object rendering quality (antialiasing)

    $g_hPen = _GDIPlus_PenCreate(0xFF8800AA, 2)
    $g_hPen2 = _GDIPlus_PenCreate(0xFFFFDD00, 3)

    $g_hPath = _GDIPlus_PathCreate() ;Create new path object

    Local $aPoints[201][2] = [[200]], $iRadius = 0
    For $i = 1 To $aPoints[0][0]
        $aPoints[$i][0] = Cos($i / 3.14) * $iRadius + $iW / 2
        $aPoints[$i][1] = Sin($i / 3.14) * $iRadius + $iH / 2
        $iRadius += 1

    _GDIPlus_PathAddCurve($g_hPath, $aPoints)

    $g_hPath2 = _GDIPlus_PathCreate() ;Create new path object
    Local $iOff = 1, $iNum = 4
    While Sleep(20)
        _GDIPlus_PathAddCurve3($g_hPath2, $aPoints, $iOff, $iNum)

        $iOff += 1
        If $iOff > $aPoints[0][0] - $iNum Then $iOff = 1

        _GDIPlus_GraphicsClear($g_hGfx_Buffer, 0xFF000000)
        _GDIPlus_GraphicsDrawPath($g_hGfx_Buffer, $g_hPath, $g_hPen) ;Draw path to graphics handle (GUI)
        _GDIPlus_GraphicsDrawPath($g_hGfx_Buffer, $g_hPath2, $g_hPen2) ;Draw path to graphics handle (GUI)
        _GDIPlus_GraphicsDrawImage($g_hGraphics, $g_hBmp_Buffer, 0, 0)
EndFunc   ;==>Example

Func _Exit()
    ; Clean up resources
EndFunc   ;==>_Exit