Win32 API 日本語リファレンス
ホームUI.ColorSystem › WcsTranslateColors

WcsTranslateColors

関数
WCS色変換を用いて色データを変換する。
DLLmscms.dll呼出規約winapi

シグネチャ

// 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
);

パラメーター

名前方向説明
hColorTransformINT_PTRin適用するカラー変換のハンドル。
nColorsDWORDin変換する色の個数。
nInputChannelsDWORDin入力色データのチャンネル数。
cdtInputCOLORDATATYPEin入力色データの要素データ型を示す列挙値。
cbInputDWORDin入力1色あたりのバイトサイズ。
pInputDatavoid*in変換元の色データを格納したバッファへのポインタ。
nOutputChannelsDWORDin出力色データのチャンネル数。
cdtOutputCOLORDATATYPEin出力色データの要素データ型を示す列挙値。
cbOutputDWORDin出力1色あたりのバイトサイズ。
pOutputDatavoid*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 <MarshalAs(UnmanagedType.Bool)> 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   // BOOL
function 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)。
const std = @import("std");

extern "mscms" fn WcsTranslateColors(
    hColorTransform: isize, // INT_PTR
    nColors: u32, // DWORD
    nInputChannels: u32, // DWORD
    cdtInput: i32, // COLORDATATYPE
    cbInput: u32, // DWORD
    pInputData: ?*anyopaque, // void*
    nOutputChannels: u32, // DWORD
    cdtOutput: i32, // COLORDATATYPE
    cbOutput: u32, // DWORD
    pOutputData: ?*anyopaque // void* out
) callconv(std.os.windows.WINAPI) i32;
proc WcsTranslateColors(
    hColorTransform: int,  # INT_PTR
    nColors: uint32,  # DWORD
    nInputChannels: uint32,  # DWORD
    cdtInput: int32,  # COLORDATATYPE
    cbInput: uint32,  # DWORD
    pInputData: pointer,  # void*
    nOutputChannels: uint32,  # DWORD
    cdtOutput: int32,  # COLORDATATYPE
    cbOutput: uint32,  # DWORD
    pOutputData: pointer  # void* out
): int32 {.importc: "WcsTranslateColors", stdcall, dynlib: "mscms.dll".}
pragma(lib, "mscms");
extern(Windows)
int WcsTranslateColors(
    ptrdiff_t hColorTransform,   // INT_PTR
    uint nColors,   // DWORD
    uint nInputChannels,   // DWORD
    int cdtInput,   // COLORDATATYPE
    uint cbInput,   // DWORD
    void* pInputData,   // void*
    uint nOutputChannels,   // DWORD
    int cdtOutput,   // COLORDATATYPE
    uint cbOutput,   // DWORD
    void* pOutputData   // void* out
);
ccall((:WcsTranslateColors, "mscms.dll"), stdcall, Int32,
      (Int, UInt32, UInt32, Int32, UInt32, Ptr{Cvoid}, UInt32, Int32, UInt32, Ptr{Cvoid}),
      hColorTransform, nColors, nInputChannels, cdtInput, cbInput, pInputData, nOutputChannels, cdtOutput, cbOutput, pOutputData)
