Obtient le contexte graphique de l'image
#include <GDIPlus.au3>
_GDIPlus_ImageGetGraphicsContext ( $hImage )
$hImage | Handle de l'objet image |
Succ�s: | Retourne le handle de l'objet Graphics. |
�chec: | Retourne -1 et d�finit @error <> 0, @extended contient le code erreur GPSTATUS ($GPID_ERR*). |
Consultez GdipGetImageGraphicsContext dans la Librairie MSDN.
#include <GDIPlus.au3> #include <GUIConstantsEx.au3> #include <ScreenCapture.au3> #include <WinAPIHObj.au3> Example() Func Example() Local $hBitmap1, $hBitmap2, $hImage1, $hImage2, $hGraphics ; Initialise la biblioth�que GDI+ _GDIPlus_Startup() ; Capture l'�cran complet $hBitmap1 = _ScreenCapture_Capture("") $hImage1 = _GDIPlus_BitmapCreateFromHBITMAP($hBitmap1) ; Capture une r�gion d'�cran $hBitmap2 = _ScreenCapture_Capture("", 0, 0, 400, 300) $hImage2 = _GDIPlus_BitmapCreateFromHBITMAP($hBitmap2) ; Dessine une image dans une autre $hGraphics = _GDIPlus_ImageGetGraphicsContext($hImage1) _GDIPlus_GraphicsDrawImage($hGraphics, $hImage2, 100, 100) ; Dessine un cadre autour de l'image ins�r�e _GDIPlus_GraphicsDrawRect($hGraphics, 100, 100, 400, 300) ; Enregistre l'image r�sultante _GDIPlus_ImageSaveToFile($hImage1, @MyDocumentsDir & "\GDIPlus_Image.jpg") ; Nettoie les ressources _GDIPlus_GraphicsDispose($hGraphics) _GDIPlus_ImageDispose($hImage1) _GDIPlus_ImageDispose($hImage2) _WinAPI_DeleteObject($hBitmap1) _WinAPI_DeleteObject($hBitmap2) ; Arr�te la biblioth�que GDI+ _GDIPlus_Shutdown() ShellExecute(@MyDocumentsDir & "\GDIPlus_Image.jpg") EndFunc ;==>Example