MaskBlt
関数シグネチャ
// GDI32.dll
#include <windows.h>
BOOL MaskBlt(
HDC hdcDest,
INT xDest,
INT yDest,
INT width,
INT height,
HDC hdcSrc,
INT xSrc,
INT ySrc,
HBITMAP hbmMask,
INT xMask,
INT yMask,
DWORD rop
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| hdcDest | HDC | in | デスティネーションデバイスコンテキストへのハンドル。 |
| xDest | INT | in | デスティネーション矩形の左上隅の x 座標(論理単位)。 |
| yDest | INT | in | デスティネーション矩形の左上隅の y 座標(論理単位)。 |
| width | INT | in | デスティネーション矩形およびソースビットマップの幅(論理単位)。 |
| height | INT | in | デスティネーション矩形およびソースビットマップの高さ(論理単位)。 |
| hdcSrc | HDC | in | ビットマップのコピー元となるデバイスコンテキストへのハンドル。dwRop パラメーターがソースを含まないラスタオペレーションを指定する場合は、ゼロでなければなりません。 |
| xSrc | INT | in | ソースビットマップの左上隅の x 座標(論理単位)。 |
| ySrc | INT | in | ソースビットマップの左上隅の y 座標(論理単位)。 |
| hbmMask | HBITMAP | in | ソースデバイスコンテキスト内のカラービットマップと合成される、モノクロのマスクビットマップへのハンドル。 |
| xMask | INT | in | hbmMask パラメーターで指定したマスクビットマップの水平方向のピクセルオフセット。 |
| yMask | INT | in | hbmMask パラメーターで指定したマスクビットマップの垂直方向のピクセルオフセット。 |
| rop | DWORD | in | ソースデータとデスティネーションデータの合成方法を制御するために関数が使用する、前景および背景の三項ラスタオペレーションコード(ROP)。背景ラスタオペレーションコードはこの値の上位ワードの上位バイトに格納され、前景ラスタオペレーションコードはこの値の上位ワードの下位バイトに格納されます。この値の下位ワードは無視され、ゼロにする必要があります。このような前景および背景ラスタオペレーションコードの組み合わせは、MAKEROP4 マクロで作成できます。 この関数における前景と背景の説明については、後述の「解説」セクションを参照してください。 一般的なラスタオペレーションコード(ROP)の一覧については、BitBlt 関数を参照してください。なお、CAPTUREBLT ROP は通常、プリンターデバイスコンテキストには使用できません。 |
戻り値の型: BOOL
公式ドキュメント
MaskBlt 関数は、指定したマスクとラスタオペレーションを使用して、ソースビットマップとデスティネーションビットマップの色データを合成します。
戻り値
関数が成功すると、戻り値は非ゼロになります。
関数が失敗すると、戻り値はゼロになります。
解説(Remarks)
MaskBlt 関数はデバイス依存ビットマップを使用します。
hbmMask で指定したマスク内の値 1 は、その位置で dwRop によって指定された前景ラスタオペレーションコードを適用することを示します。マスク内の値 0 は、その位置で dwRop によって指定された背景ラスタオペレーションコードを適用することを示します。
ラスタオペレーションがソースを必要とする場合、マスク矩形はソース矩形を覆っている必要があります。覆っていない場合、関数は失敗します。ラスタオペレーションがソースを必要としない場合、マスク矩形はデスティネーション矩形を覆っている必要があります。覆っていない場合、関数は失敗します。
この関数を呼び出したときにソースデバイスコンテキストに回転またはせん断の変換が有効になっていると、エラーが発生します。ただし、その他の種類の変換は許可されます。
ソース、パターン、デスティネーションの各ビットマップの色フォーマットが異なる場合、この関数はパターンまたはソースのフォーマット、あるいはその両方を、デスティネーションのフォーマットに合わせて変換します。
マスクビットマップがモノクロビットマップでない場合、エラーが発生します。
拡張メタファイルの記録中に、ソースデバイスコンテキストが拡張メタファイルデバイスコンテキストを指定している場合、エラーが発生します(関数は FALSE を返します)。
すべてのデバイスが MaskBlt 関数をサポートしているわけではありません。デバイスがこの関数をサポートしているかどうかを判断するには、アプリケーションは nIndex パラメーターに RC_BITBLT を指定して GetDeviceCaps 関数を呼び出す必要があります。
マスクビットマップが指定されていない場合、この関数は前景ラスタオペレーションコードを使用して、BitBlt とまったく同じように動作します。
ICM: ブリット時にはカラーマネジメントは実行されません。
マルチモニターシステムで使用する場合、hdcSrc と hdcDest は同じデバイスを参照している必要があり、そうでない場合、関数は失敗します。異なるデバイスの DC 間でデータを転送するには、GetDIBits を呼び出して、メモリビットマップ(互換ビットマップ、すなわち DDB)を DIB に変換します。その DIB を 2 番目のデバイスに表示するには、SetDIBits または StretchDIBits を呼び出します。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
各言語での呼び出し定義
// GDI32.dll
#include <windows.h>
BOOL MaskBlt(
HDC hdcDest,
INT xDest,
INT yDest,
INT width,
INT height,
HDC hdcSrc,
INT xSrc,
INT ySrc,
HBITMAP hbmMask,
INT xMask,
INT yMask,
DWORD rop
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("GDI32.dll", ExactSpelling = true)]
static extern bool MaskBlt(
IntPtr hdcDest, // HDC
int xDest, // INT
int yDest, // INT
int width, // INT
int height, // INT
IntPtr hdcSrc, // HDC
int xSrc, // INT
int ySrc, // INT
IntPtr hbmMask, // HBITMAP
int xMask, // INT
int yMask, // INT
uint rop // DWORD
);<DllImport("GDI32.dll", ExactSpelling:=True)>
Public Shared Function MaskBlt(
hdcDest As IntPtr, ' HDC
xDest As Integer, ' INT
yDest As Integer, ' INT
width As Integer, ' INT
height As Integer, ' INT
hdcSrc As IntPtr, ' HDC
xSrc As Integer, ' INT
ySrc As Integer, ' INT
hbmMask As IntPtr, ' HBITMAP
xMask As Integer, ' INT
yMask As Integer, ' INT
rop As UInteger ' DWORD
) As <MarshalAs(UnmanagedType.Bool)> Boolean
End Function' hdcDest : HDC
' xDest : INT
' yDest : INT
' width : INT
' height : INT
' hdcSrc : HDC
' xSrc : INT
' ySrc : INT
' hbmMask : HBITMAP
' xMask : INT
' yMask : INT
' rop : DWORD
Declare PtrSafe Function MaskBlt Lib "gdi32" ( _
ByVal hdcDest As LongPtr, _
ByVal xDest As Long, _
ByVal yDest As Long, _
ByVal width As Long, _
ByVal height As Long, _
ByVal hdcSrc As LongPtr, _
ByVal xSrc As Long, _
ByVal ySrc As Long, _
ByVal hbmMask As LongPtr, _
ByVal xMask As Long, _
ByVal yMask 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
MaskBlt = ctypes.windll.gdi32.MaskBlt
MaskBlt.restype = wintypes.BOOL
MaskBlt.argtypes = [
wintypes.HANDLE, # hdcDest : HDC
ctypes.c_int, # xDest : INT
ctypes.c_int, # yDest : INT
ctypes.c_int, # width : INT
ctypes.c_int, # height : INT
wintypes.HANDLE, # hdcSrc : HDC
ctypes.c_int, # xSrc : INT
ctypes.c_int, # ySrc : INT
wintypes.HANDLE, # hbmMask : HBITMAP
ctypes.c_int, # xMask : INT
ctypes.c_int, # yMask : INT
wintypes.DWORD, # rop : DWORD
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('GDI32.dll')
MaskBlt = Fiddle::Function.new(
lib['MaskBlt'],
[
Fiddle::TYPE_VOIDP, # hdcDest : HDC
Fiddle::TYPE_INT, # xDest : INT
Fiddle::TYPE_INT, # yDest : INT
Fiddle::TYPE_INT, # width : INT
Fiddle::TYPE_INT, # height : INT
Fiddle::TYPE_VOIDP, # hdcSrc : HDC
Fiddle::TYPE_INT, # xSrc : INT
Fiddle::TYPE_INT, # ySrc : INT
Fiddle::TYPE_VOIDP, # hbmMask : HBITMAP
Fiddle::TYPE_INT, # xMask : INT
Fiddle::TYPE_INT, # yMask : INT
-Fiddle::TYPE_INT, # rop : DWORD
],
Fiddle::TYPE_INT)#[link(name = "gdi32")]
extern "system" {
fn MaskBlt(
hdcDest: *mut core::ffi::c_void, // HDC
xDest: i32, // INT
yDest: i32, // INT
width: i32, // INT
height: i32, // INT
hdcSrc: *mut core::ffi::c_void, // HDC
xSrc: i32, // INT
ySrc: i32, // INT
hbmMask: *mut core::ffi::c_void, // HBITMAP
xMask: i32, // INT
yMask: i32, // INT
rop: u32 // DWORD
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("GDI32.dll")]
public static extern bool MaskBlt(IntPtr hdcDest, int xDest, int yDest, int width, int height, IntPtr hdcSrc, int xSrc, int ySrc, IntPtr hbmMask, int xMask, int yMask, uint rop);
"@
$api = Add-Type -MemberDefinition $sig -Name 'GDI32_MaskBlt' -Namespace Win32 -PassThru
# $api::MaskBlt(hdcDest, xDest, yDest, width, height, hdcSrc, xSrc, ySrc, hbmMask, xMask, yMask, rop)#uselib "GDI32.dll"
#func global MaskBlt "MaskBlt" sptr, sptr, sptr, sptr, sptr, sptr, sptr, sptr, sptr, sptr, sptr, sptr
; MaskBlt hdcDest, xDest, yDest, width, height, hdcSrc, xSrc, ySrc, hbmMask, xMask, yMask, rop ; 戻り値は stat
; hdcDest : HDC -> "sptr"
; xDest : INT -> "sptr"
; yDest : INT -> "sptr"
; width : INT -> "sptr"
; height : INT -> "sptr"
; hdcSrc : HDC -> "sptr"
; xSrc : INT -> "sptr"
; ySrc : INT -> "sptr"
; hbmMask : HBITMAP -> "sptr"
; xMask : INT -> "sptr"
; yMask : INT -> "sptr"
; rop : DWORD -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "GDI32.dll"
#cfunc global MaskBlt "MaskBlt" sptr, int, int, int, int, sptr, int, int, sptr, int, int, int
; res = MaskBlt(hdcDest, xDest, yDest, width, height, hdcSrc, xSrc, ySrc, hbmMask, xMask, yMask, rop)
; hdcDest : HDC -> "sptr"
; xDest : INT -> "int"
; yDest : INT -> "int"
; width : INT -> "int"
; height : INT -> "int"
; hdcSrc : HDC -> "sptr"
; xSrc : INT -> "int"
; ySrc : INT -> "int"
; hbmMask : HBITMAP -> "sptr"
; xMask : INT -> "int"
; yMask : INT -> "int"
; rop : DWORD -> "int"; BOOL MaskBlt(HDC hdcDest, INT xDest, INT yDest, INT width, INT height, HDC hdcSrc, INT xSrc, INT ySrc, HBITMAP hbmMask, INT xMask, INT yMask, DWORD rop)
#uselib "GDI32.dll"
#cfunc global MaskBlt "MaskBlt" intptr, int, int, int, int, intptr, int, int, intptr, int, int, int
; res = MaskBlt(hdcDest, xDest, yDest, width, height, hdcSrc, xSrc, ySrc, hbmMask, xMask, yMask, rop)
; hdcDest : HDC -> "intptr"
; xDest : INT -> "int"
; yDest : INT -> "int"
; width : INT -> "int"
; height : INT -> "int"
; hdcSrc : HDC -> "intptr"
; xSrc : INT -> "int"
; ySrc : INT -> "int"
; hbmMask : HBITMAP -> "intptr"
; xMask : INT -> "int"
; yMask : INT -> "int"
; rop : DWORD -> "int"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
gdi32 = windows.NewLazySystemDLL("GDI32.dll")
procMaskBlt = gdi32.NewProc("MaskBlt")
)
// hdcDest (HDC), xDest (INT), yDest (INT), width (INT), height (INT), hdcSrc (HDC), xSrc (INT), ySrc (INT), hbmMask (HBITMAP), xMask (INT), yMask (INT), rop (DWORD)
r1, _, err := procMaskBlt.Call(
uintptr(hdcDest),
uintptr(xDest),
uintptr(yDest),
uintptr(width),
uintptr(height),
uintptr(hdcSrc),
uintptr(xSrc),
uintptr(ySrc),
uintptr(hbmMask),
uintptr(xMask),
uintptr(yMask),
uintptr(rop),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction MaskBlt(
hdcDest: THandle; // HDC
xDest: Integer; // INT
yDest: Integer; // INT
width: Integer; // INT
height: Integer; // INT
hdcSrc: THandle; // HDC
xSrc: Integer; // INT
ySrc: Integer; // INT
hbmMask: THandle; // HBITMAP
xMask: Integer; // INT
yMask: Integer; // INT
rop: DWORD // DWORD
): BOOL; stdcall;
external 'GDI32.dll' name 'MaskBlt';result := DllCall("GDI32\MaskBlt"
, "Ptr", hdcDest ; HDC
, "Int", xDest ; INT
, "Int", yDest ; INT
, "Int", width ; INT
, "Int", height ; INT
, "Ptr", hdcSrc ; HDC
, "Int", xSrc ; INT
, "Int", ySrc ; INT
, "Ptr", hbmMask ; HBITMAP
, "Int", xMask ; INT
, "Int", yMask ; INT
, "UInt", rop ; DWORD
, "Int") ; return: BOOL●MaskBlt(hdcDest, xDest, yDest, width, height, hdcSrc, xSrc, ySrc, hbmMask, xMask, yMask, rop) = DLL("GDI32.dll", "bool MaskBlt(void*, int, int, int, int, void*, int, int, void*, int, int, dword)")
# 呼び出し: MaskBlt(hdcDest, xDest, yDest, width, height, hdcSrc, xSrc, ySrc, hbmMask, xMask, yMask, rop)
# hdcDest : HDC -> "void*"
# xDest : INT -> "int"
# yDest : INT -> "int"
# width : INT -> "int"
# height : INT -> "int"
# hdcSrc : HDC -> "void*"
# xSrc : INT -> "int"
# ySrc : INT -> "int"
# hbmMask : HBITMAP -> "void*"
# xMask : INT -> "int"
# yMask : INT -> "int"
# rop : DWORD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "gdi32" fn MaskBlt(
hdcDest: ?*anyopaque, // HDC
xDest: i32, // INT
yDest: i32, // INT
width: i32, // INT
height: i32, // INT
hdcSrc: ?*anyopaque, // HDC
xSrc: i32, // INT
ySrc: i32, // INT
hbmMask: ?*anyopaque, // HBITMAP
xMask: i32, // INT
yMask: i32, // INT
rop: u32 // DWORD
) callconv(std.os.windows.WINAPI) i32;proc MaskBlt(
hdcDest: pointer, # HDC
xDest: int32, # INT
yDest: int32, # INT
width: int32, # INT
height: int32, # INT
hdcSrc: pointer, # HDC
xSrc: int32, # INT
ySrc: int32, # INT
hbmMask: pointer, # HBITMAP
xMask: int32, # INT
yMask: int32, # INT
rop: uint32 # DWORD
): int32 {.importc: "MaskBlt", stdcall, dynlib: "GDI32.dll".}pragma(lib, "gdi32");
extern(Windows)
int MaskBlt(
void* hdcDest, // HDC
int xDest, // INT
int yDest, // INT
int width, // INT
int height, // INT
void* hdcSrc, // HDC
int xSrc, // INT
int ySrc, // INT
void* hbmMask, // HBITMAP
int xMask, // INT
int yMask, // INT
uint rop // DWORD
);ccall((:MaskBlt, "GDI32.dll"), stdcall, Int32,
(Ptr{Cvoid}, Int32, Int32, Int32, Int32, Ptr{Cvoid}, Int32, Int32, Ptr{Cvoid}, Int32, Int32, UInt32),
hdcDest, xDest, yDest, width, height, hdcSrc, xSrc, ySrc, hbmMask, xMask, yMask, rop)
# hdcDest : HDC -> Ptr{Cvoid}
# xDest : INT -> Int32
# yDest : INT -> Int32
# width : INT -> Int32
# height : INT -> Int32
# hdcSrc : HDC -> Ptr{Cvoid}
# xSrc : INT -> Int32
# ySrc : INT -> Int32
# hbmMask : HBITMAP -> Ptr{Cvoid}
# xMask : INT -> Int32
# yMask : INT -> Int32
# rop : DWORD -> UInt32
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t MaskBlt(
void* hdcDest,
int32_t xDest,
int32_t yDest,
int32_t width,
int32_t height,
void* hdcSrc,
int32_t xSrc,
int32_t ySrc,
void* hbmMask,
int32_t xMask,
int32_t yMask,
uint32_t rop);
]]
local gdi32 = ffi.load("gdi32")
-- gdi32.MaskBlt(hdcDest, xDest, yDest, width, height, hdcSrc, xSrc, ySrc, hbmMask, xMask, yMask, rop)
-- hdcDest : HDC
-- xDest : INT
-- yDest : INT
-- width : INT
-- height : INT
-- hdcSrc : HDC
-- xSrc : INT
-- ySrc : INT
-- hbmMask : HBITMAP
-- xMask : INT
-- yMask : INT
-- rop : DWORD
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('GDI32.dll');
const MaskBlt = lib.func('__stdcall', 'MaskBlt', 'int32_t', ['void *', 'int32_t', 'int32_t', 'int32_t', 'int32_t', 'void *', 'int32_t', 'int32_t', 'void *', 'int32_t', 'int32_t', 'uint32_t']);
// MaskBlt(hdcDest, xDest, yDest, width, height, hdcSrc, xSrc, ySrc, hbmMask, xMask, yMask, rop)
// hdcDest : HDC -> 'void *'
// xDest : INT -> 'int32_t'
// yDest : INT -> 'int32_t'
// width : INT -> 'int32_t'
// height : INT -> 'int32_t'
// hdcSrc : HDC -> 'void *'
// xSrc : INT -> 'int32_t'
// ySrc : INT -> 'int32_t'
// hbmMask : HBITMAP -> 'void *'
// xMask : INT -> 'int32_t'
// yMask : INT -> 'int32_t'
// rop : DWORD -> 'uint32_t'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("GDI32.dll", {
MaskBlt: { parameters: ["pointer", "i32", "i32", "i32", "i32", "pointer", "i32", "i32", "pointer", "i32", "i32", "u32"], result: "i32" },
});
// lib.symbols.MaskBlt(hdcDest, xDest, yDest, width, height, hdcSrc, xSrc, ySrc, hbmMask, xMask, yMask, rop)
// hdcDest : HDC -> "pointer"
// xDest : INT -> "i32"
// yDest : INT -> "i32"
// width : INT -> "i32"
// height : INT -> "i32"
// hdcSrc : HDC -> "pointer"
// xSrc : INT -> "i32"
// ySrc : INT -> "i32"
// hbmMask : HBITMAP -> "pointer"
// xMask : INT -> "i32"
// yMask : INT -> "i32"
// rop : DWORD -> "u32"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t MaskBlt(
void* hdcDest,
int32_t xDest,
int32_t yDest,
int32_t width,
int32_t height,
void* hdcSrc,
int32_t xSrc,
int32_t ySrc,
void* hbmMask,
int32_t xMask,
int32_t yMask,
uint32_t rop);
C, "GDI32.dll");
// $ffi->MaskBlt(hdcDest, xDest, yDest, width, height, hdcSrc, xSrc, ySrc, hbmMask, xMask, yMask, rop);
// hdcDest : HDC
// xDest : INT
// yDest : INT
// width : INT
// height : INT
// hdcSrc : HDC
// xSrc : INT
// ySrc : INT
// hbmMask : HBITMAP
// xMask : INT
// yMask : INT
// rop : DWORD
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;
public interface Gdi32 extends StdCallLibrary {
Gdi32 INSTANCE = Native.load("gdi32", Gdi32.class);
boolean MaskBlt(
Pointer hdcDest, // HDC
int xDest, // INT
int yDest, // INT
int width, // INT
int height, // INT
Pointer hdcSrc, // HDC
int xSrc, // INT
int ySrc, // INT
Pointer hbmMask, // HBITMAP
int xMask, // INT
int yMask, // INT
int rop // DWORD
);
}@[Link("gdi32")]
lib LibGDI32
fun MaskBlt = MaskBlt(
hdcDest : Void*, # HDC
xDest : Int32, # INT
yDest : Int32, # INT
width : Int32, # INT
height : Int32, # INT
hdcSrc : Void*, # HDC
xSrc : Int32, # INT
ySrc : Int32, # INT
hbmMask : Void*, # HBITMAP
xMask : Int32, # INT
yMask : Int32, # INT
rop : UInt32 # DWORD
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef MaskBltNative = Int32 Function(Pointer<Void>, Int32, Int32, Int32, Int32, Pointer<Void>, Int32, Int32, Pointer<Void>, Int32, Int32, Uint32);
typedef MaskBltDart = int Function(Pointer<Void>, int, int, int, int, Pointer<Void>, int, int, Pointer<Void>, int, int, int);
final MaskBlt = DynamicLibrary.open('GDI32.dll')
.lookupFunction<MaskBltNative, MaskBltDart>('MaskBlt');
// hdcDest : HDC -> Pointer<Void>
// xDest : INT -> Int32
// yDest : INT -> Int32
// width : INT -> Int32
// height : INT -> Int32
// hdcSrc : HDC -> Pointer<Void>
// xSrc : INT -> Int32
// ySrc : INT -> Int32
// hbmMask : HBITMAP -> Pointer<Void>
// xMask : INT -> Int32
// yMask : INT -> Int32
// rop : DWORD -> Uint32
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function MaskBlt(
hdcDest: THandle; // HDC
xDest: Integer; // INT
yDest: Integer; // INT
width: Integer; // INT
height: Integer; // INT
hdcSrc: THandle; // HDC
xSrc: Integer; // INT
ySrc: Integer; // INT
hbmMask: THandle; // HBITMAP
xMask: Integer; // INT
yMask: Integer; // INT
rop: DWORD // DWORD
): BOOL; stdcall;
external 'GDI32.dll' name 'MaskBlt';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "MaskBlt"
c_MaskBlt :: Ptr () -> Int32 -> Int32 -> Int32 -> Int32 -> Ptr () -> Int32 -> Int32 -> Ptr () -> Int32 -> Int32 -> Word32 -> IO CInt
-- hdcDest : HDC -> Ptr ()
-- xDest : INT -> Int32
-- yDest : INT -> Int32
-- width : INT -> Int32
-- height : INT -> Int32
-- hdcSrc : HDC -> Ptr ()
-- xSrc : INT -> Int32
-- ySrc : INT -> Int32
-- hbmMask : HBITMAP -> Ptr ()
-- xMask : INT -> Int32
-- yMask : INT -> Int32
-- rop : DWORD -> Word32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let maskblt =
foreign "MaskBlt"
((ptr void) @-> int32_t @-> int32_t @-> int32_t @-> int32_t @-> (ptr void) @-> int32_t @-> int32_t @-> (ptr void) @-> int32_t @-> int32_t @-> uint32_t @-> returning int32_t)
(* hdcDest : HDC -> (ptr void) *)
(* xDest : INT -> int32_t *)
(* yDest : INT -> int32_t *)
(* width : INT -> int32_t *)
(* height : INT -> int32_t *)
(* hdcSrc : HDC -> (ptr void) *)
(* xSrc : INT -> int32_t *)
(* ySrc : INT -> int32_t *)
(* hbmMask : HBITMAP -> (ptr void) *)
(* xMask : INT -> int32_t *)
(* yMask : INT -> int32_t *)
(* rop : DWORD -> uint32_t *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library gdi32 (t "GDI32.dll"))
(cffi:use-foreign-library gdi32)
(cffi:defcfun ("MaskBlt" mask-blt :convention :stdcall) :int32
(hdc-dest :pointer) ; HDC
(x-dest :int32) ; INT
(y-dest :int32) ; INT
(width :int32) ; INT
(height :int32) ; INT
(hdc-src :pointer) ; HDC
(x-src :int32) ; INT
(y-src :int32) ; INT
(hbm-mask :pointer) ; HBITMAP
(x-mask :int32) ; INT
(y-mask :int32) ; INT
(rop :uint32)) ; DWORD
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $MaskBlt = Win32::API::More->new('GDI32',
'BOOL MaskBlt(HANDLE hdcDest, int xDest, int yDest, int width, int height, HANDLE hdcSrc, int xSrc, int ySrc, HANDLE hbmMask, int xMask, int yMask, DWORD rop)');
# my $ret = $MaskBlt->Call($hdcDest, $xDest, $yDest, $width, $height, $hdcSrc, $xSrc, $ySrc, $hbmMask, $xMask, $yMask, $rop);
# hdcDest : HDC -> HANDLE
# xDest : INT -> int
# yDest : INT -> int
# width : INT -> int
# height : INT -> int
# hdcSrc : HDC -> HANDLE
# xSrc : INT -> int
# ySrc : INT -> int
# hbmMask : HBITMAP -> HANDLE
# xMask : INT -> int
# yMask : INT -> int
# rop : DWORD -> DWORD
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。関連項目
- f BitBlt — デバイスコンテキスト間でビットマップのブロック転送を行う。
- f GetDIBits — ビットマップのビットをDIB形式で取得する。
- f GetDeviceCaps — デバイスの能力や属性情報を取得する。
- f PlgBlt — 平行四辺形領域へビットマップを転送する。
- f SetDIBits — DIBのビットでビットマップのピクセルを設定する。
- f StretchBlt — ソース矩形を伸縮しながら転送先矩形へビット転送する。
- f StretchDIBits — DIBのピクセルを伸縮して転送先矩形へ転送する。