# hColorTransform : INT_PTR -> Int
# nColors : DWORD -> UInt32
# nInputChannels : DWORD -> UInt32
# cdtInput : COLORDATATYPE -> Int32
# cbInput : DWORD -> UInt32
# pInputData : void* -> Ptr{Cvoid}
# nOutputChannels : DWORD -> UInt32
# cdtOutput : COLORDATATYPE -> Int32
# cbOutput : DWORD -> UInt32
# pOutputData : void* out -> Ptr{Cvoid}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
int32_t WcsTranslateColors(
    intptr_t hColorTransform,
    uint32_t nColors,
    uint32_t nInputChannels,
    int32_t cdtInput,
    uint32_t cbInput,
    void* pInputData,
    uint32_t nOutputChannels,
    int32_t cdtOutput,
    uint32_t cbOutput,
    void* pOutputData);
]]
local mscms = ffi.load("mscms")
-- mscms.WcsTranslateColors(hColorTransform, nColors, nInputChannels, cdtInput, cbInput, pInputData, nOutputChannels, cdtOutput, cbOutput, pOutputData)
-- hColorTransform : INT_PTR
-- nColors : DWORD
-- nInputChannels : DWORD
-- cdtInput : COLORDATATYPE
-- cbInput : DWORD
-- pInputData : void*
-- nOutputChannels : DWORD
-- cdtOutput : COLORDATATYPE
-- cbOutput : DWORD
-- pOutputData : void* out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('mscms.dll');
const WcsTranslateColors = lib.func('__stdcall', 'WcsTranslateColors', 'int32_t', ['intptr_t', 'uint32_t', 'uint32_t', 'int32_t', 'uint32_t', 'void *', 'uint32_t', 'int32_t', 'uint32_t', 'void *']);
// WcsTranslateColors(hColorTransform, nColors, nInputChannels, cdtInput, cbInput, pInputData, nOutputChannels, cdtOutput, cbOutput, pOutputData)
// hColorTransform : INT_PTR -> 'intptr_t'
// nColors : DWORD -> 'uint32_t'
// nInputChannels : DWORD -> 'uint32_t'
// cdtInput : COLORDATATYPE -> 'int32_t'
// cbInput : DWORD -> 'uint32_t'
// pInputData : void* -> 'void *'
// nOutputChannels : DWORD -> 'uint32_t'
// cdtOutput : COLORDATATYPE -> 'int32_t'
// cbOutput : DWORD -> 'uint32_t'
// pOutputData : void* out -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("mscms.dll", {
  WcsTranslateColors: { parameters: ["isize", "u32", "u32", "i32", "u32", "pointer", "u32", "i32", "u32", "pointer"], result: "i32" },
});
// lib.symbols.WcsTranslateColors(hColorTransform, nColors, nInputChannels, cdtInput, cbInput, pInputData, nOutputChannels, cdtOutput, cbOutput, pOutputData)
// hColorTransform : INT_PTR -> "isize"
// nColors : DWORD -> "u32"
// nInputChannels : DWORD -> "u32"
// cdtInput : COLORDATATYPE -> "i32"
// cbInput : DWORD -> "u32"
// pInputData : void* -> "pointer"
// nOutputChannels : DWORD -> "u32"
// cdtOutput : COLORDATATYPE -> "i32"
// cbOutput : DWORD -> "u32"
// pOutputData : void* out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
int32_t WcsTranslateColors(
    intptr_t hColorTransform,
    uint32_t nColors,
    uint32_t nInputChannels,
    int32_t cdtInput,
    uint32_t cbInput,
    void* pInputData,
    uint32_t nOutputChannels,
    int32_t cdtOutput,
    uint32_t cbOutput,
    void* pOutputData);
C, "mscms.dll");
// $ffi->WcsTranslateColors(hColorTransform, nColors, nInputChannels, cdtInput, cbInput, pInputData, nOutputChannels, cdtOutput, cbOutput, pOutputData);
// hColorTransform : INT_PTR
// nColors : DWORD
// nInputChannels : DWORD
// cdtInput : COLORDATATYPE
// cbInput : DWORD
// pInputData : void*
// nOutputChannels : DWORD
// cdtOutput : COLORDATATYPE
// cbOutput : DWORD
// pOutputData : void* out
// 構造体/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 Mscms extends StdCallLibrary {
    Mscms INSTANCE = Native.load("mscms", Mscms.class);
    boolean WcsTranslateColors(
        long hColorTransform,   // INT_PTR
        int nColors,   // DWORD
        int nInputChannels,   // DWORD
        int cdtInput,   // COLORDATATYPE
        int cbInput,   // DWORD
        Pointer pInputData,   // void*
        int nOutputChannels,   // DWORD
        int cdtOutput,   // COLORDATATYPE
        int cbOutput,   // DWORD
        Pointer pOutputData   // void* out
    );
}
@[Link("mscms")]
lib Libmscms
  fun WcsTranslateColors = WcsTranslateColors(
    hColorTransform : LibC::SSizeT,   # INT_PTR
    nColors : UInt32,   # DWORD
    nInputChannels : UInt32,   # DWORD
    cdtInput : Int32,   # COLORDATATYPE
    cbInput : UInt32,   # DWORD
    pInputData : Void*,   # void*
    nOutputChannels : UInt32,   # DWORD
    cdtOutput : Int32,   # COLORDATATYPE
    cbOutput : UInt32,   # DWORD
    pOutputData : Void*   # void* out
  ) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef WcsTranslateColorsNative = Int32 Function(IntPtr, Uint32, Uint32, Int32, Uint32, Pointer<Void>, Uint32, Int32, Uint32, Pointer<Void>);
