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

GetPS2ColorRenderingIntent

関数
プロファイルからPostScript2色再現インテントを取得する。
DLLmscms.dll呼出規約winapi

シグネチャ

// mscms.dll
#include <windows.h>

BOOL GetPS2ColorRenderingIntent(
    INT_PTR hProfile,
    DWORD dwIntent,
    BYTE* pBuffer,   // optional
    DWORD* pcbPS2ColorRenderingIntent
);

パラメーター

名前方向
hProfileINT_PTRin
dwIntentDWORDin
pBufferBYTE*outoptional
pcbPS2ColorRenderingIntentDWORD*inout

戻り値の型: BOOL

各言語での呼び出し定義

// mscms.dll
#include <windows.h>

BOOL GetPS2ColorRenderingIntent(
    INT_PTR hProfile,
    DWORD dwIntent,
    BYTE* pBuffer,   // optional
    DWORD* pcbPS2ColorRenderingIntent
);
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("mscms.dll", ExactSpelling = true)]
static extern bool GetPS2ColorRenderingIntent(
    IntPtr hProfile,   // INT_PTR
    uint dwIntent,   // DWORD
    IntPtr pBuffer,   // BYTE* optional, out
    ref uint pcbPS2ColorRenderingIntent   // DWORD* in/out
);
<DllImport("mscms.dll", ExactSpelling:=True)>
Public Shared Function GetPS2ColorRenderingIntent(
    hProfile As IntPtr,   ' INT_PTR
    dwIntent As UInteger,   ' DWORD
    pBuffer As IntPtr,   ' BYTE* optional, out
    ByRef pcbPS2ColorRenderingIntent As UInteger   ' DWORD* in/out
) As Boolean
End Function
' hProfile : INT_PTR
' dwIntent : DWORD
' pBuffer : BYTE* optional, out
' pcbPS2ColorRenderingIntent : DWORD* in/out
Declare PtrSafe Function GetPS2ColorRenderingIntent Lib "mscms" ( _
    ByVal hProfile As LongPtr, _
    ByVal dwIntent As Long, _
    ByVal pBuffer As LongPtr, _
    ByRef pcbPS2ColorRenderingIntent As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

GetPS2ColorRenderingIntent = ctypes.windll.mscms.GetPS2ColorRenderingIntent
GetPS2ColorRenderingIntent.restype = wintypes.BOOL
GetPS2ColorRenderingIntent.argtypes = [
    ctypes.c_ssize_t,  # hProfile : INT_PTR
    wintypes.DWORD,  # dwIntent : DWORD
    ctypes.POINTER(ctypes.c_ubyte),  # pBuffer : BYTE* optional, out
    ctypes.POINTER(wintypes.DWORD),  # pcbPS2ColorRenderingIntent : DWORD* in/out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('mscms.dll')
GetPS2ColorRenderingIntent = Fiddle::Function.new(
  lib['GetPS2ColorRenderingIntent'],
  [
    Fiddle::TYPE_INTPTR_T,  # hProfile : INT_PTR
    -Fiddle::TYPE_INT,  # dwIntent : DWORD
    Fiddle::TYPE_VOIDP,  # pBuffer : BYTE* optional, out
    Fiddle::TYPE_VOIDP,  # pcbPS2ColorRenderingIntent : DWORD* in/out
  ],
  Fiddle::TYPE_INT)
#[link(name = "mscms")]
extern "system" {
    fn GetPS2ColorRenderingIntent(
        hProfile: isize,  // INT_PTR
        dwIntent: u32,  // DWORD
        pBuffer: *mut u8,  // BYTE* optional, out
        pcbPS2ColorRenderingIntent: *mut u32  // DWORD* in/out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("mscms.dll")]
public static extern bool GetPS2ColorRenderingIntent(IntPtr hProfile, uint dwIntent, IntPtr pBuffer, ref uint pcbPS2ColorRenderingIntent);
"@
$api = Add-Type -MemberDefinition $sig -Name 'mscms_GetPS2ColorRenderingIntent' -Namespace Win32 -PassThru
# $api::GetPS2ColorRenderingIntent(hProfile, dwIntent, pBuffer, pcbPS2ColorRenderingIntent)
#uselib "mscms.dll"
#func global GetPS2ColorRenderingIntent "GetPS2ColorRenderingIntent" sptr, sptr, sptr, sptr
; GetPS2ColorRenderingIntent hProfile, dwIntent, varptr(pBuffer), varptr(pcbPS2ColorRenderingIntent)   ; 戻り値は stat
; hProfile : INT_PTR -> "sptr"
; dwIntent : DWORD -> "sptr"
; pBuffer : BYTE* optional, out -> "sptr"
; pcbPS2ColorRenderingIntent : DWORD* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "mscms.dll"
#cfunc global GetPS2ColorRenderingIntent "GetPS2ColorRenderingIntent" sptr, int, var, var
; res = GetPS2ColorRenderingIntent(hProfile, dwIntent, pBuffer, pcbPS2ColorRenderingIntent)
; hProfile : INT_PTR -> "sptr"
; dwIntent : DWORD -> "int"
; pBuffer : BYTE* optional, out -> "var"
; pcbPS2ColorRenderingIntent : DWORD* in/out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; BOOL GetPS2ColorRenderingIntent(INT_PTR hProfile, DWORD dwIntent, BYTE* pBuffer, DWORD* pcbPS2ColorRenderingIntent)
#uselib "mscms.dll"
#cfunc global GetPS2ColorRenderingIntent "GetPS2ColorRenderingIntent" intptr, int, var, var
; res = GetPS2ColorRenderingIntent(hProfile, dwIntent, pBuffer, pcbPS2ColorRenderingIntent)
; hProfile : INT_PTR -> "intptr"
; dwIntent : DWORD -> "int"
; pBuffer : BYTE* optional, out -> "var"
; pcbPS2ColorRenderingIntent : DWORD* in/out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	mscms = windows.NewLazySystemDLL("mscms.dll")
	procGetPS2ColorRenderingIntent = mscms.NewProc("GetPS2ColorRenderingIntent")
)

// hProfile (INT_PTR), dwIntent (DWORD), pBuffer (BYTE* optional, out), pcbPS2ColorRenderingIntent (DWORD* in/out)
r1, _, err := procGetPS2ColorRenderingIntent.Call(
	uintptr(hProfile),
	uintptr(dwIntent),
	uintptr(pBuffer),
	uintptr(pcbPS2ColorRenderingIntent),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // BOOL
function GetPS2ColorRenderingIntent(
  hProfile: NativeInt;   // INT_PTR
  dwIntent: DWORD;   // DWORD
  pBuffer: Pointer;   // BYTE* optional, out
  pcbPS2ColorRenderingIntent: Pointer   // DWORD* in/out
): BOOL; stdcall;
  external 'mscms.dll' name 'GetPS2ColorRenderingIntent';
result := DllCall("mscms\GetPS2ColorRenderingIntent"
    , "Ptr", hProfile   ; INT_PTR
    , "UInt", dwIntent   ; DWORD
    , "Ptr", pBuffer   ; BYTE* optional, out
    , "Ptr", pcbPS2ColorRenderingIntent   ; DWORD* in/out
    , "Int")   ; return: BOOL
●GetPS2ColorRenderingIntent(hProfile, dwIntent, pBuffer, pcbPS2ColorRenderingIntent) = DLL("mscms.dll", "bool GetPS2ColorRenderingIntent(int, dword, void*, void*)")
# 呼び出し: GetPS2ColorRenderingIntent(hProfile, dwIntent, pBuffer, pcbPS2ColorRenderingIntent)
# hProfile : INT_PTR -> "int"
# dwIntent : DWORD -> "dword"
# pBuffer : BYTE* optional, out -> "void*"
# pcbPS2ColorRenderingIntent : DWORD* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。