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_PTRinPostScript色レンダリングインテントを取得する元のカラープロファイルハンドル。
dwIntentDWORDin取得するレンダリングインテントを指定する値。
pBufferBYTE*outoptional生成されたPostScriptデータを受け取るバッファ。NULL可でサイズ問い合わせ。
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 <MarshalAs(UnmanagedType.Bool)> 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)。
const std = @import("std");

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

typedef GetPS2ColorRenderingIntentNative = Int32 Function(IntPtr, Uint32, Pointer<Uint8>, Pointer<Uint32>);
typedef GetPS2ColorRenderingIntentDart = int Function(int, int, Pointer<Uint8>, Pointer<Uint32>);
final GetPS2ColorRenderingIntent = DynamicLibrary.open('mscms.dll')
    .lookupFunction<GetPS2ColorRenderingIntentNative, GetPS2ColorRenderingIntentDart>('GetPS2ColorRenderingIntent');
// hProfile : INT_PTR -> IntPtr
// dwIntent : DWORD -> Uint32
// pBuffer : BYTE* optional, out -> Pointer<Uint8>
// pcbPS2ColorRenderingIntent : DWORD* in/out -> Pointer<Uint32>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
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';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "GetPS2ColorRenderingIntent"
  c_GetPS2ColorRenderingIntent :: CIntPtr -> Word32 -> Ptr Word8 -> Ptr Word32 -> IO CInt
-- hProfile : INT_PTR -> CIntPtr
-- dwIntent : DWORD -> Word32
-- pBuffer : BYTE* optional, out -> Ptr Word8
-- pcbPS2ColorRenderingIntent : DWORD* in/out -> Ptr Word32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let getps2colorrenderingintent =
  foreign "GetPS2ColorRenderingIntent"
    (intptr_t @-> uint32_t @-> (ptr uint8_t) @-> (ptr uint32_t) @-> returning int32_t)
(* hProfile : INT_PTR -> intptr_t *)
(* dwIntent : DWORD -> uint32_t *)
(* pBuffer : BYTE* optional, out -> (ptr uint8_t) *)
(* pcbPS2ColorRenderingIntent : DWORD* in/out -> (ptr uint32_t) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library mscms (t "mscms.dll"))
(cffi:use-foreign-library mscms)

(cffi:defcfun ("GetPS2ColorRenderingIntent" get-ps2-color-rendering-intent :convention :stdcall) :int32
  (h-profile :int64)   ; INT_PTR
  (dw-intent :uint32)   ; DWORD
  (p-buffer :pointer)   ; BYTE* optional, out
  (pcb-ps2-color-rendering-intent :pointer))   ; DWORD* in/out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $GetPS2ColorRenderingIntent = Win32::API::More->new('mscms',
    'BOOL GetPS2ColorRenderingIntent(LPARAM hProfile, DWORD dwIntent, LPVOID pBuffer, LPVOID pcbPS2ColorRenderingIntent)');
# my $ret = $GetPS2ColorRenderingIntent->Call($hProfile, $dwIntent, $pBuffer, $pcbPS2ColorRenderingIntent);
# hProfile : INT_PTR -> LPARAM
# dwIntent : DWORD -> DWORD
# pBuffer : BYTE* optional, out -> LPVOID
# pcbPS2ColorRenderingIntent : DWORD* in/out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。