Function Reference


_GDIPlus_PathAddCurve3

Adds a cardinal spline to the current figure of a path

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

Parameters

$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*).

Remarks

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

Related

_GDIPlus_PathAddCurve, _GDIPlus_PathAddCurve2

See Also

Search GdipAddPathCurve3 in MSDN Library.

Example

#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

Example()

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

    Local Const $iW = 400, $iH = 400

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

    _GDIPlus_Startup()
    $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
    Next

    _GDIPlus_PathAddCurve($g_hPath, $aPoints)

    $g_hPath2 = _GDIPlus_PathCreate() ;Create new path object
    Local $iOff = 1, $iNum = 4
    While Sleep(20)
        _GDIPlus_PathReset($g_hPath2)
        _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)
    WEnd
EndFunc   ;==>Example

Func _Exit()
    ; Clean up resources
    _GDIPlus_PathDispose($g_hPath)
    _GDIPlus_PathDispose($g_hPath2)
    _GDIPlus_PenDispose($g_hPen)
    _GDIPlus_PenDispose($g_hPen2)
    _GDIPlus_GraphicsDispose($g_hGfx_Buffer)
    _GDIPlus_BitmapDispose($g_hBmp_Buffer)
    _GDIPlus_GraphicsDispose($g_hGraphics)
    _GDIPlus_Shutdown()
    GUIDelete($g_hGUI)
    Exit
EndFunc   ;==>_Exit