UDF > GDIPlus > ColorMatrix >


_GDIPlus_ColorMatrixCreateTranslate

Crée et initialise une matrice couleur de translation

#include <GDIPlus.au3>
_GDIPlus_ColorMatrixCreateTranslate ( $fRed, $fGreen, $fBlue [, $fAlpha = 0] )

Paramètres

$fRed Composante Rouge de la translation
$fGreen Composante Vert de la translation
$fBlue Composante Bleu de la translation
$fAlpha [optionnel] Composante Alpha de la translation

Valeur de retour

Retourne une structure $tagGDIPCOLORMATRIX qui contient une matrice couleur de translation.

Remarque

Une matrice couleur de translation est utilisée pour augmenter ou diminuer les composantes d'une couleur par des constantes additives.

En relation

$tagGDIPCOLORMATRIX

Voir aussi

Consultez ColorMatrix dans la Librairie MSDN.

Exemple

#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_ColorMatrixCreateTranslate(0.75, 0.75, 0.75) ; Crée la matrice qui modifie la luminosité des couleurs (RVB)

    _GDIPlus_ImageAttributesSetColorMatrix($hIA, 0, True, $tColorMatrix) ; Ajuste la luminosité de l'image à 75 % plus lumineux

    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