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

GdipGetImageAttributesAdjustedPalette

関数
画像属性を適用して調整後のカラーパレットを取得する。
DLLgdiplus.dll呼出規約winapi

シグネチャ

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

Status GdipGetImageAttributesAdjustedPalette(
    GpImageAttributes* imageAttr,
    ColorPalette* colorPalette,
    ColorAdjustType colorAdjustType
);

パラメーター

名前方向
imageAttrGpImageAttributes*inout
colorPaletteColorPalette*inout
colorAdjustTypeColorAdjustTypein

戻り値の型: Status

各言語での呼び出し定義

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

Status GdipGetImageAttributesAdjustedPalette(
    GpImageAttributes* imageAttr,
    ColorPalette* colorPalette,
    ColorAdjustType colorAdjustType
);
[DllImport("gdiplus.dll", ExactSpelling = true)]
static extern int GdipGetImageAttributesAdjustedPalette(
    IntPtr imageAttr,   // GpImageAttributes* in/out
    IntPtr colorPalette,   // ColorPalette* in/out
    int colorAdjustType   // ColorAdjustType
);
<DllImport("gdiplus.dll", ExactSpelling:=True)>
Public Shared Function GdipGetImageAttributesAdjustedPalette(
    imageAttr As IntPtr,   ' GpImageAttributes* in/out
    colorPalette As IntPtr,   ' ColorPalette* in/out
    colorAdjustType As Integer   ' ColorAdjustType
) As Integer
End Function
' imageAttr : GpImageAttributes* in/out
' colorPalette : ColorPalette* in/out
' colorAdjustType : ColorAdjustType
Declare PtrSafe Function GdipGetImageAttributesAdjustedPalette Lib "gdiplus" ( _
    ByVal imageAttr As LongPtr, _
    ByVal colorPalette As LongPtr, _
    ByVal colorAdjustType As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

GdipGetImageAttributesAdjustedPalette = ctypes.windll.gdiplus.GdipGetImageAttributesAdjustedPalette
GdipGetImageAttributesAdjustedPalette.restype = ctypes.c_int
GdipGetImageAttributesAdjustedPalette.argtypes = [
    ctypes.c_void_p,  # imageAttr : GpImageAttributes* in/out
    ctypes.c_void_p,  # colorPalette : ColorPalette* in/out
    ctypes.c_int,  # colorAdjustType : ColorAdjustType
]
require 'fiddle'
require 'fiddle/import'

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

var (
	gdiplus = windows.NewLazySystemDLL("gdiplus.dll")
	procGdipGetImageAttributesAdjustedPalette = gdiplus.NewProc("GdipGetImageAttributesAdjustedPalette")
)

// imageAttr (GpImageAttributes* in/out), colorPalette (ColorPalette* in/out), colorAdjustType (ColorAdjustType)
r1, _, err := procGdipGetImageAttributesAdjustedPalette.Call(
	uintptr(imageAttr),
	uintptr(colorPalette),
	uintptr(colorAdjustType),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // Status
function GdipGetImageAttributesAdjustedPalette(
  imageAttr: Pointer;   // GpImageAttributes* in/out
  colorPalette: Pointer;   // ColorPalette* in/out
  colorAdjustType: Integer   // ColorAdjustType
): Integer; stdcall;
  external 'gdiplus.dll' name 'GdipGetImageAttributesAdjustedPalette';
result := DllCall("gdiplus\GdipGetImageAttributesAdjustedPalette"
    , "Ptr", imageAttr   ; GpImageAttributes* in/out
    , "Ptr", colorPalette   ; ColorPalette* in/out
    , "Int", colorAdjustType   ; ColorAdjustType
    , "Int")   ; return: Status
●GdipGetImageAttributesAdjustedPalette(imageAttr, colorPalette, colorAdjustType) = DLL("gdiplus.dll", "int GdipGetImageAttributesAdjustedPalette(void*, void*, int)")
# 呼び出し: GdipGetImageAttributesAdjustedPalette(imageAttr, colorPalette, colorAdjustType)
# imageAttr : GpImageAttributes* in/out -> "void*"
# colorPalette : ColorPalette* in/out -> "void*"
# colorAdjustType : ColorAdjustType -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。