Restaure l'état d'un objet Graphics à l'état mémorisé par un appel précédent à la méthode _GDIPlus_GraphicsSave de l'objet Graphics
#include <GDIPlus.au3>
_GDIPlus_GraphicsRestore ( $hGraphics, $iState )
$hGraphics | Handle de l'objet Graphics |
$iState | Valeur identifiant le bloc de l'Etat sauvegardé précédemment retourné par la méthode _GDIPlus_GraphicsSave(). |
Succès: | Retourne True. |
Échec: | Retourne False et définit @error <> 0, @extended contient le code erreur GPSTATUS ($GPID_ERR*). |
Consultez GdipRestoreGraphics dans la Librairie MSDN.
#include <GDIPlus.au3> #include <GUIConstantsEx.au3> Example() Func Example() Local $iW, $iH, $hGUI, $hGraphic, $hBrush, $hPen, $hPath, $hFormat, $hFamily, $tLayout, $fSize, $iGfx_Save $iW = 800 $iH = 300 $hGUI = GUICreate("GDI+", $iW, $iH) GUISetState(@SW_SHOW) _GDIPlus_Startup() $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI) $hPath = _GDIPlus_PathCreate(1) For $i = 1 To 200 $fSize = Random(10, 30) _GDIPlus_PathAddEllipse($hPath, Random(0, $iW), Random(0, $iH), $fSize, $fSize) Next _GDIPlus_GraphicsSetClipPath($hGraphic, $hPath); Définir la région à découpage $iGfx_Save = _GDIPlus_GraphicsSave($hGraphic); Sauvegarde la région de découpage _GDIPlus_PathReset($hPath) $hFormat = _GDIPlus_StringFormatCreate() _GDIPlus_StringFormatSetAlign($hFormat, 1) _GDIPlus_StringFormatSetLineAlign($hFormat, 1) $hFamily = _GDIPlus_FontFamilyCreate("Arial Black") $tLayout = _GDIPlus_RectFCreate(0, 0, $iW, $iH) _GDIPlus_PathAddString($hPath, "AutoIt", $tLayout, $hFamily, 1, 200, $hFormat) _GDIPlus_GraphicsSetClipPath($hGraphic, $hPath, 3); Met à jour la région de découpage $hBrush = _GDIPlus_BrushCreateSolid(0xFF7F00FF) _GDIPlus_GraphicsFillPath($hGraphic, $hPath, $hBrush) _GDIPlus_GraphicsRestore($hGraphic, $iGfx_Save); Restaure la zone de découpage $hPen = _GDIPlus_PenCreate(0xFFFF007F) _GDIPlus_GraphicsDrawPath($hGraphic, $hPath, $hPen) ; Boucle jusqu'à ce que l'utilisateur quitte. Do Until GUIGetMsg() = $GUI_EVENT_CLOSE ; Nettoie les ressources _GDIPlus_FontFamilyDispose($hFamily) _GDIPlus_StringFormatDispose($hFormat) _GDIPlus_PathDispose($hPath) _GDIPlus_PenDispose($hPen) _GDIPlus_BrushDispose($hBrush) _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_Shutdown() EndFunc ;==>Example