UDF > GDIPlus > Graphics >


_GDIPlus_GraphicsGetInterpolationMode

Obtient le mode d'interpolation actuellement installée pour un objet Graphics

#include <GDIPlus.au3>
_GDIPlus_GraphicsGetInterpolationMode ( $hGraphics )

Paramètre

$hGraphics Le handle de l'objet Graphics

Valeur de retour

Succès: Retourne le mode d'interpolation :
    0 - Mode d'interpolation par défaut
    1 - Mode basse qualité
    2 - Mode haute qualité
    3 - Interpolation bilinéaire. Aucun pré-filtrage n'est effectué
    4 - Interpolation bicubique. Aucun pré-filtrage n'est effectué
    5 - Interpolation proximale (plus proche voisin)
    6 - Haute qualité, interpolation bilinéaire. Préfiltrage effectué pour assurer la haute qualité d'un rétrécissement d'image
    7 - de haute qualité, interpolation bicubique. Préfiltrage effectué pour assurer la haute qualité d'un rétrécissement d'image
Échec: Retourne -1 et positionne @error <> 0, @extended contient le code erreur GPSTATUS ($GPID_ERR*).

En relation

_GDIPlus_GraphicsSetInterpolationMode

Voir aussi

Consultez GdipGetInterpolationMode dans la Librairie MSDN.

Exemple

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

Example()

Func Example()
    _GDIPlus_Startup()
    Local Const $iW = @DesktopWidth / 4, $iH = @DesktopHeight / 4
    Local $hGUI = GUICreate("GDI+ test", $iW, $iH, -1, 10)
    GUISetState(@SW_SHOW)

    Local $aIM[8] = ["Default", "Low Quality", "High Quality", "Bilinear", "Bicubic", "Nearest Neighbor", "High Quality Bilinear", "High Quality Bicubic"]

    Local $hHBmp = _ScreenCapture_Capture("", 0, 0, -1, -1) ; Crée un bitmap GDI en capturant l'ensemble du bureau
    Local $hBitmap = _GDIPlus_BitmapCreateFromHBITMAP($hHBmp) ; Convertit le bitmap GDI en GDI+
    _WinAPI_DeleteObject($hHBmp) ; Libère la ressource du bitmap GDI car elle n'est plus utile

    Local $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGUI) ; Crée un objet Graphics à partir du handle de la fenêtre
    Local $iIM = _GDIPlus_GraphicsGetInterpolationMode($hGraphics)
    _GDIPlus_GraphicsDrawImageRect($hGraphics, $hBitmap, 0, 0, $iW, $iH) ; Dessine le bitmap capturée dans la GUI avec le mode d'interpolation par défaut du système
    MsgBox($MB_SYSTEMMODAL, "", "Interpolation Mode initial: " & $aIM[$iIM])

    _GDIPlus_GraphicsSetInterpolationMode($hGraphics, $GDIP_INTERPOLATIONMODE_NearestNeighbor) ; change le mode d'interpolation
    _GDIPlus_GraphicsDrawImageRect($hGraphics, $hBitmap, 0, 0, $iW, $iH) ; Dessine de nouveau le même bitmap mais avec un mode d'interpolation différent
    $iIM = _GDIPlus_GraphicsGetInterpolationMode($hGraphics)
    MsgBox($MB_SYSTEMMODAL, "", "Interpolation Mode after: " & $aIM[$iIM])

    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE 

    ; Nettoie
    _GDIPlus_GraphicsDispose($hGraphics)
    _GDIPlus_BitmapDispose($hBitmap)
    _GDIPlus_Shutdown()
    GUIDelete($hGUI)
EndFunc   ;==>Example