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

GdipCreateCachedBitmap

関数
高速描画用のキャッシュ済みビットマップを作成する。
DLLgdiplus.dll呼出規約winapi

シグネチャ

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

Status GdipCreateCachedBitmap(
    GpBitmap* bitmap,
    GpGraphics* graphics,
    GpCachedBitmap** cachedBitmap
);

パラメーター

名前方向
bitmapGpBitmap*inout
graphicsGpGraphics*inout
cachedBitmapGpCachedBitmap**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 方式にも切替可。
出力引数:
; 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 方式にも切替可。
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   // Status
function 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)。