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