Red�finit la r�gion de d�coupage d'un objet Graphics � une r�gion qui est la combinaison d'elle-m�me et de la r�gion sp�cifi� par un chemin graphique
#include <GDIPlus.au3>
_GDIPlus_GraphicsSetClipPath ( $hGraphics, $hPath [, $iCombineMode = 0] )
$hGraphics | Handle de l'objet Graphics |
$hPath | Handle de l'objet GraphicsPath qui sp�cifie la r�gion qui sera combin�e avec la r�gion de d�coupage de l'objet graphique |
$iCombineMode | [optionnel] Mode de combinaison des r�gions: 0 - La r�gion existante est remplac�e par la nouvelle r�gion 1 - La r�gion existante est remplac�e par l'intersection d'elle-m�me et de la nouvelle r�gion 2 - La r�gion existante est remplac�e par l'union d'elle-m�me et de la nouvelle r�gion 3 - La r�gion existant est remplac�e par le r�sultat de l'ex�cution d'un OU exclusif sur les deux r�gions 4 - La r�gion existante est remplac�e par la portion d'elle-m�me qui est en dehors de la nouvelle r�gion 5 - La r�gion existante est remplac�e par la portion de la nouvelle r�gion qui est en dehors de la r�gion existante |
Succ�s: | Retourne True. |
�chec: | Retourne False et d�finit @error <> 0, @extended contient le code erreur GPSTATUS ($GPID_ERR*). |
Si la figure du chemin graphique n'est pas ferm�e, cette m�thode traite la figure non ferm�e comme si elle �tait ferm�e par un segment qui relie les points de d�but et de fin de la figure.
Consultez GdipSetClipPath dans la Librairie MSDN.
#include <GDIPlus.au3> #include <GUIConstantsEx.au3> #include <ScreenCapture.au3> #include <WinAPIHObj.au3> Example() Func Example() Local $hBMP = _ScreenCapture_Capture() Local $hGUI = GUICreate("GDI+", 400, 400) GUISetState(@SW_SHOW) _GDIPlus_Startup() Local $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGUI) ; Cr�e un objet graphique � partir du handle de la fen�tre Local $hBmp_Buffer = _GDIPlus_BitmapCreateFromGraphics(400, 400, $hGraphics) Local $hGfx_Buffer = _GDIPlus_ImageGetGraphicsContext($hBmp_Buffer) Local $hBitmap = _GDIPlus_BitmapCreateFromHBITMAP($hBMP) Local $hMatrix1 = _GDIPlus_MatrixCreate() _GDIPlus_MatrixTranslate($hMatrix1, 200, 200) Local $hMatrix2 = _GDIPlus_MatrixCreate() _GDIPlus_MatrixTranslate($hMatrix2, 200, 200) Local $hPath = _GDIPlus_PathCreate() For $i = 0 To 300 Step 24 _GDIPlus_PathAddEllipse($hPath, -$i, -$i, $i * 2, $i * 2) Next Local $hRegion = _GDIPlus_RegionCreate() _GDIPlus_RegionCombinePath($hRegion, $hPath, 4) Local $hTimer = TimerInit() ; Boucle jusqu'� ce que l'utilisateur quitte. Do If TimerDiff($hTimer) > 20 Then _GDIPlus_GraphicsResetClip($hGfx_Buffer) _GDIPlus_GraphicsClear($hGfx_Buffer, 0x33FFAA00) _GDIPlus_MatrixRotate($hMatrix1, 1) _GDIPlus_MatrixRotate($hMatrix2, -1) _GDIPlus_GraphicsSetTransform($hGfx_Buffer, $hMatrix1) _GDIPlus_GraphicsSetClipRegion($hGfx_Buffer, $hRegion) _GDIPlus_GraphicsDrawImage($hGfx_Buffer, $hBitmap, -300, -300) _GDIPlus_GraphicsSetTransform($hGfx_Buffer, $hMatrix2) _GDIPlus_GraphicsSetClipPath($hGfx_Buffer, $hPath) _GDIPlus_GraphicsDrawImage($hGfx_Buffer, $hBitmap, -300, -300) _GDIPlus_GraphicsDrawImage($hGraphics, $hBmp_Buffer, 0, 0) $hTimer = TimerInit() EndIf Until GUIGetMsg() = $GUI_EVENT_CLOSE ; Nettoie les ressources _GDIPlus_RegionDispose($hRegion) _GDIPlus_PathDispose($hPath) _GDIPlus_MatrixDispose($hMatrix1) _GDIPlus_MatrixDispose($hMatrix2) _GDIPlus_BitmapDispose($hBitmap) _WinAPI_DeleteObject($hBMP) _GDIPlus_GraphicsDispose($hGfx_Buffer) _GDIPlus_BitmapDispose($hBmp_Buffer) _GDIPlus_GraphicsDispose($hGraphics) _GDIPlus_Shutdown() EndFunc ;==>Example