Crée et initialise une matrice couleur de mise à niveaux
#include <GDIPlus.au3>
_GDIPlus_ColorMatrixCreateScale ( $fRed, $fGreen, $fBlue [, $fAlpha = 1] )
$fRed | Facteur de la composante Rouge de la mise à niveau |
$fGreen | Facteur de la composante Vert de la mise à niveau |
$fBlue | Facteur de la composante Bleu de la mise à niveau |
$fAlpha | [optionnel]Facteur de la composante Alpha de la mise à niveau |
Une matrice couleur de mise à niveaux est utilisée pour multiplier les trois composantes d'une couleur par trois coefficients.
Consultez ColorMatrix dans la Librairie MSDN.
#include <GDIPlus.au3> #include <GUIConstantsEx.au3> #include <ScreenCapture.au3> #include <WinAPIHObj.au3> Example() Func Example() _GDIPlus_Startup() ; Initialise GDI+ Local Const $iWidth = 600, $iHeight = 600 Local $hGUI = GUICreate("GDI+ example", $iWidth, $iHeight) ; Crée une fenêtre de test GUISetState(@SW_SHOW) Local $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGUI) ; Crée un objet Graphics à partir du handle de la fenêtre Local $hIA = _GDIPlus_ImageAttributesCreate() ; Crée un objet ImageAttribute Local $tColorMatrix = _GDIPlus_ColorMatrixCreateScale(0.5, 0.5, 0.5) ; Crée la matrice couleur de mise à niveaux avec des facteurs 0.5 _GDIPlus_ImageAttributesSetColorMatrix($hIA, 0, True, $tColorMatrix) ; Diminue le niveau de chaque couleur (RVB) de 50% (assombrit) Local $hHBmp = _ScreenCapture_Capture("", 0, 0, $iWidth, $iHeight) ; Crée un bitmap GDI en capturant une région du bureau Local $hBitmap = _GDIPlus_BitmapCreateFromHBITMAP($hHBmp) ; Convertit le bitmap GDI en GDI+ _WinAPI_DeleteObject($hHBmp) ; Libère la ressource du bitmap GDI car elle n'est plus utile _GDIPlus_GraphicsDrawImageRectRect($hGraphics, $hBitmap, 0, 0, $iWidth, $iHeight, 0, 0, $iWidth, $iHeight, $hIA) ; Dessine le bitmap tout en appliquant l'ajustement des couleurs Do Until GUIGetMsg() = $GUI_EVENT_CLOSE ; Nettoie les ressources GDI+ _GDIPlus_ImageAttributesDispose($hIA) _GDIPlus_GraphicsDispose($hGraphics) _GDIPlus_BitmapDispose($hBitmap) _GDIPlus_Shutdown() GUIDelete($hGUI) EndFunc ;==>Example