Ajoute une ellipse à la figure actuelle
#include <GDIPlus.au3>
_GDIPlus_PathAddEllipse ( $hPath, $nX, $nY, $nWidth, $nHeight )
$hPath | Handle de l'objet GraphicsPath |
$nX | La coordonnée X du coin supérieur gauche du rectangle qui délimite l'ellipse |
$nY | La coordonnée Y du coin supérieur gauche du rectangle qui délimite l'ellipse |
$nWidth | La largeur du rectangle qui délimite l'ellipse |
$nHeight | La hauteur du rectangle qui délimite l'ellipse |
Succès: | Retourne True. |
Échec: | Retourne False et définit @error <> 0, @extended contient le code erreur ($GPID_ERR*). |
Consultez GdipAddPathEllipse dans la Librairie MSDN.
#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