Win32 API 日本語リファレンス
ホームGraphics.GdiPlus › GdipSetImageAttributesOutputChannelColorProfile

GdipSetImageAttributesOutputChannelColorProfile

関数
画像属性に出力チャンネル用のカラープロファイルを設定する。
DLLgdiplus.dll呼出規約winapi

シグネチャ

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

Status GdipSetImageAttributesOutputChannelColorProfile(
    GpImageAttributes* imageattr,
    ColorAdjustType type,
    BOOL enableFlag,
    LPCWSTR colorProfileFilename
);

パラメーター

名前方向説明
imageattrGpImageAttributes*inout操作対象のGpImageAttributesオブジェクトへのポインタ。
typeColorAdjustTypein適用対象のカテゴリを示すColorAdjustType列挙値。
enableFlagBOOLin出力カラープロファイル適用を有効にするかを示すBOOL。
colorProfileFilenameLPCWSTRin適用するICCカラープロファイルファイルのパスを示すワイド文字列。

戻り値の型: Status

各言語での呼び出し定義

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

Status GdipSetImageAttributesOutputChannelColorProfile(
    GpImageAttributes* imageattr,
    ColorAdjustType type,
    BOOL enableFlag,
    LPCWSTR colorProfileFilename
);
[DllImport("gdiplus.dll", ExactSpelling = true)]
static extern int GdipSetImageAttributesOutputChannelColorProfile(
    IntPtr imageattr,   // GpImageAttributes* in/out
    int type,   // ColorAdjustType
    bool enableFlag,   // BOOL
    [MarshalAs(UnmanagedType.LPWStr)] string colorProfileFilename   // LPCWSTR
);
<DllImport("gdiplus.dll", ExactSpelling:=True)>
Public Shared Function GdipSetImageAttributesOutputChannelColorProfile(
    imageattr As IntPtr,   ' GpImageAttributes* in/out
    type As Integer,   ' ColorAdjustType
    enableFlag As Boolean,   ' BOOL
    <MarshalAs(UnmanagedType.LPWStr)> colorProfileFilename As String   ' LPCWSTR
) As Integer
End Function
' imageattr : GpImageAttributes* in/out
' type : ColorAdjustType
' enableFlag : BOOL
' colorProfileFilename : LPCWSTR
Declare PtrSafe Function GdipSetImageAttributesOutputChannelColorProfile Lib "gdiplus" ( _
    ByVal imageattr As LongPtr, _
    ByVal type As Long, _
    ByVal enableFlag As Long, _
    ByVal colorProfileFilename As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

GdipSetImageAttributesOutputChannelColorProfile = ctypes.windll.gdiplus.GdipSetImageAttributesOutputChannelColorProfile
GdipSetImageAttributesOutputChannelColorProfile.restype = ctypes.c_int
GdipSetImageAttributesOutputChannelColorProfile.argtypes = [
    ctypes.c_void_p,  # imageattr : GpImageAttributes* in/out
    ctypes.c_int,  # type : ColorAdjustType
    wintypes.BOOL,  # enableFlag : BOOL
    wintypes.LPCWSTR,  # colorProfileFilename : LPCWSTR
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('gdiplus.dll')
GdipSetImageAttributesOutputChannelColorProfile = Fiddle::Function.new(
  lib['GdipSetImageAttributesOutputChannelColorProfile'],
  [
    Fiddle::TYPE_VOIDP,  # imageattr : GpImageAttributes* in/out
    Fiddle::TYPE_INT,  # type : ColorAdjustType
    Fiddle::TYPE_INT,  # enableFlag : BOOL
    Fiddle::TYPE_VOIDP,  # colorProfileFilename : LPCWSTR
  ],
  Fiddle::TYPE_INT)
#[link(name = "gdiplus")]
extern "system" {
    fn GdipSetImageAttributesOutputChannelColorProfile(
        imageattr: *mut GpImageAttributes,  // GpImageAttributes* in/out
        type: i32,  // ColorAdjustType
        enableFlag: i32,  // BOOL
        colorProfileFilename: *const u16  // LPCWSTR
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("gdiplus.dll")]
public static extern int GdipSetImageAttributesOutputChannelColorProfile(IntPtr imageattr, int type, bool enableFlag, [MarshalAs(UnmanagedType.LPWStr)] string colorProfileFilename);
"@
$api = Add-Type -MemberDefinition $sig -Name 'gdiplus_GdipSetImageAttributesOutputChannelColorProfile' -Namespace Win32 -PassThru
# $api::GdipSetImageAttributesOutputChannelColorProfile(imageattr, type, enableFlag, colorProfileFilename)
#uselib "gdiplus.dll"
#func global GdipSetImageAttributesOutputChannelColorProfile "GdipSetImageAttributesOutputChannelColorProfile" sptr, sptr, sptr, sptr
; GdipSetImageAttributesOutputChannelColorProfile varptr(imageattr), type, enableFlag, colorProfileFilename   ; 戻り値は stat
; imageattr : GpImageAttributes* in/out -> "sptr"
; type : ColorAdjustType -> "sptr"
; enableFlag : BOOL -> "sptr"
; colorProfileFilename : LPCWSTR -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "gdiplus.dll"
#cfunc global GdipSetImageAttributesOutputChannelColorProfile "GdipSetImageAttributesOutputChannelColorProfile" var, int, int, wstr
; res = GdipSetImageAttributesOutputChannelColorProfile(imageattr, type, enableFlag, colorProfileFilename)
; imageattr : GpImageAttributes* in/out -> "var"
; type : ColorAdjustType -> "int"
; enableFlag : BOOL -> "int"
; colorProfileFilename : LPCWSTR -> "wstr"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; Status GdipSetImageAttributesOutputChannelColorProfile(GpImageAttributes* imageattr, ColorAdjustType type, BOOL enableFlag, LPCWSTR colorProfileFilename)
#uselib "gdiplus.dll"
#cfunc global GdipSetImageAttributesOutputChannelColorProfile "GdipSetImageAttributesOutputChannelColorProfile" var, int, int, wstr
; res = GdipSetImageAttributesOutputChannelColorProfile(imageattr, type, enableFlag, colorProfileFilename)
; imageattr : GpImageAttributes* in/out -> "var"
; type : ColorAdjustType -> "int"
; enableFlag : BOOL -> "int"
; colorProfileFilename : LPCWSTR -> "wstr"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	gdiplus = windows.NewLazySystemDLL("gdiplus.dll")
	procGdipSetImageAttributesOutputChannelColorProfile = gdiplus.NewProc("GdipSetImageAttributesOutputChannelColorProfile")
)

// imageattr (GpImageAttributes* in/out), type (ColorAdjustType), enableFlag (BOOL), colorProfileFilename (LPCWSTR)
r1, _, err := procGdipSetImageAttributesOutputChannelColorProfile.Call(
	uintptr(imageattr),
	uintptr(type),
	uintptr(enableFlag),
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(colorProfileFilename))),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // Status
function GdipSetImageAttributesOutputChannelColorProfile(
  imageattr: Pointer;   // GpImageAttributes* in/out
  type: Integer;   // ColorAdjustType
  enableFlag: BOOL;   // BOOL
  colorProfileFilename: PWideChar   // LPCWSTR
): Integer; stdcall;
  external 'gdiplus.dll' name 'GdipSetImageAttributesOutputChannelColorProfile';
result := DllCall("gdiplus\GdipSetImageAttributesOutputChannelColorProfile"
    , "Ptr", imageattr   ; GpImageAttributes* in/out
    , "Int", type   ; ColorAdjustType
    , "Int", enableFlag   ; BOOL
    , "WStr", colorProfileFilename   ; LPCWSTR
    , "Int")   ; return: Status
●GdipSetImageAttributesOutputChannelColorProfile(imageattr, type, enableFlag, colorProfileFilename) = DLL("gdiplus.dll", "int GdipSetImageAttributesOutputChannelColorProfile(void*, int, bool, char*)")
# 呼び出し: GdipSetImageAttributesOutputChannelColorProfile(imageattr, type, enableFlag, colorProfileFilename)
# imageattr : GpImageAttributes* in/out -> "void*"
# type : ColorAdjustType -> "int"
# enableFlag : BOOL -> "bool"
# colorProfileFilename : LPCWSTR -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
const std = @import("std");

extern "gdiplus" fn GdipSetImageAttributesOutputChannelColorProfile(
    imageattr: [*c]GpImageAttributes, // GpImageAttributes* in/out
    type: i32, // ColorAdjustType
    enableFlag: i32, // BOOL
    colorProfileFilename: [*c]const u16 // LPCWSTR
) callconv(std.os.windows.WINAPI) i32;
proc GdipSetImageAttributesOutputChannelColorProfile(
    imageattr: ptr GpImageAttributes,  # GpImageAttributes* in/out
    `type`: int32,  # ColorAdjustType
    enableFlag: int32,  # BOOL
    colorProfileFilename: WideCString  # LPCWSTR
): int32 {.importc: "GdipSetImageAttributesOutputChannelColorProfile", stdcall, dynlib: "gdiplus.dll".}
pragma(lib, "gdiplus");
extern(Windows)
int GdipSetImageAttributesOutputChannelColorProfile(
    GpImageAttributes* imageattr,   // GpImageAttributes* in/out
    int type,   // ColorAdjustType
    int enableFlag,   // BOOL
    const(wchar)* colorProfileFilename   // LPCWSTR
);
ccall((:GdipSetImageAttributesOutputChannelColorProfile, "gdiplus.dll"), stdcall, Int32,
      (Ptr{GpImageAttributes}, Int32, Int32, Cwstring),
      imageattr, type, enableFlag, colorProfileFilename)
# imageattr : GpImageAttributes* in/out -> Ptr{GpImageAttributes}
# type : ColorAdjustType -> Int32
# enableFlag : BOOL -> Int32
# colorProfileFilename : LPCWSTR -> Cwstring
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
int32_t GdipSetImageAttributesOutputChannelColorProfile(
    void* imageattr,
    int32_t type,
    int32_t enableFlag,
    const uint16_t* colorProfileFilename);
]]
local gdiplus = ffi.load("gdiplus")
-- gdiplus.GdipSetImageAttributesOutputChannelColorProfile(imageattr, type, enableFlag, colorProfileFilename)
-- imageattr : GpImageAttributes* in/out
-- type : ColorAdjustType
-- enableFlag : BOOL
-- colorProfileFilename : LPCWSTR
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('gdiplus.dll');
const GdipSetImageAttributesOutputChannelColorProfile = lib.func('__stdcall', 'GdipSetImageAttributesOutputChannelColorProfile', 'int32_t', ['void *', 'int32_t', 'int32_t', 'str16']);
// GdipSetImageAttributesOutputChannelColorProfile(imageattr, type, enableFlag, colorProfileFilename)
// imageattr : GpImageAttributes* in/out -> 'void *'
// type : ColorAdjustType -> 'int32_t'
// enableFlag : BOOL -> 'int32_t'
// colorProfileFilename : LPCWSTR -> 'str16'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("gdiplus.dll", {
  GdipSetImageAttributesOutputChannelColorProfile: { parameters: ["pointer", "i32", "i32", "buffer"], result: "i32" },
});
// lib.symbols.GdipSetImageAttributesOutputChannelColorProfile(imageattr, type, enableFlag, colorProfileFilename)
// imageattr : GpImageAttributes* in/out -> "pointer"
// type : ColorAdjustType -> "i32"
// enableFlag : BOOL -> "i32"
// colorProfileFilename : LPCWSTR -> "buffer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
int32_t GdipSetImageAttributesOutputChannelColorProfile(
    void* imageattr,
    int32_t type,
    int32_t enableFlag,
    const uint16_t* colorProfileFilename);
