Function Reference


_GDIPlus_GraphicsClear

Clears a Graphics object to a specified color

#include <GDIPlus.au3>
_GDIPlus_GraphicsClear ( $hGraphics [, $iARGB = 0xFF000000] )

Parameters

$hGraphics Handle to a Graphics object
$iARGB [optional] Alpha, Red, Green and Blue components of color

Return Value

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

See Also

Search GdipGraphicsClear in MSDN Library.

Example

#include <GDIPlus.au3>
#include <GUIConstantsEx.au3>
#include <ScreenCapture.au3>
#include <WinAPIHObj.au3>

Example()

Func Example()
        Local $hBitmap, $hImage, $hGraphic

        ; Initialize GDI+ library
        _GDIPlus_Startup()

        ; Capture screen region
        $hBitmap = _ScreenCapture_Capture("", 0, 0, 400, 300)
        $hImage = _GDIPlus_BitmapCreateFromHBITMAP($hBitmap)

        ; Clear the screen capture
        $hGraphic = _GDIPlus_ImageGetGraphicsContext($hImage)
        _GDIPlus_GraphicsClear($hGraphic)

        ; Save resultant image
        _GDIPlus_ImageSaveToFile($hImage, @MyDocumentsDir & "\GDIPlus_Image.jpg")

        ; Clean up resources
        _GDIPlus_GraphicsDispose($hGraphic)
        _GDIPlus_ImageDispose($hImage)
        _WinAPI_DeleteObject($hBitmap)

        ; Shut down GDI+ library
        _GDIPlus_Shutdown()

        ShellExecute(@MyDocumentsDir & "\GDIPlus_Image.jpg")
EndFunc   ;==>Example