UDF > GDIPlus > Image >


_GDIPlus_DrawImageFX

Dessine une partie d'une image après l'application d'un effet spécifié

#include <GDIPlus.au3>
_GDIPlus_DrawImageFX ( $hGraphics, $hImage, $hEffect [, $tRECTF = 0 [, $hMatrix = 0 [, $hImgAttributes = 0 [, $iUnit = 2]]]] )

Paramètres

$hGraphics Handle de l'objet Graphics.
$hImage Handle de l'objet Image.
$hEffect Handle de l'objet Effect qui est appliqué à l'image avant le rendu. L'image n'est pas modifiée de façon permanente par l'effet.
$tRECTF [optionnel] Structure $tagGDIPRECTF qui spécifie la partie de l'image à dessiner.
$hMatrix [optionnel] Handle de l'objet Matrix qui spécifie le parallélogramme dans lequel la partie de l'image est rendue.
$hImgAttributes [optionnel] Handle de l'objet ImageAttributes qui spécifie les réglages de couleur à appliquer dans le rendu de l'image.
$iUnit [optionnel] Spécifie l'unité de mesure pour l'image.

Valeur de retour

Succès: Retourne True.
Échec: Retourne False et définit @error <> 0, @extended contient le code erreur ($GPID_ERR*).
@error: -1 - GDIPlus.dll ne supporte pas cette fonction.
10 - Paramètres invalides.

En relation

$tagGDIPRECTF, _GDIPlus_DrawImageFXEx, _GDIPlus_EffectCreate

Voir aussi

Consultez GdipDrawImageFX dans la Librairie MSDN.

Exemple

#include <GDIPlus.au3>
#include <GUIConstantsEx.au3>
#include <MsgBoxConstants.au3>

_Example()

Func _Example()
    Local $sFile = FileOpenDialog("Select an image", "", "Images (*.bmp;*.png;*.jpg;*.gif;*.tif)")
    If @error Or Not FileExists($sFile) Then Return

    If Not _GDIPlus_Startup() Then
        MsgBox($MB_SYSTEMMODAL, "ERROR", "GDIPlus.dll v1.1 not available")
        Return
    EndIf

    Local $hImage = _GDIPlus_ImageLoadFromFile($sFile)
    Local $iImgW = _GDIPlus_ImageGetWidth($hImage)
    Local $iImgH = _GDIPlus_ImageGetHeight($hImage)

    Local $iWidth = 600
    Local $iHeight = $iImgH * 600 / $iImgW

    Local $hBitmap = _GDIPlus_BitmapCreateFromScan0($iWidth, $iHeight)
    Local $hContext = _GDIPlus_ImageGetGraphicsContext($hBitmap)
    _GDIPlus_GraphicsDrawImageRect($hContext, $hImage, 0, 0, $iWidth, $iHeight)

    Local $hGui = GUICreate("GDI+ v1.1", $iWidth, $iHeight)
    Local $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGui)
    GUISetState(@SW_SHOW)

    _GDIPlus_GraphicsDrawImage($hGraphics, $hBitmap, 0, 0)

    Local $hEffect = _GDIPlus_EffectCreateHueSaturationLightness(-90)
    Local $tRectF = _GDIPlus_RectFCreate($iWidth * 0.25, $iHeight * 0.25, $iWidth * 0.5, $iHeight * 0.5)
    _GDIPlus_DrawImageFX($hGraphics, $hBitmap, $hEffect, $tRectF)

    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE

    _GDIPlus_GraphicsDispose($hContext)
    _GDIPlus_BitmapDispose($hBitmap)
    _GDIPlus_EffectDispose($hEffect)
    _GDIPlus_ImageDispose($hImage)
    _GDIPlus_GraphicsDispose($hGraphics)
    _GDIPlus_Shutdown()
EndFunc   ;==>_Example