C, "gdiplus.dll");
// $ffi->GdipSetImageAttributesOutputChannelColorProfile(imageattr, type, enableFlag, colorProfileFilename);
// imageattr : GpImageAttributes* in/out
// type : ColorAdjustType
// enableFlag : BOOL
// colorProfileFilename : LPCWSTR
// 構造体/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 Gdiplus extends StdCallLibrary {
    Gdiplus INSTANCE = Native.load("gdiplus", Gdiplus.class);
    int GdipSetImageAttributesOutputChannelColorProfile(
        Pointer imageattr,   // GpImageAttributes* in/out
        int type,   // ColorAdjustType
        boolean enableFlag,   // BOOL
        WString colorProfileFilename   // LPCWSTR
    );
}
@[Link("gdiplus")]
lib Libgdiplus
  fun GdipSetImageAttributesOutputChannelColorProfile = GdipSetImageAttributesOutputChannelColorProfile(
    imageattr : GpImageAttributes*,   # GpImageAttributes* in/out
    type_ : Int32,   # ColorAdjustType
    enableFlag : Int32,   # BOOL
    colorProfileFilename : UInt16*   # LPCWSTR
  ) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef GdipSetImageAttributesOutputChannelColorProfileNative = Int32 Function(Pointer<Void>, Int32, Int32, Pointer<Utf16>);
