Crée un nouveau Bitmap en appliquant un effet spécifié à un Bitmap existant
#include <GDIPlus.au3>
_GDIPlus_BitmapCreateApplyEffectEx ( $hBitmap, $hEffect [, $iX = 0 [, $iY = 0 [, $iW = 0 [, $iH = 0]]]] )
$hBitmap | Handle du bitmap auquel l'effet est appliqué. |
$hEffect | Handle de l'effet à appliquer. |
$iX | [optionnel] La coordonnée X du coin supérieur gauche de la partie à laquelle l'effet est appliqué. |
$iY | [optionnel] La coordonnée Y du coin supérieur gauche de la partie à laquelle l'effet est appliqué. |
$iW | [optionnel] Spécifie la largeur de la partie à laquelle l'effet est appliqué. |
$iH | [optionnel] Spécifie la hauteur de la partie à laquelle l'effet est appliqué. |
Succès: | Retourne le handle de l'objet Bitmap. |
Échec: | Retourne 0 et définit @error <> 0, @extended contient le code erreur GPSTATUS ($GPID_ERR*). |
@error: | -1 - GDIPlus.dll ne supporte pas cette fonction. 10 - Paramètres invalides. |
Lorsque vous en avez terminé avec l'objet Effect, appelez _GDIPlus_EffectDispose() pour libérer les ressources.
_GDIPlus_BitmapCreateApplyEffect, _GDIPlus_EffectCreate
#include <GDIPlus.au3> #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> _Example() Func _Example() If Not _GDIPlus_Startup() Then MsgBox($MB_SYSTEMMODAL, "ERROR", "GDIPlus.dll v1.1 not available") Return EndIf Local $sFile = FileOpenDialog("Select an image", "", "Images (*.bmp;*.png;*.jpg;*.gif;*.tif)") If @error Or Not FileExists($sFile) Then Return Local $hImage = _GDIPlus_ImageLoadFromFile($sFile) Local $iImgW = _GDIPlus_ImageGetWidth($hImage) Local $iImgH = _GDIPlus_ImageGetHeight($hImage) Local $iWidth = 600 Local $iHeight = $iImgH * 600 / $iImgW Local $hGui = GUICreate("GDI+ v1.1", $iWidth, $iHeight) Local $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGui) GUISetState(@SW_SHOW) Local $hEffect = _GDIPlus_EffectCreate($GDIP_BlurEffectGuid) Local $tEffectParameters = DllStructCreate($tagGDIP_EFFECTPARAMS_Blur) Local $hBitmap For $i = 0 To 12 DllStructSetData($tEffectParameters, "Radius", Abs($i - 6) * 12) _GDIPlus_EffectSetParameters($hEffect, $tEffectParameters) $hBitmap = _GDIPlus_BitmapCreateApplyEffectEx($hImage, $hEffect, $i * Ceiling($iImgW / 13), 0, Ceiling($iImgW / 13) * 2, $iImgH) _GDIPlus_GraphicsDrawImageRect($hGraphics, $hBitmap, $i * Ceiling($iWidth / 13), 0, Ceiling($iWidth / 13), $iHeight) _GDIPlus_BitmapDispose($hBitmap) Next Do Until GUIGetMsg() = $GUI_EVENT_CLOSE _GDIPlus_EffectDispose($hEffect) _GDIPlus_ImageDispose($hImage) _GDIPlus_GraphicsDispose($hGraphics) _GDIPlus_Shutdown() EndFunc ;==>_Example