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

GdipSetImageAttributesGamma

関数
画像属性にガンマ補正値を設定する。
DLLgdiplus.dll呼出規約winapi

シグネチャ

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

Status GdipSetImageAttributesGamma(
    GpImageAttributes* imageattr,
    ColorAdjustType type,
    BOOL enableFlag,
    FLOAT gamma
);

パラメーター

名前方向
imageattrGpImageAttributes*inout
typeColorAdjustTypein
enableFlagBOOLin
gammaFLOATin

戻り値の型: Status

各言語での呼び出し定義

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

Status GdipSetImageAttributesGamma(
    GpImageAttributes* imageattr,
    ColorAdjustType type,
    BOOL enableFlag,
    FLOAT gamma
);
[DllImport("gdiplus.dll", ExactSpelling = true)]
static extern int GdipSetImageAttributesGamma(
    IntPtr imageattr,   // GpImageAttributes* in/out
    int type,   // ColorAdjustType
    bool enableFlag,   // BOOL
    float gamma   // FLOAT
);
<DllImport("gdiplus.dll", ExactSpelling:=True)>
Public Shared Function GdipSetImageAttributesGamma(
    imageattr As IntPtr,   ' GpImageAttributes* in/out
    type As Integer,   ' ColorAdjustType
    enableFlag As Boolean,   ' BOOL
    gamma As Single   ' FLOAT
) As Integer
End Function
' imageattr : GpImageAttributes* in/out
' type : ColorAdjustType
' enableFlag : BOOL
' gamma : FLOAT
Declare PtrSafe Function GdipSetImageAttributesGamma Lib "gdiplus" ( _
    ByVal imageattr As LongPtr, _
    ByVal type As Long, _
    ByVal enableFlag As Long, _
    ByVal gamma As Single) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

GdipSetImageAttributesGamma = ctypes.windll.gdiplus.GdipSetImageAttributesGamma
GdipSetImageAttributesGamma.restype = ctypes.c_int
GdipSetImageAttributesGamma.argtypes = [
    ctypes.c_void_p,  # imageattr : GpImageAttributes* in/out
    ctypes.c_int,  # type : ColorAdjustType
    wintypes.BOOL,  # enableFlag : BOOL
    ctypes.c_float,  # gamma : FLOAT
]
require 'fiddle'
require 'fiddle/import'

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

var (
	gdiplus = windows.NewLazySystemDLL("gdiplus.dll")
	procGdipSetImageAttributesGamma = gdiplus.NewProc("GdipSetImageAttributesGamma")
)

// imageattr (GpImageAttributes* in/out), type (ColorAdjustType), enableFlag (BOOL), gamma (FLOAT)
r1, _, err := procGdipSetImageAttributesGamma.Call(
	uintptr(imageattr),
	uintptr(type),
	uintptr(enableFlag),
	uintptr(math.Float32bits(gamma)),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // Status
// 注意: float/double 引数は proc.Call では XMM レジスタに渡せません。
// windows.SyscallN(proc.Addr(), math.Float64bits(x), ...) もしくは cgo を使用してください。
function GdipSetImageAttributesGamma(
  imageattr: Pointer;   // GpImageAttributes* in/out
  type: Integer;   // ColorAdjustType
  enableFlag: BOOL;   // BOOL
  gamma: Single   // FLOAT
): Integer; stdcall;
  external 'gdiplus.dll' name 'GdipSetImageAttributesGamma';
result := DllCall("gdiplus\GdipSetImageAttributesGamma"
    , "Ptr", imageattr   ; GpImageAttributes* in/out
    , "Int", type   ; ColorAdjustType
    , "Int", enableFlag   ; BOOL
    , "Float", gamma   ; FLOAT
    , "Int")   ; return: Status
●GdipSetImageAttributesGamma(imageattr, type, enableFlag, gamma) = DLL("gdiplus.dll", "int GdipSetImageAttributesGamma(void*, int, bool, float)")
# 呼び出し: GdipSetImageAttributesGamma(imageattr, type, enableFlag, gamma)
# imageattr : GpImageAttributes* in/out -> "void*"
# type : ColorAdjustType -> "int"
# enableFlag : BOOL -> "bool"
# gamma : FLOAT -> "float"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。