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