UDF > GDIPlus > ImageAttributes >


_GDIPlus_ImageAttributesDispose

Libère un objet ImageAttributes

#include <GDIPlus.au3>
_GDIPlus_ImageAttributesDispose ( $hImageAttributes )

Paramètre

$hImageAttributes Handle de l'objet ImageAttribute

Valeur de retour

Succès: Retourne True.
Échec: Retourne False et définit @error <> 0, @extended contient le code erreur ($GPID_ERR*).

En relation

_GDIPlus_ImageAttributesCreate

Voir aussi

Consultez GdipDisposeImageAttributes 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

    ; Crée la matrice des couleurs utilisée pour ajuster les couleurs de l'image
    Local $tColorMatrix = _GDIPlus_ColorMatrixCreateTranslate(-0.5, -0.5, -0.5) ; Utiliser la matrice de translation des couleurs pour changer la luminosité de l'image

    _GDIPlus_ImageAttributesSetColorMatrix($hIA, 0, True, $tColorMatrix) ; Régle la couleur-clé de la matrice des couleurs ImageAttribute

    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 le réglage de la couleur

    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