UDF > GDIPlus > GraphicsPath >


_GDIPlus_PathGetPoints

Obtient un tableau de points à partir d'un objet GraphicsPath

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

Paramètre

$hPath Handle de l'objet GraphicsPath

Valeur de retour

Succès: Retourne un tableau de points qui définit les points de données du GraphicsPath
    [0][0] - Nombre de points
    [1][0] - Point 1, position X
    [1][1] - Point 1, position Y
    [2][0] - Point 2, position X
    [2][1] - Point 2, position Y
    [n][0] - Point n, position X
    [n][1] - Point n, position Y
Échec: Définit @error <> 0, @extended contient le code erreur GPSTATUS ($GPID_ERR*).

Voir aussi

Consultez GdipGetPathPoints dans la Librairie MSDN.

Exemple

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

Example()

Func Example()
    Local $hGUI, $hGraphic, $hPen1, $hPen2, $hPath, $aPoints

    ; Crée une GUI
    $hGUI = GUICreate("GDI+", 800, 400)
    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)

    $hPen1 = _GDIPlus_PenCreate(0xFFFFBB00, 2)
    $hPen2 = _GDIPlus_PenCreate(0xFF0000FF, 2)

    ; ellipse originale
    _GDIPlus_GraphicsDrawString($hGraphic, "original ellipse as bezier points", 10, 10)

    $hPath = _GDIPlus_PathCreate() ; Crée un objet path
    _GDIPlus_PathAddEllipse($hPath, 50, 50, 300, 300)

    _GDIPlus_GraphicsDrawPath($hGraphic, $hPath, $hPen1) ; Dessine le Path avec le handle Graphic (GUI)

    $aPoints = _GDIPlus_PathGetPoints($hPath)
    For $i = 1 To $aPoints[0][0]
        _GDIPlus_GraphicsDrawEllipse($hGraphic, $aPoints[$i][0] - 4, $aPoints[$i][1] - 4, 8, 8, $hPen2)
    Next

    ; Ellipse aplatie
    _GDIPlus_GraphicsDrawString($hGraphic, "flattened ellipse as a sequence of straight lines", 410, 10)

    _GDIPlus_PathReset($hPath)
    _GDIPlus_PathAddEllipse($hPath, 450, 50, 300, 300)
    _GDIPlus_PathFlatten($hPath, 10)

    _GDIPlus_GraphicsDrawPath($hGraphic, $hPath, $hPen1) ; Dessine le Path avec le handle Graphic (GUI)

    $aPoints = _GDIPlus_PathGetPoints($hPath)
    For $i = 1 To $aPoints[0][0]
        _GDIPlus_GraphicsDrawEllipse($hGraphic, $aPoints[$i][0] - 4, $aPoints[$i][1] - 4, 8, 8, $hPen2)
    Next

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

    ; Nettoie les ressources
    _GDIPlus_PathDispose($hPath)
    _GDIPlus_PenDispose($hPen1)
    _GDIPlus_PenDispose($hPen2)
    _GDIPlus_GraphicsDispose($hGraphic)
    _GDIPlus_Shutdown()
EndFunc   ;==>Example