Funktionreferenz


_GDIPlus_GraphicsSetSmoothingMode

Beschreibung anzeigen in

Legt die Renderqualität des Grafik-Objekts fest

#include <GDIPlus.au3>
_GDIPlus_GraphicsSetSmoothingMode ( $hGraphics, $iSmooth )

Parameter

$hGraphics Handle auf ein Grafik-Objekt
$iSmooth Glättungsmodus:
    0 - keine Glättung
    1 - Glättung mit 8 X 4 Rechteckfilter
    2 - Glättung mit 8 X 8 kubischem Filter

Rückgabewert

Erfolg: True
Fehler: False und setzt das @error Flag auf ungleich null, das @extended Flag kann den GPSTATUS-Fehlercode ($GPID_ERR* siehe GDIPlusConstants.au3) enthalten.

Bemerkungen

Die Verwendung des Smoothing-Filter mit einem 8 X 8 Box-Filter erfordert mindestens das Bestriebssystem Windows Vista.

Verwandte Funktionen

_GDIPlus_GraphicsGetSmoothingMode

Siehe auch

Suche nach GdipSetSmoothingMode in der MSDN Bibliothek.

Beispiel

Beispiel 1

#include <GDIPlus.au3>
#include <GUIConstantsEx.au3>
#include <MsgBoxConstants.au3>

Example()

Func Example()
    Local $hGUI = GUICreate("GDI+ test", 640, 480)
    GUISetState(@SW_SHOW)

    _GDIPlus_Startup()
    Local $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGUI)
    Local $hPen = _GDIPlus_PenCreate()
    _GDIPlus_GraphicsDrawLine($hGraphics, 40, 40, 600, 440, $hPen) ;draw a test line to show smoothing effect (default no smoothing)
    MsgBox($MB_SYSTEMMODAL, "", "Smoothing enabled: " & _GDIPlus_GraphicsGetSmoothingMode($hGraphics))

    _GDIPlus_GraphicsSetSmoothingMode($hGraphics, $GDIP_SMOOTHINGMODE_HIGHQUALITY) ;set smoothing mode (8 X 4 box filter)
    _GDIPlus_GraphicsDrawLine($hGraphics, 600, 40, 40, 440, $hPen) ;draw a test line to show smoothing effect

    MsgBox($MB_SYSTEMMODAL, "", "Smoothing enabled: " & _GDIPlus_GraphicsGetSmoothingMode($hGraphics))

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

    ;cleanup resources
    _GDIPlus_PenDispose($hPen)
    _GDIPlus_GraphicsDispose($hGraphics)
    _GDIPlus_Shutdown()
    GUIDelete($hGUI)
EndFunc   ;==>Example

Beispiel 2

#include <GDIPlus.au3>

Global $iWidth = 400, $iHeight = 400
Global $hWnd, $hGraphics

$hWnd = GUICreate("GDI+ Smoothing Beispiel", 400, 400)
GUISetState()

_GDIPlus_Startup()

$hGraphics = _GDIPlus_GraphicsCreateFromHWND($hWnd) ;Grafik für die GUI erzeugen

;- Ohne Kantenglättung:
_GDIPlus_GraphicsSetSmoothingMode($hGraphics, 0)
_GDIPlus_GraphicsFillEllipse($hGraphics, 20, 100, 160, 200) ;Zeichnet eine schwarze Ellipse auf die GUI [links]
ConsoleWrite("Aktueller Kantenglättungsmodus: " & _GDIPlus_GraphicsGetSmoothingMode($hGraphics) & @CRLF)

;- Mit Kantenglättung:
_GDIPlus_GraphicsSetSmoothingMode($hGraphics, 2)
_GDIPlus_GraphicsFillEllipse($hGraphics, 220, 100, 160, 200) ;[rechts]
ConsoleWrite("Aktueller Kantenglättungsmodus: " & _GDIPlus_GraphicsGetSmoothingMode($hGraphics) & @CRLF)

;Ressourcen aufräumen!
_GDIPlus_GraphicsDispose($hGraphics)
_GDIPlus_Shutdown()

While GUIGetMsg() <> -3
WEnd