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

GdipGetImagePaletteSize

関数
イメージのカラーパレットのバイトサイズを取得する。
DLLgdiplus.dll呼出規約winapi

シグネチャ

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

Status GdipGetImagePaletteSize(
    GpImage* image,
    INT* size
);

パラメーター

名前方向
imageGpImage*inout
sizeINT*inout

戻り値の型: Status

各言語での呼び出し定義

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

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

GdipGetImagePaletteSize = ctypes.windll.gdiplus.GdipGetImagePaletteSize
GdipGetImagePaletteSize.restype = ctypes.c_int
GdipGetImagePaletteSize.argtypes = [
    ctypes.c_void_p,  # image : GpImage* in/out
    ctypes.POINTER(ctypes.c_int),  # size : INT* in/out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	gdiplus = windows.NewLazySystemDLL("gdiplus.dll")
	procGdipGetImagePaletteSize = gdiplus.NewProc("GdipGetImagePaletteSize")
)

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