UDF > GDIPlus > Graphics >


_GDIPlus_GraphicsDrawClosedCurve

Dessine une spline cardinale ferm�e

#include <GDIPlus.au3>
_GDIPlus_GraphicsDrawClosedCurve ( $hGraphics, $aPoints [, $hPen = 0] )

Param�tres

$hGraphics Handle de l'objet Graphics
$aPoints Tableau qui contient des points de la courbe :
    [0][0] - Nombre de points
    [1][0] - Point 1 - abscisse X
    [1][1] - Point 1 - ordonn�e Y
    [2][0] - Point 2 - abscisse X
    [2][1] - Point 2 - ordonn�e Y
    [n][0] - Point n - abscisse X
    [n][1] - Point n - ordonn�e Y
$hPen [optionnel] Handle de l'objet Pen qui sera utilis� pour dessiner la courbe. Si 0, un crayon noir qui trace des lignes continues de largeur 1 sera utilis�.

Valeur de retour

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

Remarque

Dans une spline cardinale ferm�e, la courbe se poursuit apr�s le dernier point du tableau et se connecte avec le premier point du tableau.
La tableau de points doit contenir un minimum de trois �l�ments.

Voir aussi

Consultez GdipDrawClosedCurve dans la Librairie MSDN.

Exemples

Exemple 1

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

Example()

Func Example()
    Local $hGUI, $hGraphic, $aPoints[8][2]

    ; Cr�e une GUI
    $hGUI = GUICreate("GDI+", 400, 300)
    GUISetState(@SW_SHOW)

    ; Dessine une spline cardinale
    _GDIPlus_Startup()
    $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI)

    $aPoints[0][0] = 7
    $aPoints[1][0] = 50
    $aPoints[1][1] = 50
    $aPoints[2][0] = 100
    $aPoints[2][1] = 25
    $aPoints[3][0] = 200
    $aPoints[3][1] = 5
    $aPoints[4][0] = 250
    $aPoints[4][1] = 50
    $aPoints[5][0] = 300
    $aPoints[5][1] = 100
    $aPoints[6][0] = 350
    $aPoints[6][1] = 200
    $aPoints[7][0] = 250
    $aPoints[7][1] = 250

    _GDIPlus_GraphicsDrawClosedCurve($hGraphic, $aPoints)

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

    ; Nettoie les ressources
    _GDIPlus_GraphicsDispose($hGraphic)
    _GDIPlus_Shutdown()
EndFunc   ;==>Example

Exemple 2

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

Example()

Func Example()
    _GDIPlus_Startup() ; Initialise GDI+
    Local Const $iWidth = 600, $iHeight = 600, $iBgColor = 0x303030 ; Le format de $iBGColor est RRGGBB

    Local $hGUI = GUICreate("GDI+ example", $iWidth, $iHeight) ; Cr�e une GUI de test
    GUISetBkColor($iBgColor, $hGUI) ; D�finit la couleur de fond de la GUI
    GUISetState(@SW_SHOW)

    Local $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGUI) ; Cr�e un objet graphique � partir d'un handle fen�tre
    _GDIPlus_GraphicsSetSmoothingMode($hGraphics, $GDIP_SMOOTHINGMODE_HIGHQUALITY) ; D�finit pour l'objet graphique la qualit� de rendu antialiasing
    Local $hPen = _GDIPlus_PenCreate(0xFFFFFFFF, 4) ; Le format de couleur est AARRGGBB (hex)

    Local $aPoints[8][2]
    $aPoints[0][0] = 7
    $aPoints[1][0] = 50.5
    $aPoints[1][1] = 50.5
    $aPoints[2][0] = 100.75
    $aPoints[2][1] = 25.33
    $aPoints[3][0] = 200.66
    $aPoints[3][1] = 5.5
    $aPoints[4][0] = 250.25
    $aPoints[4][1] = 50.75
    $aPoints[5][0] = 300.125
    $aPoints[5][1] = 100.375
    $aPoints[6][0] = 590.8
    $aPoints[6][1] = 200.222
    $aPoints[7][0] = 250.55
    $aPoints[7][1] = 590.45

    _GDIPlus_GraphicsDrawClosedCurve($hGraphics, $aPoints, $hPen)

    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE

    ; Nettoie les ressources GDI+
    _GDIPlus_PenDispose($hPen)
    _GDIPlus_GraphicsDispose($hGraphics)
    _GDIPlus_Shutdown()
    GUIDelete($hGUI)
EndFunc   ;==>Example