ホーム › Graphics.Gdi › PatBlt
PatBlt
関数現在のブラシで矩形をパターン描画する。
シグネチャ
// GDI32.dll
#include <windows.h>
BOOL PatBlt(
HDC hdc,
INT x,
INT y,
INT w,
INT h,
ROP_CODE rop
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hdc | HDC | in |
| x | INT | in |
| y | INT | in |
| w | INT | in |
| h | INT | in |
| rop | ROP_CODE | in |
戻り値の型: BOOL
各言語での呼び出し定義
// GDI32.dll
#include <windows.h>
BOOL PatBlt(
HDC hdc,
INT x,
INT y,
INT w,
INT h,
ROP_CODE rop
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("GDI32.dll", ExactSpelling = true)]
static extern bool PatBlt(
IntPtr hdc, // HDC
int x, // INT
int y, // INT
int w, // INT
int h, // INT
uint rop // ROP_CODE
);<DllImport("GDI32.dll", ExactSpelling:=True)>
Public Shared Function PatBlt(
hdc As IntPtr, ' HDC
x As Integer, ' INT
y As Integer, ' INT
w As Integer, ' INT
h As Integer, ' INT
rop As UInteger ' ROP_CODE
) As Boolean
End Function' hdc : HDC
' x : INT
' y : INT
' w : INT
' h : INT
' rop : ROP_CODE
Declare PtrSafe Function PatBlt Lib "gdi32" ( _
ByVal hdc As LongPtr, _
ByVal x As Long, _
ByVal y As Long, _
ByVal w As Long, _
ByVal h As Long, _
ByVal rop As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
PatBlt = ctypes.windll.gdi32.PatBlt
PatBlt.restype = wintypes.BOOL
PatBlt.argtypes = [
wintypes.HANDLE, # hdc : HDC
ctypes.c_int, # x : INT
ctypes.c_int, # y : INT
ctypes.c_int, # w : INT
ctypes.c_int, # h : INT
wintypes.DWORD, # rop : ROP_CODE
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('GDI32.dll')
PatBlt = Fiddle::Function.new(
lib['PatBlt'],
[
Fiddle::TYPE_VOIDP, # hdc : HDC
Fiddle::TYPE_INT, # x : INT
Fiddle::TYPE_INT, # y : INT
Fiddle::TYPE_INT, # w : INT
Fiddle::TYPE_INT, # h : INT
-Fiddle::TYPE_INT, # rop : ROP_CODE
],
Fiddle::TYPE_INT)#[link(name = "gdi32")]
extern "system" {
fn PatBlt(
hdc: *mut core::ffi::c_void, // HDC
x: i32, // INT
y: i32, // INT
w: i32, // INT
h: i32, // INT
rop: u32 // ROP_CODE
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("GDI32.dll")]
public static extern bool PatBlt(IntPtr hdc, int x, int y, int w, int h, uint rop);
"@
$api = Add-Type -MemberDefinition $sig -Name 'GDI32_PatBlt' -Namespace Win32 -PassThru
# $api::PatBlt(hdc, x, y, w, h, rop)#uselib "GDI32.dll"
#func global PatBlt "PatBlt" sptr, sptr, sptr, sptr, sptr, sptr
; PatBlt hdc, x, y, w, h, rop ; 戻り値は stat
; hdc : HDC -> "sptr"
; x : INT -> "sptr"
; y : INT -> "sptr"
; w : INT -> "sptr"
; h : INT -> "sptr"
; rop : ROP_CODE -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "GDI32.dll"
#cfunc global PatBlt "PatBlt" sptr, int, int, int, int, int
; res = PatBlt(hdc, x, y, w, h, rop)
; hdc : HDC -> "sptr"
; x : INT -> "int"
; y : INT -> "int"
; w : INT -> "int"
; h : INT -> "int"
; rop : ROP_CODE -> "int"; BOOL PatBlt(HDC hdc, INT x, INT y, INT w, INT h, ROP_CODE rop)
#uselib "GDI32.dll"
#cfunc global PatBlt "PatBlt" intptr, int, int, int, int, int
; res = PatBlt(hdc, x, y, w, h, rop)
; hdc : HDC -> "intptr"
; x : INT -> "int"
; y : INT -> "int"
; w : INT -> "int"
; h : INT -> "int"
; rop : ROP_CODE -> "int"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
gdi32 = windows.NewLazySystemDLL("GDI32.dll")
procPatBlt = gdi32.NewProc("PatBlt")
)
// hdc (HDC), x (INT), y (INT), w (INT), h (INT), rop (ROP_CODE)
r1, _, err := procPatBlt.Call(
uintptr(hdc),
uintptr(x),
uintptr(y),
uintptr(w),
uintptr(h),
uintptr(rop),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction PatBlt(
hdc: THandle; // HDC
x: Integer; // INT
y: Integer; // INT
w: Integer; // INT
h: Integer; // INT
rop: DWORD // ROP_CODE
): BOOL; stdcall;
external 'GDI32.dll' name 'PatBlt';result := DllCall("GDI32\PatBlt"
, "Ptr", hdc ; HDC
, "Int", x ; INT
, "Int", y ; INT
, "Int", w ; INT
, "Int", h ; INT
, "UInt", rop ; ROP_CODE
, "Int") ; return: BOOL●PatBlt(hdc, x, y, w, h, rop) = DLL("GDI32.dll", "bool PatBlt(void*, int, int, int, int, dword)")
# 呼び出し: PatBlt(hdc, x, y, w, h, rop)
# hdc : HDC -> "void*"
# x : INT -> "int"
# y : INT -> "int"
# w : INT -> "int"
# h : INT -> "int"
# rop : ROP_CODE -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。