ホーム › Graphics.OpenGL › glRects
glRects
関数短整数座標で塗りつぶし矩形を描画する。
シグネチャ
// OPENGL32.dll
#include <windows.h>
void glRects(
SHORT x1,
SHORT y1,
SHORT x2,
SHORT y2
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| x1 | SHORT | in |
| y1 | SHORT | in |
| x2 | SHORT | in |
| y2 | SHORT | in |
戻り値の型: void
各言語での呼び出し定義
// OPENGL32.dll
#include <windows.h>
void glRects(
SHORT x1,
SHORT y1,
SHORT x2,
SHORT y2
);[DllImport("OPENGL32.dll", ExactSpelling = true)]
static extern void glRects(
short x1, // SHORT
short y1, // SHORT
short x2, // SHORT
short y2 // SHORT
);<DllImport("OPENGL32.dll", ExactSpelling:=True)>
Public Shared Sub glRects(
x1 As Short, ' SHORT
y1 As Short, ' SHORT
x2 As Short, ' SHORT
y2 As Short ' SHORT
)
End Sub' x1 : SHORT
' y1 : SHORT
' x2 : SHORT
' y2 : SHORT
Declare PtrSafe Sub glRects Lib "opengl32" ( _
ByVal x1 As Integer, _
ByVal y1 As Integer, _
ByVal x2 As Integer, _
ByVal y2 As Integer)
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
glRects = ctypes.windll.opengl32.glRects
glRects.restype = None
glRects.argtypes = [
ctypes.c_short, # x1 : SHORT
ctypes.c_short, # y1 : SHORT
ctypes.c_short, # x2 : SHORT
ctypes.c_short, # y2 : SHORT
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('OPENGL32.dll')
glRects = Fiddle::Function.new(
lib['glRects'],
[
Fiddle::TYPE_SHORT, # x1 : SHORT
Fiddle::TYPE_SHORT, # y1 : SHORT
Fiddle::TYPE_SHORT, # x2 : SHORT
Fiddle::TYPE_SHORT, # y2 : SHORT
],
Fiddle::TYPE_VOID)#[link(name = "opengl32")]
extern "system" {
fn glRects(
x1: i16, // SHORT
y1: i16, // SHORT
x2: i16, // SHORT
y2: i16 // SHORT
);
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("OPENGL32.dll")]
public static extern void glRects(short x1, short y1, short x2, short y2);
"@
$api = Add-Type -MemberDefinition $sig -Name 'OPENGL32_glRects' -Namespace Win32 -PassThru
# $api::glRects(x1, y1, x2, y2)#uselib "OPENGL32.dll"
#func global glRects "glRects" sptr, sptr, sptr, sptr
; glRects x1, y1, x2, y2
; x1 : SHORT -> "sptr"
; y1 : SHORT -> "sptr"
; x2 : SHORT -> "sptr"
; y2 : SHORT -> "sptr"#uselib "OPENGL32.dll"
#func global glRects "glRects" int, int, int, int
; glRects x1, y1, x2, y2
; x1 : SHORT -> "int"
; y1 : SHORT -> "int"
; x2 : SHORT -> "int"
; y2 : SHORT -> "int"; void glRects(SHORT x1, SHORT y1, SHORT x2, SHORT y2)
#uselib "OPENGL32.dll"
#func global glRects "glRects" int, int, int, int
; glRects x1, y1, x2, y2
; x1 : SHORT -> "int"
; y1 : SHORT -> "int"
; x2 : SHORT -> "int"
; y2 : SHORT -> "int"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
opengl32 = windows.NewLazySystemDLL("OPENGL32.dll")
procglRects = opengl32.NewProc("glRects")
)
// x1 (SHORT), y1 (SHORT), x2 (SHORT), y2 (SHORT)
r1, _, err := procglRects.Call(
uintptr(x1),
uintptr(y1),
uintptr(x2),
uintptr(y2),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // voidprocedure glRects(
x1: Smallint; // SHORT
y1: Smallint; // SHORT
x2: Smallint; // SHORT
y2: Smallint // SHORT
); stdcall;
external 'OPENGL32.dll' name 'glRects';result := DllCall("OPENGL32\glRects"
, "Short", x1 ; SHORT
, "Short", y1 ; SHORT
, "Short", x2 ; SHORT
, "Short", y2 ; SHORT
, "Int") ; return: void●glRects(x1, y1, x2, y2) = DLL("OPENGL32.dll", "int glRects(int, int, int, int)")
# 呼び出し: glRects(x1, y1, x2, y2)
# x1 : SHORT -> "int"
# y1 : SHORT -> "int"
# x2 : SHORT -> "int"
# y2 : SHORT -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。