ホーム › Graphics.GdiPlus › GdipBitmapGetHistogram
GdipBitmapGetHistogram
関数ビットマップの各チャンネルのヒストグラムデータを取得する。
シグネチャ
// gdiplus.dll
#include <windows.h>
Status GdipBitmapGetHistogram(
GpBitmap* bitmap,
HistogramFormat format,
DWORD NumberOfEntries,
DWORD* channel0,
DWORD* channel1,
DWORD* channel2,
DWORD* channel3
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| bitmap | GpBitmap* | inout |
| format | HistogramFormat | in |
| NumberOfEntries | DWORD | in |
| channel0 | DWORD* | out |
| channel1 | DWORD* | out |
| channel2 | DWORD* | out |
| channel3 | DWORD* | out |
戻り値の型: Status
各言語での呼び出し定義
// gdiplus.dll
#include <windows.h>
Status GdipBitmapGetHistogram(
GpBitmap* bitmap,
HistogramFormat format,
DWORD NumberOfEntries,
DWORD* channel0,
DWORD* channel1,
DWORD* channel2,
DWORD* channel3
);[DllImport("gdiplus.dll", ExactSpelling = true)]
static extern int GdipBitmapGetHistogram(
IntPtr bitmap, // GpBitmap* in/out
int format, // HistogramFormat
uint NumberOfEntries, // DWORD
out uint channel0, // DWORD* out
out uint channel1, // DWORD* out
out uint channel2, // DWORD* out
out uint channel3 // DWORD* out
);<DllImport("gdiplus.dll", ExactSpelling:=True)>
Public Shared Function GdipBitmapGetHistogram(
bitmap As IntPtr, ' GpBitmap* in/out
format As Integer, ' HistogramFormat
NumberOfEntries As UInteger, ' DWORD
<Out> ByRef channel0 As UInteger, ' DWORD* out
<Out> ByRef channel1 As UInteger, ' DWORD* out
<Out> ByRef channel2 As UInteger, ' DWORD* out
<Out> ByRef channel3 As UInteger ' DWORD* out
) As Integer
End Function' bitmap : GpBitmap* in/out
' format : HistogramFormat
' NumberOfEntries : DWORD
' channel0 : DWORD* out
' channel1 : DWORD* out
' channel2 : DWORD* out
' channel3 : DWORD* out
Declare PtrSafe Function GdipBitmapGetHistogram Lib "gdiplus" ( _
ByVal bitmap As LongPtr, _
ByVal format As Long, _
ByVal NumberOfEntries As Long, _
ByRef channel0 As Long, _
ByRef channel1 As Long, _
ByRef channel2 As Long, _
ByRef channel3 As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
GdipBitmapGetHistogram = ctypes.windll.gdiplus.GdipBitmapGetHistogram
GdipBitmapGetHistogram.restype = ctypes.c_int
GdipBitmapGetHistogram.argtypes = [
ctypes.c_void_p, # bitmap : GpBitmap* in/out
ctypes.c_int, # format : HistogramFormat
wintypes.DWORD, # NumberOfEntries : DWORD
ctypes.POINTER(wintypes.DWORD), # channel0 : DWORD* out
ctypes.POINTER(wintypes.DWORD), # channel1 : DWORD* out
ctypes.POINTER(wintypes.DWORD), # channel2 : DWORD* out
ctypes.POINTER(wintypes.DWORD), # channel3 : DWORD* out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('gdiplus.dll')
GdipBitmapGetHistogram = Fiddle::Function.new(
lib['GdipBitmapGetHistogram'],
[
Fiddle::TYPE_VOIDP, # bitmap : GpBitmap* in/out
Fiddle::TYPE_INT, # format : HistogramFormat
-Fiddle::TYPE_INT, # NumberOfEntries : DWORD
Fiddle::TYPE_VOIDP, # channel0 : DWORD* out
Fiddle::TYPE_VOIDP, # channel1 : DWORD* out
Fiddle::TYPE_VOIDP, # channel2 : DWORD* out
Fiddle::TYPE_VOIDP, # channel3 : DWORD* out
],
Fiddle::TYPE_INT)#[link(name = "gdiplus")]
extern "system" {
fn GdipBitmapGetHistogram(
bitmap: *mut GpBitmap, // GpBitmap* in/out
format: i32, // HistogramFormat
NumberOfEntries: u32, // DWORD
channel0: *mut u32, // DWORD* out
channel1: *mut u32, // DWORD* out
channel2: *mut u32, // DWORD* out
channel3: *mut u32 // DWORD* out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("gdiplus.dll")]
public static extern int GdipBitmapGetHistogram(IntPtr bitmap, int format, uint NumberOfEntries, out uint channel0, out uint channel1, out uint channel2, out uint channel3);
"@
$api = Add-Type -MemberDefinition $sig -Name 'gdiplus_GdipBitmapGetHistogram' -Namespace Win32 -PassThru
# $api::GdipBitmapGetHistogram(bitmap, format, NumberOfEntries, channel0, channel1, channel2, channel3)#uselib "gdiplus.dll"
#func global GdipBitmapGetHistogram "GdipBitmapGetHistogram" sptr, sptr, sptr, sptr, sptr, sptr, sptr
; GdipBitmapGetHistogram varptr(bitmap), format, NumberOfEntries, varptr(channel0), varptr(channel1), varptr(channel2), varptr(channel3) ; 戻り値は stat
; bitmap : GpBitmap* in/out -> "sptr"
; format : HistogramFormat -> "sptr"
; NumberOfEntries : DWORD -> "sptr"
; channel0 : DWORD* out -> "sptr"
; channel1 : DWORD* out -> "sptr"
; channel2 : DWORD* out -> "sptr"
; channel3 : DWORD* out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "gdiplus.dll" #cfunc global GdipBitmapGetHistogram "GdipBitmapGetHistogram" var, int, int, var, var, var, var ; res = GdipBitmapGetHistogram(bitmap, format, NumberOfEntries, channel0, channel1, channel2, channel3) ; bitmap : GpBitmap* in/out -> "var" ; format : HistogramFormat -> "int" ; NumberOfEntries : DWORD -> "int" ; channel0 : DWORD* out -> "var" ; channel1 : DWORD* out -> "var" ; channel2 : DWORD* out -> "var" ; channel3 : DWORD* out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "gdiplus.dll" #cfunc global GdipBitmapGetHistogram "GdipBitmapGetHistogram" sptr, int, int, sptr, sptr, sptr, sptr ; res = GdipBitmapGetHistogram(varptr(bitmap), format, NumberOfEntries, varptr(channel0), varptr(channel1), varptr(channel2), varptr(channel3)) ; bitmap : GpBitmap* in/out -> "sptr" ; format : HistogramFormat -> "int" ; NumberOfEntries : DWORD -> "int" ; channel0 : DWORD* out -> "sptr" ; channel1 : DWORD* out -> "sptr" ; channel2 : DWORD* out -> "sptr" ; channel3 : DWORD* out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; Status GdipBitmapGetHistogram(GpBitmap* bitmap, HistogramFormat format, DWORD NumberOfEntries, DWORD* channel0, DWORD* channel1, DWORD* channel2, DWORD* channel3) #uselib "gdiplus.dll" #cfunc global GdipBitmapGetHistogram "GdipBitmapGetHistogram" var, int, int, var, var, var, var ; res = GdipBitmapGetHistogram(bitmap, format, NumberOfEntries, channel0, channel1, channel2, channel3) ; bitmap : GpBitmap* in/out -> "var" ; format : HistogramFormat -> "int" ; NumberOfEntries : DWORD -> "int" ; channel0 : DWORD* out -> "var" ; channel1 : DWORD* out -> "var" ; channel2 : DWORD* out -> "var" ; channel3 : DWORD* out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; Status GdipBitmapGetHistogram(GpBitmap* bitmap, HistogramFormat format, DWORD NumberOfEntries, DWORD* channel0, DWORD* channel1, DWORD* channel2, DWORD* channel3) #uselib "gdiplus.dll" #cfunc global GdipBitmapGetHistogram "GdipBitmapGetHistogram" intptr, int, int, intptr, intptr, intptr, intptr ; res = GdipBitmapGetHistogram(varptr(bitmap), format, NumberOfEntries, varptr(channel0), varptr(channel1), varptr(channel2), varptr(channel3)) ; bitmap : GpBitmap* in/out -> "intptr" ; format : HistogramFormat -> "int" ; NumberOfEntries : DWORD -> "int" ; channel0 : DWORD* out -> "intptr" ; channel1 : DWORD* out -> "intptr" ; channel2 : DWORD* out -> "intptr" ; channel3 : DWORD* out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
gdiplus = windows.NewLazySystemDLL("gdiplus.dll")
procGdipBitmapGetHistogram = gdiplus.NewProc("GdipBitmapGetHistogram")
)
// bitmap (GpBitmap* in/out), format (HistogramFormat), NumberOfEntries (DWORD), channel0 (DWORD* out), channel1 (DWORD* out), channel2 (DWORD* out), channel3 (DWORD* out)
r1, _, err := procGdipBitmapGetHistogram.Call(
uintptr(bitmap),
uintptr(format),
uintptr(NumberOfEntries),
uintptr(channel0),
uintptr(channel1),
uintptr(channel2),
uintptr(channel3),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // Statusfunction GdipBitmapGetHistogram(
bitmap: Pointer; // GpBitmap* in/out
format: Integer; // HistogramFormat
NumberOfEntries: DWORD; // DWORD
channel0: Pointer; // DWORD* out
channel1: Pointer; // DWORD* out
channel2: Pointer; // DWORD* out
channel3: Pointer // DWORD* out
): Integer; stdcall;
external 'gdiplus.dll' name 'GdipBitmapGetHistogram';result := DllCall("gdiplus\GdipBitmapGetHistogram"
, "Ptr", bitmap ; GpBitmap* in/out
, "Int", format ; HistogramFormat
, "UInt", NumberOfEntries ; DWORD
, "Ptr", channel0 ; DWORD* out
, "Ptr", channel1 ; DWORD* out
, "Ptr", channel2 ; DWORD* out
, "Ptr", channel3 ; DWORD* out
, "Int") ; return: Status●GdipBitmapGetHistogram(bitmap, format, NumberOfEntries, channel0, channel1, channel2, channel3) = DLL("gdiplus.dll", "int GdipBitmapGetHistogram(void*, int, dword, void*, void*, void*, void*)")
# 呼び出し: GdipBitmapGetHistogram(bitmap, format, NumberOfEntries, channel0, channel1, channel2, channel3)
# bitmap : GpBitmap* in/out -> "void*"
# format : HistogramFormat -> "int"
# NumberOfEntries : DWORD -> "dword"
# channel0 : DWORD* out -> "void*"
# channel1 : DWORD* out -> "void*"
# channel2 : DWORD* out -> "void*"
# channel3 : DWORD* out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。