Funktionreferenz


_GDIPlus_GraphicsRestore


Restores the state of a Graphics object to the state stored by a previous call to the _GDIPlus_GraphicsSave method of the Graphics object

#include <GDIPlus.au3>
_GDIPlus_GraphicsRestore ( $hGraphics, $iState )

Parameter

$hGraphics Pointer to a Graphics object
$iState Value identifying the block of saved state previously returned by _GDIPlus_GraphicsSave().

Rückgabewert

Success: True.
Failure: False and sets the @error flag to non-zero, @extended may contain GPSTATUS error code ($GPIP_ERR* see GPIPlusConstants.au3).

Bemerkungen

None.

Verwandte Funktionen

_GDIPlus_GraphicsSave

Siehe auch

Suche nach GdipRestoreGraphics in der MSDN Bibliothek.

Beispiel

#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);set clipping region
    $iGfx_Save = _GDIPlus_GraphicsSave($hGraphic);save clipping region

    _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);update clipping region

    $hBrush = _GDIPlus_BrushCreateSolid(0xFF7F00FF)
    _GDIPlus_GraphicsFillPath($hGraphic, $hPath, $hBrush)

    _GDIPlus_GraphicsRestore($hGraphic, $iGfx_Save);restore clipping region

    $hPen = _GDIPlus_PenCreate(0xFFFF007F)
    _GDIPlus_GraphicsDrawPath($hGraphic, $hPath, $hPen)

    ; Loop until the user exits.
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE

    ; Clean up resources
    _GDIPlus_FontFamilyDispose($hFamily)
    _GDIPlus_StringFormatDispose($hFormat)
    _GDIPlus_PathDispose($hPath)
    _GDIPlus_PenDispose($hPen)
    _GDIPlus_BrushDispose($hBrush)
    _GDIPlus_GraphicsDispose($hGraphic)
    _GDIPlus_Shutdown()
EndFunc   ;==>Example