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