Win32 API 日本語リファレンス
ホームGraphics.GdiPlus › GdipSetSmoothingMode

GdipSetSmoothingMode

関数
Graphicsのアンチエイリアス(スムージング)モードを設定する。
DLLgdiplus.dll呼出規約winapi

シグネチャ

// gdiplus.dll
#include <windows.h>

Status GdipSetSmoothingMode(
    GpGraphics* graphics,
    SmoothingMode smoothingMode
);

パラメーター

名前方向
graphicsGpGraphics*inout
smoothingModeSmoothingModein

戻り値の型: Status

各言語での呼び出し定義

// gdiplus.dll
#include <windows.h>

Status GdipSetSmoothingMode(
    GpGraphics* graphics,
    SmoothingMode smoothingMode
);
[DllImport("gdiplus.dll", ExactSpelling = true)]
static extern int GdipSetSmoothingMode(
    IntPtr graphics,   // GpGraphics* in/out
    int smoothingMode   // SmoothingMode
);
<DllImport("gdiplus.dll", ExactSpelling:=True)>
Public Shared Function GdipSetSmoothingMode(
    graphics As IntPtr,   ' GpGraphics* in/out
    smoothingMode As Integer   ' SmoothingMode
) As Integer
End Function
' graphics : GpGraphics* in/out
' smoothingMode : SmoothingMode
Declare PtrSafe Function GdipSetSmoothingMode Lib "gdiplus" ( _
    ByVal graphics As LongPtr, _
    ByVal smoothingMode As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

GdipSetSmoothingMode = ctypes.windll.gdiplus.GdipSetSmoothingMode
GdipSetSmoothingMode.restype = ctypes.c_int
GdipSetSmoothingMode.argtypes = [
    ctypes.c_void_p,  # graphics : GpGraphics* in/out
    ctypes.c_int,  # smoothingMode : SmoothingMode
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('gdiplus.dll')
GdipSetSmoothingMode = Fiddle::Function.new(
  lib['GdipSetSmoothingMode'],
  [
    Fiddle::TYPE_VOIDP,  # graphics : GpGraphics* in/out
    Fiddle::TYPE_INT,  # smoothingMode : SmoothingMode
  ],
  Fiddle::TYPE_INT)
#[link(name = "gdiplus")]
extern "system" {
    fn GdipSetSmoothingMode(
        graphics: *mut GpGraphics,  // GpGraphics* in/out
        smoothingMode: i32  // SmoothingMode
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("gdiplus.dll")]
public static extern int GdipSetSmoothingMode(IntPtr graphics, int smoothingMode);
"@
$api = Add-Type -MemberDefinition $sig -Name 'gdiplus_GdipSetSmoothingMode' -Namespace Win32 -PassThru
# $api::GdipSetSmoothingMode(graphics, smoothingMode)
#uselib "gdiplus.dll"
#func global GdipSetSmoothingMode "GdipSetSmoothingMode" sptr, sptr
; GdipSetSmoothingMode varptr(graphics), smoothingMode   ; 戻り値は stat
; graphics : GpGraphics* in/out -> "sptr"
; smoothingMode : SmoothingMode -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "gdiplus.dll"
#cfunc global GdipSetSmoothingMode "GdipSetSmoothingMode" var, int
; res = GdipSetSmoothingMode(graphics, smoothingMode)
; graphics : GpGraphics* in/out -> "var"
; smoothingMode : SmoothingMode -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; Status GdipSetSmoothingMode(GpGraphics* graphics, SmoothingMode smoothingMode)
#uselib "gdiplus.dll"
#cfunc global GdipSetSmoothingMode "GdipSetSmoothingMode" var, int
; res = GdipSetSmoothingMode(graphics, smoothingMode)
; graphics : GpGraphics* in/out -> "var"
; smoothingMode : SmoothingMode -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	gdiplus = windows.NewLazySystemDLL("gdiplus.dll")
	procGdipSetSmoothingMode = gdiplus.NewProc("GdipSetSmoothingMode")
)

// graphics (GpGraphics* in/out), smoothingMode (SmoothingMode)
r1, _, err := procGdipSetSmoothingMode.Call(
	uintptr(graphics),
	uintptr(smoothingMode),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // Status
function GdipSetSmoothingMode(
  graphics: Pointer;   // GpGraphics* in/out
  smoothingMode: Integer   // SmoothingMode
): Integer; stdcall;
  external 'gdiplus.dll' name 'GdipSetSmoothingMode';
result := DllCall("gdiplus\GdipSetSmoothingMode"
    , "Ptr", graphics   ; GpGraphics* in/out
    , "Int", smoothingMode   ; SmoothingMode
    , "Int")   ; return: Status
●GdipSetSmoothingMode(graphics, smoothingMode) = DLL("gdiplus.dll", "int GdipSetSmoothingMode(void*, int)")
# 呼び出し: GdipSetSmoothingMode(graphics, smoothingMode)
# graphics : GpGraphics* in/out -> "void*"
# smoothingMode : SmoothingMode -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。