Win32 API 日本語リファレンス
ホームDevices.Display › EngLineTo

EngLineTo

関数
サーフェス上に直線を描画する。
DLLGDI32.dll呼出規約winapi対応OSWindows 2000 以降

シグネチャ

// GDI32.dll
#include <windows.h>

BOOL EngLineTo(
    SURFOBJ* pso,
    CLIPOBJ* pco,
    BRUSHOBJ* pbo,
    INT x1,
    INT y1,
    INT x2,
    INT y2,
    RECTL* prclBounds,
    DWORD mix
);

パラメーター

名前方向
psoSURFOBJ*inout
pcoCLIPOBJ*inout
pboBRUSHOBJ*inout
x1INTin
y1INTin
x2INTin
y2INTin
prclBoundsRECTL*inout
mixDWORDin

戻り値の型: BOOL

各言語での呼び出し定義

// GDI32.dll
#include <windows.h>

BOOL EngLineTo(
    SURFOBJ* pso,
    CLIPOBJ* pco,
    BRUSHOBJ* pbo,
    INT x1,
    INT y1,
    INT x2,
    INT y2,
    RECTL* prclBounds,
    DWORD mix
);
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("GDI32.dll", ExactSpelling = true)]
static extern bool EngLineTo(
    IntPtr pso,   // SURFOBJ* in/out
    IntPtr pco,   // CLIPOBJ* in/out
    IntPtr pbo,   // BRUSHOBJ* in/out
    int x1,   // INT
    int y1,   // INT
    int x2,   // INT
    int y2,   // INT
    IntPtr prclBounds,   // RECTL* in/out
    uint mix   // DWORD
);
<DllImport("GDI32.dll", ExactSpelling:=True)>
Public Shared Function EngLineTo(
    pso As IntPtr,   ' SURFOBJ* in/out
    pco As IntPtr,   ' CLIPOBJ* in/out
    pbo As IntPtr,   ' BRUSHOBJ* in/out
    x1 As Integer,   ' INT
    y1 As Integer,   ' INT
    x2 As Integer,   ' INT
    y2 As Integer,   ' INT
    prclBounds As IntPtr,   ' RECTL* in/out
    mix As UInteger   ' DWORD
) As Boolean
End Function
' pso : SURFOBJ* in/out
' pco : CLIPOBJ* in/out
' pbo : BRUSHOBJ* in/out
' x1 : INT
' y1 : INT
' x2 : INT
' y2 : INT
' prclBounds : RECTL* in/out
' mix : DWORD
Declare PtrSafe Function EngLineTo Lib "gdi32" ( _
    ByVal pso As LongPtr, _
    ByVal pco As LongPtr, _
    ByVal pbo As LongPtr, _
    ByVal x1 As Long, _
    ByVal y1 As Long, _
    ByVal x2 As Long, _
    ByVal y2 As Long, _
    ByVal prclBounds As LongPtr, _
    ByVal mix As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

EngLineTo = ctypes.windll.gdi32.EngLineTo
EngLineTo.restype = wintypes.BOOL
EngLineTo.argtypes = [
    ctypes.c_void_p,  # pso : SURFOBJ* in/out
    ctypes.c_void_p,  # pco : CLIPOBJ* in/out
    ctypes.c_void_p,  # pbo : BRUSHOBJ* in/out
    ctypes.c_int,  # x1 : INT
    ctypes.c_int,  # y1 : INT
    ctypes.c_int,  # x2 : INT
    ctypes.c_int,  # y2 : INT
    ctypes.c_void_p,  # prclBounds : RECTL* in/out
    wintypes.DWORD,  # mix : DWORD
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('GDI32.dll')
EngLineTo = Fiddle::Function.new(
  lib['EngLineTo'],
  [
    Fiddle::TYPE_VOIDP,  # pso : SURFOBJ* in/out
    Fiddle::TYPE_VOIDP,  # pco : CLIPOBJ* in/out
    Fiddle::TYPE_VOIDP,  # pbo : BRUSHOBJ* in/out
    Fiddle::TYPE_INT,  # x1 : INT
    Fiddle::TYPE_INT,  # y1 : INT
    Fiddle::TYPE_INT,  # x2 : INT
    Fiddle::TYPE_INT,  # y2 : INT
    Fiddle::TYPE_VOIDP,  # prclBounds : RECTL* in/out
    -Fiddle::TYPE_INT,  # mix : DWORD
  ],
  Fiddle::TYPE_INT)
#[link(name = "gdi32")]
extern "system" {
    fn EngLineTo(
        pso: *mut SURFOBJ,  // SURFOBJ* in/out
        pco: *mut CLIPOBJ,  // CLIPOBJ* in/out
        pbo: *mut BRUSHOBJ,  // BRUSHOBJ* in/out
        x1: i32,  // INT
        y1: i32,  // INT
        x2: i32,  // INT
        y2: i32,  // INT
        prclBounds: *mut RECTL,  // RECTL* in/out
        mix: u32  // DWORD
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("GDI32.dll")]
public static extern bool EngLineTo(IntPtr pso, IntPtr pco, IntPtr pbo, int x1, int y1, int x2, int y2, IntPtr prclBounds, uint mix);
"@
$api = Add-Type -MemberDefinition $sig -Name 'GDI32_EngLineTo' -Namespace Win32 -PassThru
# $api::EngLineTo(pso, pco, pbo, x1, y1, x2, y2, prclBounds, mix)
#uselib "GDI32.dll"
#func global EngLineTo "EngLineTo" sptr, sptr, sptr, sptr, sptr, sptr, sptr, sptr, sptr
; EngLineTo varptr(pso), varptr(pco), varptr(pbo), x1, y1, x2, y2, varptr(prclBounds), mix   ; 戻り値は stat
; pso : SURFOBJ* in/out -> "sptr"
; pco : CLIPOBJ* in/out -> "sptr"
; pbo : BRUSHOBJ* in/out -> "sptr"
; x1 : INT -> "sptr"
; y1 : INT -> "sptr"
; x2 : INT -> "sptr"
; y2 : INT -> "sptr"
; prclBounds : RECTL* in/out -> "sptr"
; mix : DWORD -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "GDI32.dll"
#cfunc global EngLineTo "EngLineTo" var, var, var, int, int, int, int, var, int
; res = EngLineTo(pso, pco, pbo, x1, y1, x2, y2, prclBounds, mix)
; pso : SURFOBJ* in/out -> "var"
; pco : CLIPOBJ* in/out -> "var"
; pbo : BRUSHOBJ* in/out -> "var"
; x1 : INT -> "int"
; y1 : INT -> "int"
; x2 : INT -> "int"
; y2 : INT -> "int"
; prclBounds : RECTL* in/out -> "var"
; mix : DWORD -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; BOOL EngLineTo(SURFOBJ* pso, CLIPOBJ* pco, BRUSHOBJ* pbo, INT x1, INT y1, INT x2, INT y2, RECTL* prclBounds, DWORD mix)
#uselib "GDI32.dll"
#cfunc global EngLineTo "EngLineTo" var, var, var, int, int, int, int, var, int
; res = EngLineTo(pso, pco, pbo, x1, y1, x2, y2, prclBounds, mix)
; pso : SURFOBJ* in/out -> "var"
; pco : CLIPOBJ* in/out -> "var"
; pbo : BRUSHOBJ* in/out -> "var"
; x1 : INT -> "int"
; y1 : INT -> "int"
; x2 : INT -> "int"
; y2 : INT -> "int"
; prclBounds : RECTL* in/out -> "var"
; mix : DWORD -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	gdi32 = windows.NewLazySystemDLL("GDI32.dll")
	procEngLineTo = gdi32.NewProc("EngLineTo")
)

// pso (SURFOBJ* in/out), pco (CLIPOBJ* in/out), pbo (BRUSHOBJ* in/out), x1 (INT), y1 (INT), x2 (INT), y2 (INT), prclBounds (RECTL* in/out), mix (DWORD)
r1, _, err := procEngLineTo.Call(
	uintptr(pso),
	uintptr(pco),
	uintptr(pbo),
	uintptr(x1),
	uintptr(y1),
	uintptr(x2),
	uintptr(y2),
	uintptr(prclBounds),
	uintptr(mix),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // BOOL
function EngLineTo(
  pso: Pointer;   // SURFOBJ* in/out
  pco: Pointer;   // CLIPOBJ* in/out
  pbo: Pointer;   // BRUSHOBJ* in/out
  x1: Integer;   // INT
  y1: Integer;   // INT
  x2: Integer;   // INT
  y2: Integer;   // INT
  prclBounds: Pointer;   // RECTL* in/out
  mix: DWORD   // DWORD
): BOOL; stdcall;
  external 'GDI32.dll' name 'EngLineTo';
result := DllCall("GDI32\EngLineTo"
    , "Ptr", pso   ; SURFOBJ* in/out
    , "Ptr", pco   ; CLIPOBJ* in/out
    , "Ptr", pbo   ; BRUSHOBJ* in/out
    , "Int", x1   ; INT
    , "Int", y1   ; INT
    , "Int", x2   ; INT
    , "Int", y2   ; INT
    , "Ptr", prclBounds   ; RECTL* in/out
    , "UInt", mix   ; DWORD
    , "Int")   ; return: BOOL
●EngLineTo(pso, pco, pbo, x1, y1, x2, y2, prclBounds, mix) = DLL("GDI32.dll", "bool EngLineTo(void*, void*, void*, int, int, int, int, void*, dword)")
# 呼び出し: EngLineTo(pso, pco, pbo, x1, y1, x2, y2, prclBounds, mix)
# pso : SURFOBJ* in/out -> "void*"
# pco : CLIPOBJ* in/out -> "void*"
# pbo : BRUSHOBJ* in/out -> "void*"
# x1 : INT -> "int"
# y1 : INT -> "int"
# x2 : INT -> "int"
# y2 : INT -> "int"
# prclBounds : RECTL* in/out -> "void*"
# mix : DWORD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。