ホーム › Graphics.GdiPlus › GdipAddPathLine
GdipAddPathLine
関数GDI+のパスに直線を追加する。
シグネチャ
// gdiplus.dll
#include <windows.h>
Status GdipAddPathLine(
GpPath* path,
FLOAT x1,
FLOAT y1,
FLOAT x2,
FLOAT y2
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| path | GpPath* | inout |
| x1 | FLOAT | in |
| y1 | FLOAT | in |
| x2 | FLOAT | in |
| y2 | FLOAT | in |
戻り値の型: Status
各言語での呼び出し定義
// gdiplus.dll
#include <windows.h>
Status GdipAddPathLine(
GpPath* path,
FLOAT x1,
FLOAT y1,
FLOAT x2,
FLOAT y2
);[DllImport("gdiplus.dll", ExactSpelling = true)]
static extern int GdipAddPathLine(
IntPtr path, // GpPath* in/out
float x1, // FLOAT
float y1, // FLOAT
float x2, // FLOAT
float y2 // FLOAT
);<DllImport("gdiplus.dll", ExactSpelling:=True)>
Public Shared Function GdipAddPathLine(
path As IntPtr, ' GpPath* in/out
x1 As Single, ' FLOAT
y1 As Single, ' FLOAT
x2 As Single, ' FLOAT
y2 As Single ' FLOAT
) As Integer
End Function' path : GpPath* in/out
' x1 : FLOAT
' y1 : FLOAT
' x2 : FLOAT
' y2 : FLOAT
Declare PtrSafe Function GdipAddPathLine Lib "gdiplus" ( _
ByVal path As LongPtr, _
ByVal x1 As Single, _
ByVal y1 As Single, _
ByVal x2 As Single, _
ByVal y2 As Single) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
GdipAddPathLine = ctypes.windll.gdiplus.GdipAddPathLine
GdipAddPathLine.restype = ctypes.c_int
GdipAddPathLine.argtypes = [
ctypes.c_void_p, # path : GpPath* in/out
ctypes.c_float, # x1 : FLOAT
ctypes.c_float, # y1 : FLOAT
ctypes.c_float, # x2 : FLOAT
ctypes.c_float, # y2 : FLOAT
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('gdiplus.dll')
GdipAddPathLine = Fiddle::Function.new(
lib['GdipAddPathLine'],
[
Fiddle::TYPE_VOIDP, # path : GpPath* in/out
Fiddle::TYPE_FLOAT, # x1 : FLOAT
Fiddle::TYPE_FLOAT, # y1 : FLOAT
Fiddle::TYPE_FLOAT, # x2 : FLOAT
Fiddle::TYPE_FLOAT, # y2 : FLOAT
],
Fiddle::TYPE_INT)#[link(name = "gdiplus")]
extern "system" {
fn GdipAddPathLine(
path: *mut GpPath, // GpPath* in/out
x1: f32, // FLOAT
y1: f32, // FLOAT
x2: f32, // FLOAT
y2: f32 // FLOAT
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("gdiplus.dll")]
public static extern int GdipAddPathLine(IntPtr path, float x1, float y1, float x2, float y2);
"@
$api = Add-Type -MemberDefinition $sig -Name 'gdiplus_GdipAddPathLine' -Namespace Win32 -PassThru
# $api::GdipAddPathLine(path, x1, y1, x2, y2)#uselib "gdiplus.dll"
#func global GdipAddPathLine "GdipAddPathLine" sptr, float, float, float, float
; GdipAddPathLine varptr(path), x1, y1, x2, y2 ; 戻り値は stat
; path : GpPath* in/out -> "sptr"
; x1 : FLOAT -> "float"
; y1 : FLOAT -> "float"
; x2 : FLOAT -> "float"
; y2 : FLOAT -> "float"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "gdiplus.dll" #cfunc global GdipAddPathLine "GdipAddPathLine" var, float, float, float, float ; res = GdipAddPathLine(path, x1, y1, x2, y2) ; path : GpPath* in/out -> "var" ; x1 : FLOAT -> "float" ; y1 : FLOAT -> "float" ; x2 : FLOAT -> "float" ; y2 : FLOAT -> "float" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "gdiplus.dll" #cfunc global GdipAddPathLine "GdipAddPathLine" sptr, float, float, float, float ; res = GdipAddPathLine(varptr(path), x1, y1, x2, y2) ; path : GpPath* in/out -> "sptr" ; x1 : FLOAT -> "float" ; y1 : FLOAT -> "float" ; x2 : FLOAT -> "float" ; y2 : FLOAT -> "float" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; Status GdipAddPathLine(GpPath* path, FLOAT x1, FLOAT y1, FLOAT x2, FLOAT y2) #uselib "gdiplus.dll" #cfunc global GdipAddPathLine "GdipAddPathLine" var, float, float, float, float ; res = GdipAddPathLine(path, x1, y1, x2, y2) ; path : GpPath* in/out -> "var" ; x1 : FLOAT -> "float" ; y1 : FLOAT -> "float" ; x2 : FLOAT -> "float" ; y2 : FLOAT -> "float" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; Status GdipAddPathLine(GpPath* path, FLOAT x1, FLOAT y1, FLOAT x2, FLOAT y2) #uselib "gdiplus.dll" #cfunc global GdipAddPathLine "GdipAddPathLine" intptr, float, float, float, float ; res = GdipAddPathLine(varptr(path), x1, y1, x2, y2) ; path : GpPath* in/out -> "intptr" ; x1 : FLOAT -> "float" ; y1 : FLOAT -> "float" ; x2 : FLOAT -> "float" ; y2 : FLOAT -> "float" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"math"
"golang.org/x/sys/windows"
"unsafe"
)
var (
gdiplus = windows.NewLazySystemDLL("gdiplus.dll")
procGdipAddPathLine = gdiplus.NewProc("GdipAddPathLine")
)
// path (GpPath* in/out), x1 (FLOAT), y1 (FLOAT), x2 (FLOAT), y2 (FLOAT)
r1, _, err := procGdipAddPathLine.Call(
uintptr(path),
uintptr(math.Float32bits(x1)),
uintptr(math.Float32bits(y1)),
uintptr(math.Float32bits(x2)),
uintptr(math.Float32bits(y2)),
)
_ = 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 GdipAddPathLine(
path: Pointer; // GpPath* in/out
x1: Single; // FLOAT
y1: Single; // FLOAT
x2: Single; // FLOAT
y2: Single // FLOAT
): Integer; stdcall;
external 'gdiplus.dll' name 'GdipAddPathLine';result := DllCall("gdiplus\GdipAddPathLine"
, "Ptr", path ; GpPath* in/out
, "Float", x1 ; FLOAT
, "Float", y1 ; FLOAT
, "Float", x2 ; FLOAT
, "Float", y2 ; FLOAT
, "Int") ; return: Status●GdipAddPathLine(path, x1, y1, x2, y2) = DLL("gdiplus.dll", "int GdipAddPathLine(void*, float, float, float, float)")
# 呼び出し: GdipAddPathLine(path, x1, y1, x2, y2)
# path : GpPath* in/out -> "void*"
# x1 : FLOAT -> "float"
# y1 : FLOAT -> "float"
# x2 : FLOAT -> "float"
# y2 : FLOAT -> "float"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。