UDF > GDIPlus > GraphicsPath >


_GDIPlus_PathReverse

Inverse l'ordre des points qui définissent les lignes et les courbes d'un tracé (GraphicsPath)

#include <GDIPlus.au3>
_GDIPlus_PathReverse ( $hPath )

Paramètre

$hPath Handle de l'objet GraphicsPath

Valeur de retour

Succès: Retourne True.
Échec: Retourne False et définit @error <> 0, @extended contient le code erreur ($GPID_ERR*).

Voir aussi

Consultez GdipReversePath dans la Librairie MSDN.

Exemple

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

Example()

Func Example()
    Local $iW, $iH, $hGUI, $hGraphic, $hBrush, $hPen, $hPath, $hPath_Clone, $hMatrix

    ; Crée une GUI
    $iW = 600
    $iH = 600
    $hGUI = GUICreate("GDI+", $iW, $iH)
    GUISetState(@SW_SHOW)

    _GDIPlus_Startup()
    $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI) ; Crée un objet graphique à partir du handle de la fenêtre
    _GDIPlus_GraphicsSetSmoothingMode($hGraphic, $GDIP_SMOOTHINGMODE_HIGHQUALITY) ; Définit pour l'objet graphique la qualité de rendu antialiasing
    _GDIPlus_GraphicsClear($hGraphic, 0xFFFFFFFF)

    $hBrush = _GDIPlus_BrushCreateSolid(0x7F8800AA)
    $hPen = _GDIPlus_PenCreate(0xFF8800AA, 2)

    $hPath = _GDIPlus_PathCreate() ; Crée un objet path

    ; Spirale comme une séquence de lignes
    Local $iXOld = 0, $iYOld = 0, $iX, $iY, $iAngle = 0, $iRadius = 0
    For $i = 0 To 200
        $iX = Cos($iAngle) * $iRadius
        $iY = Sin($iAngle) * $iRadius
        $iAngle += 0.1
        $iRadius = $iAngle ^ 2 / 2
        _GDIPlus_PathAddLine($hPath, $iXOld, $iYOld, $iX, $iY)
        $iXOld = $iX
        $iYOld = $iY
    Next

    $hPath_Clone = _GDIPlus_PathClone($hPath)
    _GDIPlus_PathReverse($hPath_Clone) ; Inverse path => point de fin du path = point de départ du path cloné

    $hMatrix = _GDIPlus_MatrixCreate()
    _GDIPlus_MatrixScale($hMatrix, 1.5, 1.5)
    _GDIPlus_PathTransform($hPath_Clone, $hMatrix) ; Agrandit path cloné

    _GDIPlus_PathAddPath($hPath, $hPath_Clone) ; Ajoute la path mis à l'échelle et inversé au path original

    _GDIPlus_MatrixSetElements($hMatrix, 1, 0, 0, 1, 0, 0) ; Réinitialise la matrice
    _GDIPlus_MatrixTranslate($hMatrix, $iW / 2, $iH / 2, True)
    _GDIPlus_PathTransform($hPath, $hMatrix) ; Déplace le path au centre de la fenêtre

    _GDIPlus_GraphicsFillPath($hGraphic, $hPath, $hBrush) ; Dessine le path avec le handle Graphic (GUI)
    _GDIPlus_GraphicsDrawPath($hGraphic, $hPath, $hPen) ; Dessine le Path avec le handle Graphic (GUI)

    ; Boucle jusqu'à ce que l'utilisateur quitte.
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE

    ; Nettoie les ressources
    _GDIPlus_MatrixDispose($hMatrix)
    _GDIPlus_PathDispose($hPath)
    _GDIPlus_PathDispose($hPath_Clone)
    _GDIPlus_BrushDispose($hBrush)
    _GDIPlus_PenDispose($hPen)
    _GDIPlus_GraphicsDispose($hGraphic)
    _GDIPlus_Shutdown()
EndFunc   ;==>Example