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