ホーム › Graphics.GdiPlus › GdipIsVisibleRegionRect
GdipIsVisibleRegionRect
関数指定した矩形がリージョンと交差するかどうかを判定する。
シグネチャ
// gdiplus.dll
#include <windows.h>
Status GdipIsVisibleRegionRect(
GpRegion* region,
FLOAT x,
FLOAT y,
FLOAT width,
FLOAT height,
GpGraphics* graphics,
BOOL* result
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| region | GpRegion* | inout |
| x | FLOAT | in |
| y | FLOAT | in |
| width | FLOAT | in |
| height | FLOAT | in |
| graphics | GpGraphics* | inout |
| result | BOOL* | inout |
戻り値の型: Status
各言語での呼び出し定義
// gdiplus.dll
#include <windows.h>
Status GdipIsVisibleRegionRect(
GpRegion* region,
FLOAT x,
FLOAT y,
FLOAT width,
FLOAT height,
GpGraphics* graphics,
BOOL* result
);[DllImport("gdiplus.dll", ExactSpelling = true)]
static extern int GdipIsVisibleRegionRect(
IntPtr region, // GpRegion* in/out
float x, // FLOAT
float y, // FLOAT
float width, // FLOAT
float height, // FLOAT
IntPtr graphics, // GpGraphics* in/out
ref int result // BOOL* in/out
);<DllImport("gdiplus.dll", ExactSpelling:=True)>
Public Shared Function GdipIsVisibleRegionRect(
region As IntPtr, ' GpRegion* in/out
x As Single, ' FLOAT
y As Single, ' FLOAT
width As Single, ' FLOAT
height As Single, ' FLOAT
graphics As IntPtr, ' GpGraphics* in/out
ByRef result As Integer ' BOOL* in/out
) As Integer
End Function' region : GpRegion* in/out
' x : FLOAT
' y : FLOAT
' width : FLOAT
' height : FLOAT
' graphics : GpGraphics* in/out
' result : BOOL* in/out
Declare PtrSafe Function GdipIsVisibleRegionRect Lib "gdiplus" ( _
ByVal region As LongPtr, _
ByVal x As Single, _
ByVal y As Single, _
ByVal width As Single, _
ByVal height As Single, _
ByVal graphics As LongPtr, _
ByRef result As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
GdipIsVisibleRegionRect = ctypes.windll.gdiplus.GdipIsVisibleRegionRect
GdipIsVisibleRegionRect.restype = ctypes.c_int
GdipIsVisibleRegionRect.argtypes = [
ctypes.c_void_p, # region : GpRegion* in/out
ctypes.c_float, # x : FLOAT
ctypes.c_float, # y : FLOAT
ctypes.c_float, # width : FLOAT
ctypes.c_float, # height : FLOAT
ctypes.c_void_p, # graphics : GpGraphics* in/out
ctypes.c_void_p, # result : BOOL* in/out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('gdiplus.dll')
GdipIsVisibleRegionRect = Fiddle::Function.new(
lib['GdipIsVisibleRegionRect'],
[
Fiddle::TYPE_VOIDP, # region : GpRegion* in/out
Fiddle::TYPE_FLOAT, # x : FLOAT
Fiddle::TYPE_FLOAT, # y : FLOAT
Fiddle::TYPE_FLOAT, # width : FLOAT
Fiddle::TYPE_FLOAT, # height : FLOAT
Fiddle::TYPE_VOIDP, # graphics : GpGraphics* in/out
Fiddle::TYPE_VOIDP, # result : BOOL* in/out
],
Fiddle::TYPE_INT)#[link(name = "gdiplus")]
extern "system" {
fn GdipIsVisibleRegionRect(
region: *mut GpRegion, // GpRegion* in/out
x: f32, // FLOAT
y: f32, // FLOAT
width: f32, // FLOAT
height: f32, // FLOAT
graphics: *mut GpGraphics, // GpGraphics* in/out
result: *mut i32 // BOOL* in/out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("gdiplus.dll")]
public static extern int GdipIsVisibleRegionRect(IntPtr region, float x, float y, float width, float height, IntPtr graphics, ref int result);
"@
$api = Add-Type -MemberDefinition $sig -Name 'gdiplus_GdipIsVisibleRegionRect' -Namespace Win32 -PassThru
# $api::GdipIsVisibleRegionRect(region, x, y, width, height, graphics, result)#uselib "gdiplus.dll"
#func global GdipIsVisibleRegionRect "GdipIsVisibleRegionRect" sptr, float, float, float, float, sptr, sptr
; GdipIsVisibleRegionRect varptr(region), x, y, width, height, varptr(graphics), result ; 戻り値は stat
; region : GpRegion* in/out -> "sptr"
; x : FLOAT -> "float"
; y : FLOAT -> "float"
; width : FLOAT -> "float"
; height : FLOAT -> "float"
; graphics : GpGraphics* in/out -> "sptr"
; result : BOOL* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "gdiplus.dll" #cfunc global GdipIsVisibleRegionRect "GdipIsVisibleRegionRect" var, float, float, float, float, var, int ; res = GdipIsVisibleRegionRect(region, x, y, width, height, graphics, result) ; region : GpRegion* in/out -> "var" ; x : FLOAT -> "float" ; y : FLOAT -> "float" ; width : FLOAT -> "float" ; height : FLOAT -> "float" ; graphics : GpGraphics* in/out -> "var" ; result : BOOL* in/out -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "gdiplus.dll" #cfunc global GdipIsVisibleRegionRect "GdipIsVisibleRegionRect" sptr, float, float, float, float, sptr, int ; res = GdipIsVisibleRegionRect(varptr(region), x, y, width, height, varptr(graphics), result) ; region : GpRegion* in/out -> "sptr" ; x : FLOAT -> "float" ; y : FLOAT -> "float" ; width : FLOAT -> "float" ; height : FLOAT -> "float" ; graphics : GpGraphics* in/out -> "sptr" ; result : BOOL* in/out -> "int" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; Status GdipIsVisibleRegionRect(GpRegion* region, FLOAT x, FLOAT y, FLOAT width, FLOAT height, GpGraphics* graphics, BOOL* result) #uselib "gdiplus.dll" #cfunc global GdipIsVisibleRegionRect "GdipIsVisibleRegionRect" var, float, float, float, float, var, int ; res = GdipIsVisibleRegionRect(region, x, y, width, height, graphics, result) ; region : GpRegion* in/out -> "var" ; x : FLOAT -> "float" ; y : FLOAT -> "float" ; width : FLOAT -> "float" ; height : FLOAT -> "float" ; graphics : GpGraphics* in/out -> "var" ; result : BOOL* in/out -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; Status GdipIsVisibleRegionRect(GpRegion* region, FLOAT x, FLOAT y, FLOAT width, FLOAT height, GpGraphics* graphics, BOOL* result) #uselib "gdiplus.dll" #cfunc global GdipIsVisibleRegionRect "GdipIsVisibleRegionRect" intptr, float, float, float, float, intptr, int ; res = GdipIsVisibleRegionRect(varptr(region), x, y, width, height, varptr(graphics), result) ; region : GpRegion* in/out -> "intptr" ; x : FLOAT -> "float" ; y : FLOAT -> "float" ; width : FLOAT -> "float" ; height : FLOAT -> "float" ; graphics : GpGraphics* in/out -> "intptr" ; result : BOOL* in/out -> "int" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"math"
"golang.org/x/sys/windows"
"unsafe"
)
var (
gdiplus = windows.NewLazySystemDLL("gdiplus.dll")
procGdipIsVisibleRegionRect = gdiplus.NewProc("GdipIsVisibleRegionRect")
)
// region (GpRegion* in/out), x (FLOAT), y (FLOAT), width (FLOAT), height (FLOAT), graphics (GpGraphics* in/out), result (BOOL* in/out)
r1, _, err := procGdipIsVisibleRegionRect.Call(
uintptr(region),
uintptr(math.Float32bits(x)),
uintptr(math.Float32bits(y)),
uintptr(math.Float32bits(width)),
uintptr(math.Float32bits(height)),
uintptr(graphics),
uintptr(result),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // Status
// 注意: float/double 引数は proc.Call では XMM レジスタに渡せません。
// windows.SyscallN(proc.Addr(), math.Float64bits(x), ...) もしくは cgo を使用してください。function GdipIsVisibleRegionRect(
region: Pointer; // GpRegion* in/out
x: Single; // FLOAT
y: Single; // FLOAT
width: Single; // FLOAT
height: Single; // FLOAT
graphics: Pointer; // GpGraphics* in/out
result: Pointer // BOOL* in/out
): Integer; stdcall;
external 'gdiplus.dll' name 'GdipIsVisibleRegionRect';result := DllCall("gdiplus\GdipIsVisibleRegionRect"
, "Ptr", region ; GpRegion* in/out
, "Float", x ; FLOAT
, "Float", y ; FLOAT
, "Float", width ; FLOAT
, "Float", height ; FLOAT
, "Ptr", graphics ; GpGraphics* in/out
, "Ptr", result ; BOOL* in/out
, "Int") ; return: Status●GdipIsVisibleRegionRect(region, x, y, width, height, graphics, result) = DLL("gdiplus.dll", "int GdipIsVisibleRegionRect(void*, float, float, float, float, void*, void*)")
# 呼び出し: GdipIsVisibleRegionRect(region, x, y, width, height, graphics, result)
# region : GpRegion* in/out -> "void*"
# x : FLOAT -> "float"
# y : FLOAT -> "float"
# width : FLOAT -> "float"
# height : FLOAT -> "float"
# graphics : GpGraphics* in/out -> "void*"
# result : BOOL* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。