typedef GdipSetImageAttributesOutputChannelColorProfileDart = int Function(Pointer<Void>, int, int, Pointer<Utf16>);
final GdipSetImageAttributesOutputChannelColorProfile = DynamicLibrary.open('gdiplus.dll')
    .lookupFunction<GdipSetImageAttributesOutputChannelColorProfileNative, GdipSetImageAttributesOutputChannelColorProfileDart>('GdipSetImageAttributesOutputChannelColorProfile');
// imageattr : GpImageAttributes* in/out -> Pointer<Void>
// type : ColorAdjustType -> Int32
// enableFlag : BOOL -> Int32
// colorProfileFilename : LPCWSTR -> Pointer<Utf16>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function GdipSetImageAttributesOutputChannelColorProfile(
  imageattr: Pointer;   // GpImageAttributes* in/out
  type: Integer;   // ColorAdjustType
  enableFlag: BOOL;   // BOOL
  colorProfileFilename: PWideChar   // LPCWSTR
): Integer; stdcall;
  external 'gdiplus.dll' name 'GdipSetImageAttributesOutputChannelColorProfile';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "GdipSetImageAttributesOutputChannelColorProfile"
  c_GdipSetImageAttributesOutputChannelColorProfile :: Ptr () -> Int32 -> CInt -> CWString -> IO Int32
