ホーム › Graphics.GdiPlus › GdipSetImageAttributesColorKeys
GdipSetImageAttributesColorKeys
関数画像属性に透過対象となるカラーキー範囲を設定する。
シグネチャ
// gdiplus.dll
#include <windows.h>
Status GdipSetImageAttributesColorKeys(
GpImageAttributes* imageattr,
ColorAdjustType type,
BOOL enableFlag,
DWORD colorLow,
DWORD colorHigh
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| imageattr | GpImageAttributes* | inout |
| type | ColorAdjustType | in |
| enableFlag | BOOL | in |
| colorLow | DWORD | in |
| colorHigh | DWORD | in |
戻り値の型: Status
各言語での呼び出し定義
// gdiplus.dll
#include <windows.h>
Status GdipSetImageAttributesColorKeys(
GpImageAttributes* imageattr,
ColorAdjustType type,
BOOL enableFlag,
DWORD colorLow,
DWORD colorHigh
);[DllImport("gdiplus.dll", ExactSpelling = true)]
static extern int GdipSetImageAttributesColorKeys(
IntPtr imageattr, // GpImageAttributes* in/out
int type, // ColorAdjustType
bool enableFlag, // BOOL
uint colorLow, // DWORD
uint colorHigh // DWORD
);<DllImport("gdiplus.dll", ExactSpelling:=True)>
Public Shared Function GdipSetImageAttributesColorKeys(
imageattr As IntPtr, ' GpImageAttributes* in/out
type As Integer, ' ColorAdjustType
enableFlag As Boolean, ' BOOL
colorLow As UInteger, ' DWORD
colorHigh As UInteger ' DWORD
) As Integer
End Function' imageattr : GpImageAttributes* in/out
' type : ColorAdjustType
' enableFlag : BOOL
' colorLow : DWORD
' colorHigh : DWORD
Declare PtrSafe Function GdipSetImageAttributesColorKeys Lib "gdiplus" ( _
ByVal imageattr As LongPtr, _
ByVal type As Long, _
ByVal enableFlag As Long, _
ByVal colorLow As Long, _
ByVal colorHigh As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
GdipSetImageAttributesColorKeys = ctypes.windll.gdiplus.GdipSetImageAttributesColorKeys
GdipSetImageAttributesColorKeys.restype = ctypes.c_int
GdipSetImageAttributesColorKeys.argtypes = [
ctypes.c_void_p, # imageattr : GpImageAttributes* in/out
ctypes.c_int, # type : ColorAdjustType
wintypes.BOOL, # enableFlag : BOOL
wintypes.DWORD, # colorLow : DWORD
wintypes.DWORD, # colorHigh : DWORD
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('gdiplus.dll')
GdipSetImageAttributesColorKeys = Fiddle::Function.new(
lib['GdipSetImageAttributesColorKeys'],
[
Fiddle::TYPE_VOIDP, # imageattr : GpImageAttributes* in/out
Fiddle::TYPE_INT, # type : ColorAdjustType
Fiddle::TYPE_INT, # enableFlag : BOOL
-Fiddle::TYPE_INT, # colorLow : DWORD
-Fiddle::TYPE_INT, # colorHigh : DWORD
],
Fiddle::TYPE_INT)#[link(name = "gdiplus")]
extern "system" {
fn GdipSetImageAttributesColorKeys(
imageattr: *mut GpImageAttributes, // GpImageAttributes* in/out
type: i32, // ColorAdjustType
enableFlag: i32, // BOOL
colorLow: u32, // DWORD
colorHigh: u32 // DWORD
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("gdiplus.dll")]
public static extern int GdipSetImageAttributesColorKeys(IntPtr imageattr, int type, bool enableFlag, uint colorLow, uint colorHigh);
"@
$api = Add-Type -MemberDefinition $sig -Name 'gdiplus_GdipSetImageAttributesColorKeys' -Namespace Win32 -PassThru
# $api::GdipSetImageAttributesColorKeys(imageattr, type, enableFlag, colorLow, colorHigh)#uselib "gdiplus.dll"
#func global GdipSetImageAttributesColorKeys "GdipSetImageAttributesColorKeys" sptr, sptr, sptr, sptr, sptr
; GdipSetImageAttributesColorKeys varptr(imageattr), type, enableFlag, colorLow, colorHigh ; 戻り値は stat
; imageattr : GpImageAttributes* in/out -> "sptr"
; type : ColorAdjustType -> "sptr"
; enableFlag : BOOL -> "sptr"
; colorLow : DWORD -> "sptr"
; colorHigh : DWORD -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "gdiplus.dll" #cfunc global GdipSetImageAttributesColorKeys "GdipSetImageAttributesColorKeys" var, int, int, int, int ; res = GdipSetImageAttributesColorKeys(imageattr, type, enableFlag, colorLow, colorHigh) ; imageattr : GpImageAttributes* in/out -> "var" ; type : ColorAdjustType -> "int" ; enableFlag : BOOL -> "int" ; colorLow : DWORD -> "int" ; colorHigh : DWORD -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "gdiplus.dll" #cfunc global GdipSetImageAttributesColorKeys "GdipSetImageAttributesColorKeys" sptr, int, int, int, int ; res = GdipSetImageAttributesColorKeys(varptr(imageattr), type, enableFlag, colorLow, colorHigh) ; imageattr : GpImageAttributes* in/out -> "sptr" ; type : ColorAdjustType -> "int" ; enableFlag : BOOL -> "int" ; colorLow : DWORD -> "int" ; colorHigh : DWORD -> "int" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; Status GdipSetImageAttributesColorKeys(GpImageAttributes* imageattr, ColorAdjustType type, BOOL enableFlag, DWORD colorLow, DWORD colorHigh) #uselib "gdiplus.dll" #cfunc global GdipSetImageAttributesColorKeys "GdipSetImageAttributesColorKeys" var, int, int, int, int ; res = GdipSetImageAttributesColorKeys(imageattr, type, enableFlag, colorLow, colorHigh) ; imageattr : GpImageAttributes* in/out -> "var" ; type : ColorAdjustType -> "int" ; enableFlag : BOOL -> "int" ; colorLow : DWORD -> "int" ; colorHigh : DWORD -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; Status GdipSetImageAttributesColorKeys(GpImageAttributes* imageattr, ColorAdjustType type, BOOL enableFlag, DWORD colorLow, DWORD colorHigh) #uselib "gdiplus.dll" #cfunc global GdipSetImageAttributesColorKeys "GdipSetImageAttributesColorKeys" intptr, int, int, int, int ; res = GdipSetImageAttributesColorKeys(varptr(imageattr), type, enableFlag, colorLow, colorHigh) ; imageattr : GpImageAttributes* in/out -> "intptr" ; type : ColorAdjustType -> "int" ; enableFlag : BOOL -> "int" ; colorLow : DWORD -> "int" ; colorHigh : DWORD -> "int" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
gdiplus = windows.NewLazySystemDLL("gdiplus.dll")
procGdipSetImageAttributesColorKeys = gdiplus.NewProc("GdipSetImageAttributesColorKeys")
)
// imageattr (GpImageAttributes* in/out), type (ColorAdjustType), enableFlag (BOOL), colorLow (DWORD), colorHigh (DWORD)
r1, _, err := procGdipSetImageAttributesColorKeys.Call(
uintptr(imageattr),
uintptr(type),
uintptr(enableFlag),
uintptr(colorLow),
uintptr(colorHigh),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // Statusfunction GdipSetImageAttributesColorKeys(
imageattr: Pointer; // GpImageAttributes* in/out
type: Integer; // ColorAdjustType
enableFlag: BOOL; // BOOL
colorLow: DWORD; // DWORD
colorHigh: DWORD // DWORD
): Integer; stdcall;
external 'gdiplus.dll' name 'GdipSetImageAttributesColorKeys';result := DllCall("gdiplus\GdipSetImageAttributesColorKeys"
, "Ptr", imageattr ; GpImageAttributes* in/out
, "Int", type ; ColorAdjustType
, "Int", enableFlag ; BOOL
, "UInt", colorLow ; DWORD
, "UInt", colorHigh ; DWORD
, "Int") ; return: Status●GdipSetImageAttributesColorKeys(imageattr, type, enableFlag, colorLow, colorHigh) = DLL("gdiplus.dll", "int GdipSetImageAttributesColorKeys(void*, int, bool, dword, dword)")
# 呼び出し: GdipSetImageAttributesColorKeys(imageattr, type, enableFlag, colorLow, colorHigh)
# imageattr : GpImageAttributes* in/out -> "void*"
# type : ColorAdjustType -> "int"
# enableFlag : BOOL -> "bool"
# colorLow : DWORD -> "dword"
# colorHigh : DWORD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。