typedef WcsTranslateColorsDart = int Function(int, int, int, int, int, Pointer<Void>, int, int, int, Pointer<Void>);
final WcsTranslateColors = DynamicLibrary.open('mscms.dll')
    .lookupFunction<WcsTranslateColorsNative, WcsTranslateColorsDart>('WcsTranslateColors');
// hColorTransform : INT_PTR -> IntPtr
// nColors : DWORD -> Uint32
// nInputChannels : DWORD -> Uint32
// cdtInput : COLORDATATYPE -> Int32
// cbInput : DWORD -> Uint32
// pInputData : void* -> Pointer<Void>
// nOutputChannels : DWORD -> Uint32
// cdtOutput : COLORDATATYPE -> Int32
// cbOutput : DWORD -> Uint32
// pOutputData : void* out -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function 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';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "WcsTranslateColors"
  c_WcsTranslateColors :: CIntPtr -> Word32 -> Word32 -> Int32 -> Word32 -> Ptr () -> Word32 -> Int32 -> Word32 -> Ptr () -> IO CInt
-- hColorTransform : INT_PTR -> CIntPtr
-- nColors : DWORD -> Word32
-- nInputChannels : DWORD -> Word32
-- cdtInput : COLORDATATYPE -> Int32
-- cbInput : DWORD -> Word32
-- pInputData : void* -> Ptr ()
-- nOutputChannels : DWORD -> Word32
-- cdtOutput : COLORDATATYPE -> Int32
-- cbOutput : DWORD -> Word32
-- pOutputData : void* out -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let wcstranslatecolors =
  foreign "WcsTranslateColors"
    (intptr_t @-> uint32_t @-> uint32_t @-> int32_t @-> uint32_t @-> (ptr void) @-> uint32_t @-> int32_t @-> uint32_t @-> (ptr void) @-> returning int32_t)
(* hColorTransform : INT_PTR -> intptr_t *)
(* nColors : DWORD -> uint32_t *)
(* nInputChannels : DWORD -> uint32_t *)
(* cdtInput : COLORDATATYPE -> int32_t *)
(* cbInput : DWORD -> uint32_t *)
(* pInputData : void* -> (ptr void) *)
(* nOutputChannels : DWORD -> uint32_t *)
(* cdtOutput : COLORDATATYPE -> int32_t *)
(* cbOutput : DWORD -> uint32_t *)
(* pOutputData : void* out -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library mscms (t "mscms.dll"))
(cffi:use-foreign-library mscms)

(cffi:defcfun ("WcsTranslateColors" wcs-translate-colors :convention :stdcall) :int32
  (h-color-transform :int64)   ; INT_PTR
  (n-colors :uint32)   ; DWORD
  (n-input-channels :uint32)   ; DWORD
  (cdt-input :int32)   ; COLORDATATYPE
  (cb-input :uint32)   ; DWORD
  (p-input-data :pointer)   ; void*
  (n-output-channels :uint32)   ; DWORD
  (cdt-output :int32)   ; COLORDATATYPE
  (cb-output :uint32)   ; DWORD
  (p-output-data :pointer))   ; void* out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $WcsTranslateColors = Win32::API::More->new('mscms',
    'BOOL WcsTranslateColors(LPARAM hColorTransform, DWORD nColors, DWORD nInputChannels, int cdtInput, DWORD cbInput, LPVOID pInputData, DWORD nOutputChannels, int cdtOutput, DWORD cbOutput, LPVOID pOutputData)');
# my $ret = $WcsTranslateColors->Call($hColorTransform, $nColors, $nInputChannels, $cdtInput, $cbInput, $pInputData, $nOutputChannels, $cdtOutput, $cbOutput, $pOutputData);
# hColorTransform : INT_PTR -> LPARAM
# nColors : DWORD -> DWORD
# nInputChannels : DWORD -> DWORD
# cdtInput : COLORDATATYPE -> int
# cbInput : DWORD -> DWORD
# pInputData : void* -> LPVOID
# nOutputChannels : DWORD -> DWORD
# cdtOutput : COLORDATATYPE -> int
# cbOutput : DWORD -> DWORD
# pOutputData : void* out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

使用する型