-- imageattr : GpImageAttributes* in/out -> Ptr ()
-- type : ColorAdjustType -> Int32
-- enableFlag : BOOL -> CInt
-- colorProfileFilename : LPCWSTR -> CWString
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let gdipsetimageattributesoutputchannelcolorprofile =
  foreign "GdipSetImageAttributesOutputChannelColorProfile"
    ((ptr void) @-> int32_t @-> int32_t @-> (ptr uint16_t) @-> returning int32_t)
(* imageattr : GpImageAttributes* in/out -> (ptr void) *)
(* type : ColorAdjustType -> int32_t *)
(* enableFlag : BOOL -> int32_t *)
(* colorProfileFilename : LPCWSTR -> (ptr uint16_t) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library gdiplus (t "gdiplus.dll"))
(cffi:use-foreign-library gdiplus)

(cffi:defcfun ("GdipSetImageAttributesOutputChannelColorProfile" gdip-set-image-attributes-output-channel-color-profile :convention :stdcall) :int32
  (imageattr :pointer)   ; GpImageAttributes* in/out
  (type :int32)   ; ColorAdjustType
  (enable-flag :int32)   ; BOOL
  (color-profile-filename (:string :encoding :utf-16le)))   ; LPCWSTR
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $GdipSetImageAttributesOutputChannelColorProfile = Win32::API::More->new('gdiplus',
    'int GdipSetImageAttributesOutputChannelColorProfile(LPVOID imageattr, int type, BOOL enableFlag, LPCWSTR colorProfileFilename)');
# my $ret = $GdipSetImageAttributesOutputChannelColorProfile->Call($imageattr, $type, $enableFlag, $colorProfileFilename);
# imageattr : GpImageAttributes* in/out -> LPVOID
# type : ColorAdjustType -> int
# enableFlag : BOOL -> BOOL
# colorProfileFilename : LPCWSTR -> LPCWSTR
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

使用する型