ホーム › Graphics.GdiPlus › GdipSetImageAttributesRemapTable
GdipSetImageAttributesRemapTable
関数画像属性に色を置換するリマップテーブルを設定する。
シグネチャ
// gdiplus.dll
#include <windows.h>
Status GdipSetImageAttributesRemapTable(
GpImageAttributes* imageattr,
ColorAdjustType type,
BOOL enableFlag,
DWORD mapSize,
const ColorMap* map
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| imageattr | GpImageAttributes* | inout | 操作対象のGpImageAttributesオブジェクトへのポインタ。 |
| type | ColorAdjustType | in | 適用対象のカテゴリを示すColorAdjustType列挙値。 |
| enableFlag | BOOL | in | 色の再マッピングを有効にするかを示すBOOL(FALSEで無効化)。 |
| mapSize | DWORD | in | map配列に含まれるColorMapエントリの個数。 |
| map | ColorMap* | in | 変換前後の色対応を定義するColorMap構造体配列へのポインタ。 |
戻り値の型: Status
各言語での呼び出し定義
// gdiplus.dll
#include <windows.h>
Status GdipSetImageAttributesRemapTable(
GpImageAttributes* imageattr,
ColorAdjustType type,
BOOL enableFlag,
DWORD mapSize,
const ColorMap* map
);[DllImport("gdiplus.dll", ExactSpelling = true)]
static extern int GdipSetImageAttributesRemapTable(
IntPtr imageattr, // GpImageAttributes* in/out
int type, // ColorAdjustType
bool enableFlag, // BOOL
uint mapSize, // DWORD
IntPtr map // ColorMap*
);<DllImport("gdiplus.dll", ExactSpelling:=True)>
Public Shared Function GdipSetImageAttributesRemapTable(
imageattr As IntPtr, ' GpImageAttributes* in/out
type As Integer, ' ColorAdjustType
enableFlag As Boolean, ' BOOL
mapSize As UInteger, ' DWORD
map As IntPtr ' ColorMap*
) As Integer
End Function' imageattr : GpImageAttributes* in/out
' type : ColorAdjustType
' enableFlag : BOOL
' mapSize : DWORD
' map : ColorMap*
Declare PtrSafe Function GdipSetImageAttributesRemapTable Lib "gdiplus" ( _
ByVal imageattr As LongPtr, _
ByVal type As Long, _
ByVal enableFlag As Long, _
ByVal mapSize As Long, _
ByVal map As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
GdipSetImageAttributesRemapTable = ctypes.windll.gdiplus.GdipSetImageAttributesRemapTable
GdipSetImageAttributesRemapTable.restype = ctypes.c_int
GdipSetImageAttributesRemapTable.argtypes = [
ctypes.c_void_p, # imageattr : GpImageAttributes* in/out
ctypes.c_int, # type : ColorAdjustType
wintypes.BOOL, # enableFlag : BOOL
wintypes.DWORD, # mapSize : DWORD
ctypes.c_void_p, # map : ColorMap*
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('gdiplus.dll')
GdipSetImageAttributesRemapTable = Fiddle::Function.new(
lib['GdipSetImageAttributesRemapTable'],
[
Fiddle::TYPE_VOIDP, # imageattr : GpImageAttributes* in/out
Fiddle::TYPE_INT, # type : ColorAdjustType
Fiddle::TYPE_INT, # enableFlag : BOOL
-Fiddle::TYPE_INT, # mapSize : DWORD
Fiddle::TYPE_VOIDP, # map : ColorMap*
],
Fiddle::TYPE_INT)#[link(name = "gdiplus")]
extern "system" {
fn GdipSetImageAttributesRemapTable(
imageattr: *mut GpImageAttributes, // GpImageAttributes* in/out
type: i32, // ColorAdjustType
enableFlag: i32, // BOOL
mapSize: u32, // DWORD
map: *const ColorMap // ColorMap*
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("gdiplus.dll")]
public static extern int GdipSetImageAttributesRemapTable(IntPtr imageattr, int type, bool enableFlag, uint mapSize, IntPtr map);
"@
$api = Add-Type -MemberDefinition $sig -Name 'gdiplus_GdipSetImageAttributesRemapTable' -Namespace Win32 -PassThru
# $api::GdipSetImageAttributesRemapTable(imageattr, type, enableFlag, mapSize, map)#uselib "gdiplus.dll"
#func global GdipSetImageAttributesRemapTable "GdipSetImageAttributesRemapTable" sptr, sptr, sptr, sptr, sptr
; GdipSetImageAttributesRemapTable varptr(imageattr), type, enableFlag, mapSize, varptr(map) ; 戻り値は stat
; imageattr : GpImageAttributes* in/out -> "sptr"
; type : ColorAdjustType -> "sptr"
; enableFlag : BOOL -> "sptr"
; mapSize : DWORD -> "sptr"
; map : ColorMap* -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "gdiplus.dll" #cfunc global GdipSetImageAttributesRemapTable "GdipSetImageAttributesRemapTable" var, int, int, int, var ; res = GdipSetImageAttributesRemapTable(imageattr, type, enableFlag, mapSize, map) ; imageattr : GpImageAttributes* in/out -> "var" ; type : ColorAdjustType -> "int" ; enableFlag : BOOL -> "int" ; mapSize : DWORD -> "int" ; map : ColorMap* -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "gdiplus.dll" #cfunc global GdipSetImageAttributesRemapTable "GdipSetImageAttributesRemapTable" sptr, int, int, int, sptr ; res = GdipSetImageAttributesRemapTable(varptr(imageattr), type, enableFlag, mapSize, varptr(map)) ; imageattr : GpImageAttributes* in/out -> "sptr" ; type : ColorAdjustType -> "int" ; enableFlag : BOOL -> "int" ; mapSize : DWORD -> "int" ; map : ColorMap* -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; Status GdipSetImageAttributesRemapTable(GpImageAttributes* imageattr, ColorAdjustType type, BOOL enableFlag, DWORD mapSize, ColorMap* map) #uselib "gdiplus.dll" #cfunc global GdipSetImageAttributesRemapTable "GdipSetImageAttributesRemapTable" var, int, int, int, var ; res = GdipSetImageAttributesRemapTable(imageattr, type, enableFlag, mapSize, map) ; imageattr : GpImageAttributes* in/out -> "var" ; type : ColorAdjustType -> "int" ; enableFlag : BOOL -> "int" ; mapSize : DWORD -> "int" ; map : ColorMap* -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; Status GdipSetImageAttributesRemapTable(GpImageAttributes* imageattr, ColorAdjustType type, BOOL enableFlag, DWORD mapSize, ColorMap* map) #uselib "gdiplus.dll" #cfunc global GdipSetImageAttributesRemapTable "GdipSetImageAttributesRemapTable" intptr, int, int, int, intptr ; res = GdipSetImageAttributesRemapTable(varptr(imageattr), type, enableFlag, mapSize, varptr(map)) ; imageattr : GpImageAttributes* in/out -> "intptr" ; type : ColorAdjustType -> "int" ; enableFlag : BOOL -> "int" ; mapSize : DWORD -> "int" ; map : ColorMap* -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
gdiplus = windows.NewLazySystemDLL("gdiplus.dll")
procGdipSetImageAttributesRemapTable = gdiplus.NewProc("GdipSetImageAttributesRemapTable")
)
// imageattr (GpImageAttributes* in/out), type (ColorAdjustType), enableFlag (BOOL), mapSize (DWORD), map (ColorMap*)
r1, _, err := procGdipSetImageAttributesRemapTable.Call(
uintptr(imageattr),
uintptr(type),
uintptr(enableFlag),
uintptr(mapSize),
uintptr(map),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // Statusfunction GdipSetImageAttributesRemapTable(
imageattr: Pointer; // GpImageAttributes* in/out
type: Integer; // ColorAdjustType
enableFlag: BOOL; // BOOL
mapSize: DWORD; // DWORD
map: Pointer // ColorMap*
): Integer; stdcall;
external 'gdiplus.dll' name 'GdipSetImageAttributesRemapTable';result := DllCall("gdiplus\GdipSetImageAttributesRemapTable"
, "Ptr", imageattr ; GpImageAttributes* in/out
, "Int", type ; ColorAdjustType
, "Int", enableFlag ; BOOL
, "UInt", mapSize ; DWORD
, "Ptr", map ; ColorMap*
, "Int") ; return: Status●GdipSetImageAttributesRemapTable(imageattr, type, enableFlag, mapSize, map) = DLL("gdiplus.dll", "int GdipSetImageAttributesRemapTable(void*, int, bool, dword, void*)")
# 呼び出し: GdipSetImageAttributesRemapTable(imageattr, type, enableFlag, mapSize, map)
# imageattr : GpImageAttributes* in/out -> "void*"
# type : ColorAdjustType -> "int"
# enableFlag : BOOL -> "bool"
# mapSize : DWORD -> "dword"
# map : ColorMap* -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "gdiplus" fn GdipSetImageAttributesRemapTable(
imageattr: [*c]GpImageAttributes, // GpImageAttributes* in/out
type: i32, // ColorAdjustType
enableFlag: i32, // BOOL
mapSize: u32, // DWORD
map: [*c]ColorMap // ColorMap*
) callconv(std.os.windows.WINAPI) i32;proc GdipSetImageAttributesRemapTable(
imageattr: ptr GpImageAttributes, # GpImageAttributes* in/out
`type`: int32, # ColorAdjustType
enableFlag: int32, # BOOL
mapSize: uint32, # DWORD
map: ptr ColorMap # ColorMap*
): int32 {.importc: "GdipSetImageAttributesRemapTable", stdcall, dynlib: "gdiplus.dll".}pragma(lib, "gdiplus");
extern(Windows)
int GdipSetImageAttributesRemapTable(
GpImageAttributes* imageattr, // GpImageAttributes* in/out
int type, // ColorAdjustType
int enableFlag, // BOOL
uint mapSize, // DWORD
ColorMap* map // ColorMap*
);ccall((:GdipSetImageAttributesRemapTable, "gdiplus.dll"), stdcall, Int32,
(Ptr{GpImageAttributes}, Int32, Int32, UInt32, Ptr{ColorMap}),
imageattr, type, enableFlag, mapSize, map)
# imageattr : GpImageAttributes* in/out -> Ptr{GpImageAttributes}
# type : ColorAdjustType -> Int32
# enableFlag : BOOL -> Int32
# mapSize : DWORD -> UInt32
# map : ColorMap* -> Ptr{ColorMap}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t GdipSetImageAttributesRemapTable(
void* imageattr,
int32_t type,
int32_t enableFlag,
uint32_t mapSize,
void* map);
]]
local gdiplus = ffi.load("gdiplus")
-- gdiplus.GdipSetImageAttributesRemapTable(imageattr, type, enableFlag, mapSize, map)
-- imageattr : GpImageAttributes* in/out
-- type : ColorAdjustType
-- enableFlag : BOOL
-- mapSize : DWORD
-- map : ColorMap*
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('gdiplus.dll');
const GdipSetImageAttributesRemapTable = lib.func('__stdcall', 'GdipSetImageAttributesRemapTable', 'int32_t', ['void *', 'int32_t', 'int32_t', 'uint32_t', 'void *']);
// GdipSetImageAttributesRemapTable(imageattr, type, enableFlag, mapSize, map)
// imageattr : GpImageAttributes* in/out -> 'void *'
// type : ColorAdjustType -> 'int32_t'
// enableFlag : BOOL -> 'int32_t'
// mapSize : DWORD -> 'uint32_t'
// map : ColorMap* -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("gdiplus.dll", {
GdipSetImageAttributesRemapTable: { parameters: ["pointer", "i32", "i32", "u32", "pointer"], result: "i32" },
});
// lib.symbols.GdipSetImageAttributesRemapTable(imageattr, type, enableFlag, mapSize, map)
// imageattr : GpImageAttributes* in/out -> "pointer"
// type : ColorAdjustType -> "i32"
// enableFlag : BOOL -> "i32"
// mapSize : DWORD -> "u32"
// map : ColorMap* -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t GdipSetImageAttributesRemapTable(
void* imageattr,
int32_t type,
int32_t enableFlag,
uint32_t mapSize,
void* map);
C, "gdiplus.dll");
// $ffi->GdipSetImageAttributesRemapTable(imageattr, type, enableFlag, mapSize, map);
// imageattr : GpImageAttributes* in/out
// type : ColorAdjustType
// enableFlag : BOOL
// mapSize : DWORD
// map : ColorMap*
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;
public interface Gdiplus extends StdCallLibrary {
Gdiplus INSTANCE = Native.load("gdiplus", Gdiplus.class);
int GdipSetImageAttributesRemapTable(
Pointer imageattr, // GpImageAttributes* in/out
int type, // ColorAdjustType
boolean enableFlag, // BOOL
int mapSize, // DWORD
Pointer map // ColorMap*
);
}@[Link("gdiplus")]
lib Libgdiplus
fun GdipSetImageAttributesRemapTable = GdipSetImageAttributesRemapTable(
imageattr : GpImageAttributes*, # GpImageAttributes* in/out
type_ : Int32, # ColorAdjustType
enableFlag : Int32, # BOOL
mapSize : UInt32, # DWORD
map : ColorMap* # ColorMap*
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef GdipSetImageAttributesRemapTableNative = Int32 Function(Pointer<Void>, Int32, Int32, Uint32, Pointer<Void>);
typedef GdipSetImageAttributesRemapTableDart = int Function(Pointer<Void>, int, int, int, Pointer<Void>);
final GdipSetImageAttributesRemapTable = DynamicLibrary.open('gdiplus.dll')
.lookupFunction<GdipSetImageAttributesRemapTableNative, GdipSetImageAttributesRemapTableDart>('GdipSetImageAttributesRemapTable');
// imageattr : GpImageAttributes* in/out -> Pointer<Void>
// type : ColorAdjustType -> Int32
// enableFlag : BOOL -> Int32
// mapSize : DWORD -> Uint32
// map : ColorMap* -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function GdipSetImageAttributesRemapTable(
imageattr: Pointer; // GpImageAttributes* in/out
type: Integer; // ColorAdjustType
enableFlag: BOOL; // BOOL
mapSize: DWORD; // DWORD
map: Pointer // ColorMap*
): Integer; stdcall;
external 'gdiplus.dll' name 'GdipSetImageAttributesRemapTable';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "GdipSetImageAttributesRemapTable"
c_GdipSetImageAttributesRemapTable :: Ptr () -> Int32 -> CInt -> Word32 -> Ptr () -> IO Int32
-- imageattr : GpImageAttributes* in/out -> Ptr ()
-- type : ColorAdjustType -> Int32
-- enableFlag : BOOL -> CInt
-- mapSize : DWORD -> Word32
-- map : ColorMap* -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let gdipsetimageattributesremaptable =
foreign "GdipSetImageAttributesRemapTable"
((ptr void) @-> int32_t @-> int32_t @-> uint32_t @-> (ptr void) @-> returning int32_t)
(* imageattr : GpImageAttributes* in/out -> (ptr void) *)
(* type : ColorAdjustType -> int32_t *)
(* enableFlag : BOOL -> int32_t *)
(* mapSize : DWORD -> uint32_t *)
(* map : ColorMap* -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library gdiplus (t "gdiplus.dll"))
(cffi:use-foreign-library gdiplus)
(cffi:defcfun ("GdipSetImageAttributesRemapTable" gdip-set-image-attributes-remap-table :convention :stdcall) :int32
(imageattr :pointer) ; GpImageAttributes* in/out
(type :int32) ; ColorAdjustType
(enable-flag :int32) ; BOOL
(map-size :uint32) ; DWORD
(map :pointer)) ; ColorMap*
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $GdipSetImageAttributesRemapTable = Win32::API::More->new('gdiplus',
'int GdipSetImageAttributesRemapTable(LPVOID imageattr, int type, BOOL enableFlag, DWORD mapSize, LPVOID map)');
# my $ret = $GdipSetImageAttributesRemapTable->Call($imageattr, $type, $enableFlag, $mapSize, $map);
# imageattr : GpImageAttributes* in/out -> LPVOID
# type : ColorAdjustType -> int
# enableFlag : BOOL -> BOOL
# mapSize : DWORD -> DWORD
# map : ColorMap* -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。