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