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