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