Modifie un bitmap en appliquant un effet spécifié
#include <GDIPlus.au3>
_GDIPlus_BitmapApplyEffect ( $hBitmap, $hEffect [, $tRECT = Null] )
$hBitmap | Handle du Bitmap auquel l'effet est appliqué. |
$hEffect | Handle de l'effet à appliquer. |
$tRECT | [optionnel] Structure $tagRECT qui spécifie la partie du bitmap d'entrée à laquelle l'effet est appliqué. |
Succès: | Retourne True. |
Échec: | Retourne False 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. |
Passez Null pour le paramètre $tRect pour spécifier que l'effet s'applique au bitmap d'entrée entier (par défaut).
$tagRECT, _GDIPlus_BitmapApplyEffectEx, _GDIPlus_EffectCreate
Consultez GdipBitmapApplyEffect dans la Librairie MSDN.
#include <GDIPlus.au3> #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> _Example() Func _Example() If Not _GDIPlus_Startup() Or @extended < 6 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 (" & @ScriptName & ")", $iWidth, $iHeight) Local $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGui) GUISetState(@SW_SHOW) Local $hEffect = _GDIPlus_EffectCreateHueSaturationLightness(0, -100, 0) Local $tRECT = DllStructCreate($tagRECT) $tRECT.Left = $iImgW * 0.25 $tRECT.Top = $iImgH * 0.25 $tRECT.Right = $tRECT.Left + $iImgW * 0.5 $tRECT.Bottom = $tRECT.Top + $iImgH * 0.5 _GDIPlus_BitmapApplyEffect($hImage, $hEffect, $tRECT) _GDIPlus_GraphicsDrawImageRect($hGraphics, $hImage, 0, 0, $iWidth, $iHeight) Do Until GUIGetMsg() = $GUI_EVENT_CLOSE _GDIPlus_EffectDispose($hEffect) _GDIPlus_ImageDispose($hImage) _GDIPlus_GraphicsDispose($hGraphics) _GDIPlus_Shutdown() EndFunc ;==>_Example