Dessine une courbe de Bézier
#include <GDIPlus.au3>
_GDIPlus_GraphicsDrawBezier ( $hGraphics, $nX1, $nY1, $nX2, $nY2, $nX3, $nY3, $nX4, $nY4 [, $hPen = 0] )
$hGraphics | Handle de l'objet Graphics |
$nX1 | Coordonnée X du point de départ |
$nY1 | Coordonnée Y du point de départ |
$nX2 | Coordonnée X du premier point de contrôle |
$nY2 | Coordonnée Y du premier point de contrôle |
$nX3 | Coordonnée X du second point de contrôle |
$nY3 | Coordonnée Y du second point de contrôle |
$nX4 | Coordonnée X du point final |
$nY4 | Coordonnée Y du point final |
$hPen | [optionnel] Handle d'un objet Pen qui sera utilisé pour dessiner la courbe de Bézier. Si 0, un crayon noir qui trace des lignes continues de largeur de 1 sera utilisé. |
Succès: | Retourne True. |
Échec: | Retourne Fale et définit @error <> 0, @extended contient le code erreur GPSTATUS ($GPID_ERR*). |
Une courbe de Bézier ne passe pas par les points de contrôle.
Les points de contrôle agissent comme des aimants, tirant la courbe dans certaines directions pour définir sa forme.
Consultez GdipDrawBezier dans la Librairie MSDN.
#include <GDIPlus.au3> #include <GUIConstantsEx.au3> Example() Func Example() Local $hGUI, $hGraphic ; Crée une GUI $hGUI = GUICreate("GDI+", 400, 300) GUISetState(@SW_SHOW) ; Dessine une courbe de Bézier _GDIPlus_Startup() $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI) _GDIPlus_GraphicsDrawBezier($hGraphic, 50, 50, 100, 5, 125, 25, 250, 50) ; Boucle jusqu'à ce que l'utilisateur quitte. Do Until GUIGetMsg() = $GUI_EVENT_CLOSE ; Nettoie les ressources _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_Shutdown() EndFunc ;==>Example
#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 interface 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 de la fenêtre _GDIPlus_GraphicsSetSmoothingMode($hGraphics, $GDIP_SMOOTHINGMODE_HIGHQUALITY) ; Définit pour l'objet graphique la qualité de rendu antialiasing Local $hPen = _GDIPlus_PenCreate(0xFFFFFF00, 8) ; Format de couleur AARRGGBB (hex) _GDIPlus_GraphicsDrawBezier($hGraphics, 50.25, 350.75, 100.5, 5.5, 125.5, 25.5, 550.5, 550.25, $hPen) Do Until GUIGetMsg() = $GUI_EVENT_CLOSE ; Nettoie les ressources GDI+ _GDIPlus_PenDispose($hPen) _GDIPlus_GraphicsDispose($hGraphics) _GDIPlus_Shutdown() GUIDelete($hGUI) EndFunc ;==>Example