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