Funktionreferenz


_GDIPlus_ImageAttributesSetThreshold


Sets the threshold (transparency range) for a specified category

#include <GDIPlus.au3>
_GDIPlus_ImageAttributesSetThreshold ( $hImageAttributes, $fThreshold [, $iColorAdjustType = $GDIP_COLORADJUSTTYPE_DEFAULT [, $bEnable = True]] )

Parameter

$hImageAttributes A pointer to a ImageAttribute handle.
$fThreshold Real number that specifies the threshold value.
$iColorAdjustType [optional] Element of the ColorAdjustType enumeration that specifies the category for which the color threshold is set. The default value is ColorAdjustTypeDefault.
$bEnable [optional] Boolean value that specifies whether a separate threshold is enabled for the category specified by the type parameter. Default is True.

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

https://msdn.microsoft.com/en-us/library/8k0d325b(v=vs.110).aspx#Anchor_2

Verwandte Funktionen

_GDIPlus_ImageAttributesCreate, _GDIPlus_ImageAttributesDispose, _GDIPlus_ImageAttributesSetColorMatrix

Siehe auch

Suche nach GdipSetImageAttributesThreshold in der MSDN Bibliothek.

Beispiel

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

Example()

Func Example()
    _GDIPlus_Startup()
    Local Const $iW = @DesktopWidth / 2, $iH = @DesktopHeight / 2

    Local $hGui = GUICreate("GDI+", $iW, $iH)
    GUISetState()

    Local $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGui)

    Local $hHBitmap = _ScreenCapture_Capture("", 0, 0, $iW, $iH)
    Local $hBitmap = _GDIPlus_BitmapCreateFromHBITMAP($hHBitmap)

    Local $hIA = _GDIPlus_ImageAttributesCreate()
    _GDIPlus_ImageAttributesSetThreshold($hIA, 0.6666) ;create black & white bitmap
    Local $tBWMatrix = _GDIPlus_ColorMatrixCreateGrayScale()
    Local $pBWMatrix = DllStructGetPtr($tBWMatrix)
    _GDIPlus_ImageAttributesSetColorMatrix($hIA, $GDIP_COLORADJUSTTYPE_DEFAULT, True, $pBWMatrix)

    _GDIPlus_GraphicsDrawImageRectRect($hGraphics, $hBitmap, 0, 0, $iW, $iH, 0, 0, $iW, $iH, $hIA)

    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                ExitLoop
        EndSwitch
    WEnd

    _GDIPlus_ImageAttributesDispose($hIA)
    _WinAPI_DeleteObject($hHBitmap)
    _GDIPlus_GraphicsDispose($hGraphics)
    _GDIPlus_BitmapDispose($hBitmap)
    _GDIPlus_Shutdown()
EndFunc   ;==>Example