UDF > GDIPlus > PathIterator >


_GDIPlus_PathIterNextSubpathPath

Obtient la figure (sous-tracé) suivante d'un tracé (GraphicsPath) associé à un itérateur (GraphicsPathIterator)

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

Paramètres

$hPathIter Handle de l'objet GraphicsPathIterator
$hPath Handle de l'objet GraphicsPath

Valeur de retour

Succès: Retourne un tableau contenant le nombre de points de la figure récupérée:
    [0] - Nombre de point de la figure récupérée ou 0 s'il n'y a plus de figure à récupérer
    [1] - True, si la figure est fermée, False sinon
Échec: Définit @error <> 0, @extended contient le code erreur GPSTATUS ($GPID_ERR*).

Remarque

Cette fonction définit les points de données de l'objet spécifié GraphicsPath pour les faire correspondre avec les points de données de la figure récupérée.

En relation

_GDIPlus_PathIterRewind

Voir aussi

Consultez GdipPathIterNextSubpathPath dans la Librairie MSDN.

Exemple

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

Example()

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

    _GDIPlus_Startup()
    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)
    _GDIPlus_StringFormatDispose($hFormat)
    _GDIPlus_FontFamilyDispose($hFamily)

    Local $hIter = _GDIPlus_PathIterCreate($hPath)
    Local $iIterCnt = _GDIPlus_PathIterGetSubpathCount($hIter)
    Local $hSubPath = _GDIPlus_PathCreate(); Path pour obtenir les figures du sous-tracé
    Local $hMatrix = _GDIPlus_MatrixCreate()

    Local $hTimer = TimerInit(), $aBounds = 0
    ; Boucle jusqu'à ce que l'utilisateur quitte.
    Do
        If TimerDiff($hTimer) > 40 Then
            _GDIPlus_GraphicsClear($hGfx_Buffer, 0xFF000000)
            For $i = 1 To $iIterCnt
                _GDIPlus_PathReset($hSubPath); Réinitialise la transformation du path
                _GDIPlus_PathIterNextSubpathPath($hIter, $hSubPath)

                $aBounds = _GDIPlus_PathGetWorldBounds($hSubPath)
                _GDIPlus_MatrixSetElements($hMatrix, 1, 0, 0, 1, 0, 0); Réinitialise la matrice
                _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)
            Next
            _GDIPlus_PathIterRewind($hIter)

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

    ; Nettoie les ressources
    _GDIPlus_MatrixDispose($hMatrix)
    _GDIPlus_PathDispose($hSubPath)
    _GDIPlus_PathIterDispose($hIter)
    _GDIPlus_PathDispose($hPath)
    _GDIPlus_PenDispose($hPen)
    _GDIPlus_GraphicsDispose($hGfx_Buffer)
    _GDIPlus_BitmapDispose($hBmp_Buffer)
    _GDIPlus_GraphicsDispose($hGraphics)
    _GDIPlus_Shutdown()
EndFunc   ;==>Example