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