Obtient la couleur de début et la couleur de fin d'un pinceau à dégradé linéaire
#include <GDIPlus.au3>
_GDIPlus_LineBrushGetColors ( $hLineGradientBrush )
$hLineGradientBrush | Handle de l'objet LinearGradientBrush |
Succès: | Retourne un tableau contenant les couleurs de début et de fin de l'objet LinearGradientBrush: [0] - Couleur de début [1] - Couleur de fin |
Échec: | Définit @error <> 0, @extended contient le code erreur GPSTATUS ($GPID_ERR*). |
Consultez GdipGetLineColors dans la Librairie MSDN.
#include <GDIPlus.au3> #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> Example() Func Example() _GDIPlus_Startup() ; Initialise GDI+ Local Const $fWidth = 600, $fHeight = 600, $iBgColor = 0x303030 ; $fBGColor est au format RRGGBB Local $hGUI = GUICreate("GDI+ example", $fWidth, $fHeight) ; Crée une fenêtre 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 Graphics à partir du handle de la fenêtre _GDIPlus_GraphicsSetSmoothingMode($hGraphics, $GDIP_SMOOTHINGMODE_HIGHQUALITY) ; Définit pour l'objet graphique la qualité de rendu antialiasing Local $hBrush = _GDIPlus_LineBrushCreate(0, 0, 150, 0, 0xFF000000 + Random(0x111111, 0xFFFFFF, 1), 0xFF000000 + Random(0x111111, 0xFFFFFF, 1), 1) ; Crée un pinceau à dégradé linéaire renversé _GDIPlus_GraphicsClear($hGraphics, 0xFF000000 + $iBgColor) ; Efface le bitmap _GDIPlus_GraphicsFillRect($hGraphics, 100, 50, 380, 500, $hBrush) ; Dessine de nouveau l'œuf Local $aColors = _GDIPlus_LineBrushGetColors($hBrush) MsgBox($MB_SYSTEMMODAL, "", "Starting hex color: " & Hex($aColors[0], 8) & @CRLF & "End hex color: " & Hex($aColors[1], 8)) Do Until GUIGetMsg() = $GUI_EVENT_CLOSE ; Nettoie les ressources GDI+ _GDIPlus_BrushDispose($hBrush) _GDIPlus_GraphicsDispose($hGraphics) _GDIPlus_Shutdown() GUIDelete($hGUI) EndFunc ;==>Example