Crée et initialise une matrice couleur identité
#include <GDIPlus.au3>
_GDIPlus_ColorMatrixCreate ( )
Une matrice couleur identité est une transformation qui ne fait rien, aucune modification de couleur.
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 $hHBmp = _ScreenCapture_Capture("", 0, 0, $iWidth, $iHeight) ; Crée un bitmap GDI en capturant une zone du bureau Local $hBitmap = _GDIPlus_BitmapCreateFromHBITMAP($hHBmp) ; Convertit le bitmap GDI en GDI+ _WinAPI_DeleteObject($hHBmp) ; Libére le bitmap GDI car n'est plus nécessaire Local $hGUI = GUICreate("GDI+ example", $iWidth, $iHeight) ; Crée une GUI de test GUISetState(@SW_SHOW) Local $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGUI) ; Crée un objet graphique à partir d'un handle fenêtre Local $hIA = _GDIPlus_ImageAttributesCreate() ; Crée un objet ImageAttribute Local $tColorMatrix = _GDIPlus_ColorMatrixCreate() ; Crée une matrice de couleur Local $iX, $iY For $iX = 0 To 3 ; Manipule quelques valeurs dans la matrice de couleur For $iY = 0 To 3 DllStructSetData($tColorMatrix, "m", Random(0, 0.5), $iY * 5 + $iX + 1) Next Next _GDIPlus_ImageAttributesSetColorMatrix($hIA, 0, True, $tColorMatrix) ; Adapte la matrice de couleur modifiée _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