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