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