ホーム › Media.Multimedia › DrawDibBegin
DrawDibBegin
関数DrawDib描画環境を初期化して準備する。
シグネチャ
// MSVFW32.dll
#include <windows.h>
BOOL DrawDibBegin(
INT_PTR hdd,
HDC hdc, // optional
INT dxDst,
INT dyDst,
BITMAPINFOHEADER* lpbi,
INT dxSrc,
INT dySrc,
DWORD wFlags
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hdd | INT_PTR | in |
| hdc | HDC | inoptional |
| dxDst | INT | in |
| dyDst | INT | in |
| lpbi | BITMAPINFOHEADER* | in |
| dxSrc | INT | in |
| dySrc | INT | in |
| wFlags | DWORD | in |
戻り値の型: BOOL
各言語での呼び出し定義
// MSVFW32.dll
#include <windows.h>
BOOL DrawDibBegin(
INT_PTR hdd,
HDC hdc, // optional
INT dxDst,
INT dyDst,
BITMAPINFOHEADER* lpbi,
INT dxSrc,
INT dySrc,
DWORD wFlags
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("MSVFW32.dll", ExactSpelling = true)]
static extern bool DrawDibBegin(
IntPtr hdd, // INT_PTR
IntPtr hdc, // HDC optional
int dxDst, // INT
int dyDst, // INT
IntPtr lpbi, // BITMAPINFOHEADER*
int dxSrc, // INT
int dySrc, // INT
uint wFlags // DWORD
);<DllImport("MSVFW32.dll", ExactSpelling:=True)>
Public Shared Function DrawDibBegin(
hdd As IntPtr, ' INT_PTR
hdc As IntPtr, ' HDC optional
dxDst As Integer, ' INT
dyDst As Integer, ' INT
lpbi As IntPtr, ' BITMAPINFOHEADER*
dxSrc As Integer, ' INT
dySrc As Integer, ' INT
wFlags As UInteger ' DWORD
) As Boolean
End Function' hdd : INT_PTR
' hdc : HDC optional
' dxDst : INT
' dyDst : INT
' lpbi : BITMAPINFOHEADER*
' dxSrc : INT
' dySrc : INT
' wFlags : DWORD
Declare PtrSafe Function DrawDibBegin Lib "msvfw32" ( _
ByVal hdd As LongPtr, _
ByVal hdc As LongPtr, _
ByVal dxDst As Long, _
ByVal dyDst As Long, _
ByVal lpbi As LongPtr, _
ByVal dxSrc As Long, _
ByVal dySrc As Long, _
ByVal wFlags As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
DrawDibBegin = ctypes.windll.msvfw32.DrawDibBegin
DrawDibBegin.restype = wintypes.BOOL
DrawDibBegin.argtypes = [
ctypes.c_ssize_t, # hdd : INT_PTR
wintypes.HANDLE, # hdc : HDC optional
ctypes.c_int, # dxDst : INT
ctypes.c_int, # dyDst : INT
ctypes.c_void_p, # lpbi : BITMAPINFOHEADER*
ctypes.c_int, # dxSrc : INT
ctypes.c_int, # dySrc : INT
wintypes.DWORD, # wFlags : DWORD
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('MSVFW32.dll')
DrawDibBegin = Fiddle::Function.new(
lib['DrawDibBegin'],
[
Fiddle::TYPE_INTPTR_T, # hdd : INT_PTR
Fiddle::TYPE_VOIDP, # hdc : HDC optional
Fiddle::TYPE_INT, # dxDst : INT
Fiddle::TYPE_INT, # dyDst : INT
Fiddle::TYPE_VOIDP, # lpbi : BITMAPINFOHEADER*
Fiddle::TYPE_INT, # dxSrc : INT
Fiddle::TYPE_INT, # dySrc : INT
-Fiddle::TYPE_INT, # wFlags : DWORD
],
Fiddle::TYPE_INT)#[link(name = "msvfw32")]
extern "system" {
fn DrawDibBegin(
hdd: isize, // INT_PTR
hdc: *mut core::ffi::c_void, // HDC optional
dxDst: i32, // INT
dyDst: i32, // INT
lpbi: *mut BITMAPINFOHEADER, // BITMAPINFOHEADER*
dxSrc: i32, // INT
dySrc: i32, // INT
wFlags: u32 // DWORD
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("MSVFW32.dll")]
public static extern bool DrawDibBegin(IntPtr hdd, IntPtr hdc, int dxDst, int dyDst, IntPtr lpbi, int dxSrc, int dySrc, uint wFlags);
"@
$api = Add-Type -MemberDefinition $sig -Name 'MSVFW32_DrawDibBegin' -Namespace Win32 -PassThru
# $api::DrawDibBegin(hdd, hdc, dxDst, dyDst, lpbi, dxSrc, dySrc, wFlags)#uselib "MSVFW32.dll"
#func global DrawDibBegin "DrawDibBegin" sptr, sptr, sptr, sptr, sptr, sptr, sptr, sptr
; DrawDibBegin hdd, hdc, dxDst, dyDst, varptr(lpbi), dxSrc, dySrc, wFlags ; 戻り値は stat
; hdd : INT_PTR -> "sptr"
; hdc : HDC optional -> "sptr"
; dxDst : INT -> "sptr"
; dyDst : INT -> "sptr"
; lpbi : BITMAPINFOHEADER* -> "sptr"
; dxSrc : INT -> "sptr"
; dySrc : INT -> "sptr"
; wFlags : DWORD -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "MSVFW32.dll" #cfunc global DrawDibBegin "DrawDibBegin" sptr, sptr, int, int, var, int, int, int ; res = DrawDibBegin(hdd, hdc, dxDst, dyDst, lpbi, dxSrc, dySrc, wFlags) ; hdd : INT_PTR -> "sptr" ; hdc : HDC optional -> "sptr" ; dxDst : INT -> "int" ; dyDst : INT -> "int" ; lpbi : BITMAPINFOHEADER* -> "var" ; dxSrc : INT -> "int" ; dySrc : INT -> "int" ; wFlags : DWORD -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "MSVFW32.dll" #cfunc global DrawDibBegin "DrawDibBegin" sptr, sptr, int, int, sptr, int, int, int ; res = DrawDibBegin(hdd, hdc, dxDst, dyDst, varptr(lpbi), dxSrc, dySrc, wFlags) ; hdd : INT_PTR -> "sptr" ; hdc : HDC optional -> "sptr" ; dxDst : INT -> "int" ; dyDst : INT -> "int" ; lpbi : BITMAPINFOHEADER* -> "sptr" ; dxSrc : INT -> "int" ; dySrc : INT -> "int" ; wFlags : DWORD -> "int" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; BOOL DrawDibBegin(INT_PTR hdd, HDC hdc, INT dxDst, INT dyDst, BITMAPINFOHEADER* lpbi, INT dxSrc, INT dySrc, DWORD wFlags) #uselib "MSVFW32.dll" #cfunc global DrawDibBegin "DrawDibBegin" intptr, intptr, int, int, var, int, int, int ; res = DrawDibBegin(hdd, hdc, dxDst, dyDst, lpbi, dxSrc, dySrc, wFlags) ; hdd : INT_PTR -> "intptr" ; hdc : HDC optional -> "intptr" ; dxDst : INT -> "int" ; dyDst : INT -> "int" ; lpbi : BITMAPINFOHEADER* -> "var" ; dxSrc : INT -> "int" ; dySrc : INT -> "int" ; wFlags : DWORD -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; BOOL DrawDibBegin(INT_PTR hdd, HDC hdc, INT dxDst, INT dyDst, BITMAPINFOHEADER* lpbi, INT dxSrc, INT dySrc, DWORD wFlags) #uselib "MSVFW32.dll" #cfunc global DrawDibBegin "DrawDibBegin" intptr, intptr, int, int, intptr, int, int, int ; res = DrawDibBegin(hdd, hdc, dxDst, dyDst, varptr(lpbi), dxSrc, dySrc, wFlags) ; hdd : INT_PTR -> "intptr" ; hdc : HDC optional -> "intptr" ; dxDst : INT -> "int" ; dyDst : INT -> "int" ; lpbi : BITMAPINFOHEADER* -> "intptr" ; dxSrc : INT -> "int" ; dySrc : INT -> "int" ; wFlags : DWORD -> "int" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
msvfw32 = windows.NewLazySystemDLL("MSVFW32.dll")
procDrawDibBegin = msvfw32.NewProc("DrawDibBegin")
)
// hdd (INT_PTR), hdc (HDC optional), dxDst (INT), dyDst (INT), lpbi (BITMAPINFOHEADER*), dxSrc (INT), dySrc (INT), wFlags (DWORD)
r1, _, err := procDrawDibBegin.Call(
uintptr(hdd),
uintptr(hdc),
uintptr(dxDst),
uintptr(dyDst),
uintptr(lpbi),
uintptr(dxSrc),
uintptr(dySrc),
uintptr(wFlags),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction DrawDibBegin(
hdd: NativeInt; // INT_PTR
hdc: THandle; // HDC optional
dxDst: Integer; // INT
dyDst: Integer; // INT
lpbi: Pointer; // BITMAPINFOHEADER*
dxSrc: Integer; // INT
dySrc: Integer; // INT
wFlags: DWORD // DWORD
): BOOL; stdcall;
external 'MSVFW32.dll' name 'DrawDibBegin';result := DllCall("MSVFW32\DrawDibBegin"
, "Ptr", hdd ; INT_PTR
, "Ptr", hdc ; HDC optional
, "Int", dxDst ; INT
, "Int", dyDst ; INT
, "Ptr", lpbi ; BITMAPINFOHEADER*
, "Int", dxSrc ; INT
, "Int", dySrc ; INT
, "UInt", wFlags ; DWORD
, "Int") ; return: BOOL●DrawDibBegin(hdd, hdc, dxDst, dyDst, lpbi, dxSrc, dySrc, wFlags) = DLL("MSVFW32.dll", "bool DrawDibBegin(int, void*, int, int, void*, int, int, dword)")
# 呼び出し: DrawDibBegin(hdd, hdc, dxDst, dyDst, lpbi, dxSrc, dySrc, wFlags)
# hdd : INT_PTR -> "int"
# hdc : HDC optional -> "void*"
# dxDst : INT -> "int"
# dyDst : INT -> "int"
# lpbi : BITMAPINFOHEADER* -> "void*"
# dxSrc : INT -> "int"
# dySrc : INT -> "int"
# wFlags : DWORD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。