Function _GDIPlus_PathIterNextSubpathPath

Function Reference


Gets the next figure (subpath) from an iterator's associated path

#include <GDIPlus.au3>
_GDIPlus_PathIterNextSubpathPath ( $hPathIter, $hPath )


$hPathIter Pointer to a GraphicsPathIterator object
$hPath Pointer to a GraphicsPath object

Return Value

Success: an array containing the number of points in the retrieved figure:
    [0] - Number of point in the retrieved figure or 0 if no more figures to be retrieved
    [1] - If True, the figure is closed, False otherwise
Failure: sets the @error flag to non-zero, @extended may contain GPSTATUS error code ($GPID_ERR*).


This function sets the data points of the specified GraphicsPath object to match the data points of the retrieved figure.



See Also

Search GdipPathIterNextSubpathPath in MSDN Library.


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


Func Example()
    Local $hGUI = GUICreate("GDI+", 600, 300)

    Local $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGUI)
    Local $hBmp_Buffer = _GDIPlus_BitmapCreateFromGraphics(600, 300, $hGraphics)
    Local $hGfx_Buffer = _GDIPlus_ImageGetGraphicsContext($hBmp_Buffer)
    _GDIPlus_GraphicsSetSmoothingMode($hGfx_Buffer, $GDIP_SMOOTHINGMODE_HIGHQUALITY)
    _GDIPlus_GraphicsClear($hGfx_Buffer, 0xFF000000)

    Local $hPen = _GDIPlus_PenCreate(0xFFFFBB00, 2)

    Local $hPath = _GDIPlus_PathCreate()
    Local $hFormat = _GDIPlus_StringFormatCreate()
    _GDIPlus_StringFormatSetAlign($hFormat, 1)
    Local $hFamily = _GDIPlus_FontFamilyCreate("Arial")
    Local $tLayout = _GDIPlus_RectFCreate(0, 0, 600, 300)
    _GDIPlus_PathAddString($hPath, "AutoIt freaks out!", $tLayout, $hFamily, 0, 112, $hFormat)

    Local $hIter = _GDIPlus_PathIterCreate($hPath)
    Local $iIterCnt = _GDIPlus_PathIterGetSubpathCount($hIter)
    Local $hSubPath = _GDIPlus_PathCreate();Path to get the subpath figure
    Local $hMatrix = _GDIPlus_MatrixCreate()

    Local $hTimer = TimerInit(), $aBounds = 0
    ; Loop until the user exits.
        If TimerDiff($hTimer) > 40 Then
            _GDIPlus_GraphicsClear($hGfx_Buffer, 0xFF000000)
            For $i = 1 To $iIterCnt
                _GDIPlus_PathReset($hSubPath);reset path transformation
                _GDIPlus_PathIterNextSubpathPath($hIter, $hSubPath)

                $aBounds = _GDIPlus_PathGetWorldBounds($hSubPath)
                _GDIPlus_MatrixSetElements($hMatrix, 1, 0, 0, 1, 0, 0);reset matrix
                _GDIPlus_MatrixTranslate($hMatrix, -($aBounds[0] + $aBounds[2] / 2), -($aBounds[1] + $aBounds[3] / 2))
                _GDIPlus_MatrixRotate($hMatrix, Random(-24, 24), True)
                _GDIPlus_MatrixTranslate($hMatrix, $aBounds[0] + $aBounds[2] / 2, $aBounds[1] + $aBounds[3] / 2, True)
                _GDIPlus_PathTransform($hSubPath, $hMatrix)

                _GDIPlus_GraphicsDrawPath($hGfx_Buffer, $hSubPath, $hPen)

            _GDIPlus_GraphicsDrawImage($hGraphics, $hBmp_Buffer, 0, 0)
            $hTimer = TimerInit()
    Until GUIGetMsg() = $GUI_EVENT_CLOSE

    ; Clean up resources
EndFunc   ;==>Example