ホーム › UI.ColorSystem › WcsTranslateColors
WcsTranslateColors
関数WCS色変換を用いて色データを変換する。
シグネチャ
// mscms.dll
#include <windows.h>
BOOL WcsTranslateColors(
INT_PTR hColorTransform,
DWORD nColors,
DWORD nInputChannels,
COLORDATATYPE cdtInput,
DWORD cbInput,
void* pInputData,
DWORD nOutputChannels,
COLORDATATYPE cdtOutput,
DWORD cbOutput,
void* pOutputData
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hColorTransform | INT_PTR | in |
| nColors | DWORD | in |
| nInputChannels | DWORD | in |
| cdtInput | COLORDATATYPE | in |
| cbInput | DWORD | in |
| pInputData | void* | in |
| nOutputChannels | DWORD | in |
| cdtOutput | COLORDATATYPE | in |
| cbOutput | DWORD | in |
| pOutputData | void* | out |
戻り値の型: BOOL
各言語での呼び出し定義
// mscms.dll
#include <windows.h>
BOOL WcsTranslateColors(
INT_PTR hColorTransform,
DWORD nColors,
DWORD nInputChannels,
COLORDATATYPE cdtInput,
DWORD cbInput,
void* pInputData,
DWORD nOutputChannels,
COLORDATATYPE cdtOutput,
DWORD cbOutput,
void* pOutputData
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("mscms.dll", ExactSpelling = true)]
static extern bool WcsTranslateColors(
IntPtr hColorTransform, // INT_PTR
uint nColors, // DWORD
uint nInputChannels, // DWORD
int cdtInput, // COLORDATATYPE
uint cbInput, // DWORD
IntPtr pInputData, // void*
uint nOutputChannels, // DWORD
int cdtOutput, // COLORDATATYPE
uint cbOutput, // DWORD
IntPtr pOutputData // void* out
);<DllImport("mscms.dll", ExactSpelling:=True)>
Public Shared Function WcsTranslateColors(
hColorTransform As IntPtr, ' INT_PTR
nColors As UInteger, ' DWORD
nInputChannels As UInteger, ' DWORD
cdtInput As Integer, ' COLORDATATYPE
cbInput As UInteger, ' DWORD
pInputData As IntPtr, ' void*
nOutputChannels As UInteger, ' DWORD
cdtOutput As Integer, ' COLORDATATYPE
cbOutput As UInteger, ' DWORD
pOutputData As IntPtr ' void* out
) As Boolean
End Function' hColorTransform : INT_PTR
' nColors : DWORD
' nInputChannels : DWORD
' cdtInput : COLORDATATYPE
' cbInput : DWORD
' pInputData : void*
' nOutputChannels : DWORD
' cdtOutput : COLORDATATYPE
' cbOutput : DWORD
' pOutputData : void* out
Declare PtrSafe Function WcsTranslateColors Lib "mscms" ( _
ByVal hColorTransform As LongPtr, _
ByVal nColors As Long, _
ByVal nInputChannels As Long, _
ByVal cdtInput As Long, _
ByVal cbInput As Long, _
ByVal pInputData As LongPtr, _
ByVal nOutputChannels As Long, _
ByVal cdtOutput As Long, _
ByVal cbOutput As Long, _
ByVal pOutputData As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
WcsTranslateColors = ctypes.windll.mscms.WcsTranslateColors
WcsTranslateColors.restype = wintypes.BOOL
WcsTranslateColors.argtypes = [
ctypes.c_ssize_t, # hColorTransform : INT_PTR
wintypes.DWORD, # nColors : DWORD
wintypes.DWORD, # nInputChannels : DWORD
ctypes.c_int, # cdtInput : COLORDATATYPE
wintypes.DWORD, # cbInput : DWORD
ctypes.POINTER(None), # pInputData : void*
wintypes.DWORD, # nOutputChannels : DWORD
ctypes.c_int, # cdtOutput : COLORDATATYPE
wintypes.DWORD, # cbOutput : DWORD
ctypes.POINTER(None), # pOutputData : void* out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('mscms.dll')
WcsTranslateColors = Fiddle::Function.new(
lib['WcsTranslateColors'],
[
Fiddle::TYPE_INTPTR_T, # hColorTransform : INT_PTR
-Fiddle::TYPE_INT, # nColors : DWORD
-Fiddle::TYPE_INT, # nInputChannels : DWORD
Fiddle::TYPE_INT, # cdtInput : COLORDATATYPE
-Fiddle::TYPE_INT, # cbInput : DWORD
Fiddle::TYPE_VOIDP, # pInputData : void*
-Fiddle::TYPE_INT, # nOutputChannels : DWORD
Fiddle::TYPE_INT, # cdtOutput : COLORDATATYPE
-Fiddle::TYPE_INT, # cbOutput : DWORD
Fiddle::TYPE_VOIDP, # pOutputData : void* out
],
Fiddle::TYPE_INT)#[link(name = "mscms")]
extern "system" {
fn WcsTranslateColors(
hColorTransform: isize, // INT_PTR
nColors: u32, // DWORD
nInputChannels: u32, // DWORD
cdtInput: i32, // COLORDATATYPE
cbInput: u32, // DWORD
pInputData: *mut (), // void*
nOutputChannels: u32, // DWORD
cdtOutput: i32, // COLORDATATYPE
cbOutput: u32, // DWORD
pOutputData: *mut () // void* out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("mscms.dll")]
public static extern bool WcsTranslateColors(IntPtr hColorTransform, uint nColors, uint nInputChannels, int cdtInput, uint cbInput, IntPtr pInputData, uint nOutputChannels, int cdtOutput, uint cbOutput, IntPtr pOutputData);
"@
$api = Add-Type -MemberDefinition $sig -Name 'mscms_WcsTranslateColors' -Namespace Win32 -PassThru
# $api::WcsTranslateColors(hColorTransform, nColors, nInputChannels, cdtInput, cbInput, pInputData, nOutputChannels, cdtOutput, cbOutput, pOutputData)#uselib "mscms.dll"
#func global WcsTranslateColors "WcsTranslateColors" sptr, sptr, sptr, sptr, sptr, sptr, sptr, sptr, sptr, sptr
; WcsTranslateColors hColorTransform, nColors, nInputChannels, cdtInput, cbInput, pInputData, nOutputChannels, cdtOutput, cbOutput, pOutputData ; 戻り値は stat
; hColorTransform : INT_PTR -> "sptr"
; nColors : DWORD -> "sptr"
; nInputChannels : DWORD -> "sptr"
; cdtInput : COLORDATATYPE -> "sptr"
; cbInput : DWORD -> "sptr"
; pInputData : void* -> "sptr"
; nOutputChannels : DWORD -> "sptr"
; cdtOutput : COLORDATATYPE -> "sptr"
; cbOutput : DWORD -> "sptr"
; pOutputData : void* out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "mscms.dll"
#cfunc global WcsTranslateColors "WcsTranslateColors" sptr, int, int, int, int, sptr, int, int, int, sptr
; res = WcsTranslateColors(hColorTransform, nColors, nInputChannels, cdtInput, cbInput, pInputData, nOutputChannels, cdtOutput, cbOutput, pOutputData)
; hColorTransform : INT_PTR -> "sptr"
; nColors : DWORD -> "int"
; nInputChannels : DWORD -> "int"
; cdtInput : COLORDATATYPE -> "int"
; cbInput : DWORD -> "int"
; pInputData : void* -> "sptr"
; nOutputChannels : DWORD -> "int"
; cdtOutput : COLORDATATYPE -> "int"
; cbOutput : DWORD -> "int"
; pOutputData : void* out -> "sptr"; BOOL WcsTranslateColors(INT_PTR hColorTransform, DWORD nColors, DWORD nInputChannels, COLORDATATYPE cdtInput, DWORD cbInput, void* pInputData, DWORD nOutputChannels, COLORDATATYPE cdtOutput, DWORD cbOutput, void* pOutputData)
#uselib "mscms.dll"
#cfunc global WcsTranslateColors "WcsTranslateColors" intptr, int, int, int, int, intptr, int, int, int, intptr
; res = WcsTranslateColors(hColorTransform, nColors, nInputChannels, cdtInput, cbInput, pInputData, nOutputChannels, cdtOutput, cbOutput, pOutputData)
; hColorTransform : INT_PTR -> "intptr"
; nColors : DWORD -> "int"
; nInputChannels : DWORD -> "int"
; cdtInput : COLORDATATYPE -> "int"
; cbInput : DWORD -> "int"
; pInputData : void* -> "intptr"
; nOutputChannels : DWORD -> "int"
; cdtOutput : COLORDATATYPE -> "int"
; cbOutput : DWORD -> "int"
; pOutputData : void* out -> "intptr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
mscms = windows.NewLazySystemDLL("mscms.dll")
procWcsTranslateColors = mscms.NewProc("WcsTranslateColors")
)
// hColorTransform (INT_PTR), nColors (DWORD), nInputChannels (DWORD), cdtInput (COLORDATATYPE), cbInput (DWORD), pInputData (void*), nOutputChannels (DWORD), cdtOutput (COLORDATATYPE), cbOutput (DWORD), pOutputData (void* out)
r1, _, err := procWcsTranslateColors.Call(
uintptr(hColorTransform),
uintptr(nColors),
uintptr(nInputChannels),
uintptr(cdtInput),
uintptr(cbInput),
uintptr(pInputData),
uintptr(nOutputChannels),
uintptr(cdtOutput),
uintptr(cbOutput),
uintptr(pOutputData),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction WcsTranslateColors(
hColorTransform: NativeInt; // INT_PTR
nColors: DWORD; // DWORD
nInputChannels: DWORD; // DWORD
cdtInput: Integer; // COLORDATATYPE
cbInput: DWORD; // DWORD
pInputData: Pointer; // void*
nOutputChannels: DWORD; // DWORD
cdtOutput: Integer; // COLORDATATYPE
cbOutput: DWORD; // DWORD
pOutputData: Pointer // void* out
): BOOL; stdcall;
external 'mscms.dll' name 'WcsTranslateColors';result := DllCall("mscms\WcsTranslateColors"
, "Ptr", hColorTransform ; INT_PTR
, "UInt", nColors ; DWORD
, "UInt", nInputChannels ; DWORD
, "Int", cdtInput ; COLORDATATYPE
, "UInt", cbInput ; DWORD
, "Ptr", pInputData ; void*
, "UInt", nOutputChannels ; DWORD
, "Int", cdtOutput ; COLORDATATYPE
, "UInt", cbOutput ; DWORD
, "Ptr", pOutputData ; void* out
, "Int") ; return: BOOL●WcsTranslateColors(hColorTransform, nColors, nInputChannels, cdtInput, cbInput, pInputData, nOutputChannels, cdtOutput, cbOutput, pOutputData) = DLL("mscms.dll", "bool WcsTranslateColors(int, dword, dword, int, dword, void*, dword, int, dword, void*)")
# 呼び出し: WcsTranslateColors(hColorTransform, nColors, nInputChannels, cdtInput, cbInput, pInputData, nOutputChannels, cdtOutput, cbOutput, pOutputData)
# hColorTransform : INT_PTR -> "int"
# nColors : DWORD -> "dword"
# nInputChannels : DWORD -> "dword"
# cdtInput : COLORDATATYPE -> "int"
# cbInput : DWORD -> "dword"
# pInputData : void* -> "void*"
# nOutputChannels : DWORD -> "dword"
# cdtOutput : COLORDATATYPE -> "int"
# cbOutput : DWORD -> "dword"
# pOutputData : void* out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。