ホーム › Graphics.OpenGL › glRectsv
glRectsv
関数短整数座標配列で塗りつぶし矩形を描画する。
シグネチャ
// OPENGL32.dll
#include <windows.h>
void glRectsv(
const SHORT* v1,
const SHORT* v2
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| v1 | SHORT* | in | 矩形の一方の頂点のx,y座標を保持する短整数配列へのポインタ。 |
| v2 | SHORT* | in | 対角の頂点のx,y座標を保持する短整数配列へのポインタ。 |
戻り値の型: void
各言語での呼び出し定義
// OPENGL32.dll
#include <windows.h>
void glRectsv(
const SHORT* v1,
const SHORT* v2
);[DllImport("OPENGL32.dll", ExactSpelling = true)]
static extern void glRectsv(
ref short v1, // SHORT*
ref short v2 // SHORT*
);<DllImport("OPENGL32.dll", ExactSpelling:=True)>
Public Shared Sub glRectsv(
ByRef v1 As Short, ' SHORT*
ByRef v2 As Short ' SHORT*
)
End Sub' v1 : SHORT*
' v2 : SHORT*
Declare PtrSafe Sub glRectsv Lib "opengl32" ( _
ByRef v1 As Integer, _
ByRef v2 As Integer)
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
glRectsv = ctypes.windll.opengl32.glRectsv
glRectsv.restype = None
glRectsv.argtypes = [
ctypes.POINTER(ctypes.c_short), # v1 : SHORT*
ctypes.POINTER(ctypes.c_short), # v2 : SHORT*
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('OPENGL32.dll')
glRectsv = Fiddle::Function.new(
lib['glRectsv'],
[
Fiddle::TYPE_VOIDP, # v1 : SHORT*
Fiddle::TYPE_VOIDP, # v2 : SHORT*
],
Fiddle::TYPE_VOID)#[link(name = "opengl32")]
extern "system" {
fn glRectsv(
v1: *const i16, // SHORT*
v2: *const i16 // SHORT*
);
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("OPENGL32.dll")]
public static extern void glRectsv(ref short v1, ref short v2);
"@
$api = Add-Type -MemberDefinition $sig -Name 'OPENGL32_glRectsv' -Namespace Win32 -PassThru
# $api::glRectsv(v1, v2)#uselib "OPENGL32.dll"
#func global glRectsv "glRectsv" sptr, sptr
; glRectsv varptr(v1), varptr(v2)
; v1 : SHORT* -> "sptr"
; v2 : SHORT* -> "sptr"出力引数:
#uselib "OPENGL32.dll" #func global glRectsv "glRectsv" var, var ; glRectsv v1, v2 ; v1 : SHORT* -> "var" ; v2 : SHORT* -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "OPENGL32.dll" #func global glRectsv "glRectsv" sptr, sptr ; glRectsv varptr(v1), varptr(v2) ; v1 : SHORT* -> "sptr" ; v2 : SHORT* -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; void glRectsv(SHORT* v1, SHORT* v2) #uselib "OPENGL32.dll" #func global glRectsv "glRectsv" var, var ; glRectsv v1, v2 ; v1 : SHORT* -> "var" ; v2 : SHORT* -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; void glRectsv(SHORT* v1, SHORT* v2) #uselib "OPENGL32.dll" #func global glRectsv "glRectsv" intptr, intptr ; glRectsv varptr(v1), varptr(v2) ; v1 : SHORT* -> "intptr" ; v2 : SHORT* -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
opengl32 = windows.NewLazySystemDLL("OPENGL32.dll")
procglRectsv = opengl32.NewProc("glRectsv")
)
// v1 (SHORT*), v2 (SHORT*)
r1, _, err := procglRectsv.Call(
uintptr(v1),
uintptr(v2),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // voidprocedure glRectsv(
v1: Pointer; // SHORT*
v2: Pointer // SHORT*
); stdcall;
external 'OPENGL32.dll' name 'glRectsv';result := DllCall("OPENGL32\glRectsv"
, "Ptr", v1 ; SHORT*
, "Ptr", v2 ; SHORT*
, "Int") ; return: void●glRectsv(v1, v2) = DLL("OPENGL32.dll", "int glRectsv(void*, void*)")
# 呼び出し: glRectsv(v1, v2)
# v1 : SHORT* -> "void*"
# v2 : SHORT* -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "opengl32" fn glRectsv(
v1: [*c]i16, // SHORT*
v2: [*c]i16 // SHORT*
) callconv(std.os.windows.WINAPI) void;proc glRectsv(
v1: ptr int16, # SHORT*
v2: ptr int16 # SHORT*
) {.importc: "glRectsv", stdcall, dynlib: "OPENGL32.dll".}pragma(lib, "opengl32");
extern(Windows)
void glRectsv(
short* v1, // SHORT*
short* v2 // SHORT*
);ccall((:glRectsv, "OPENGL32.dll"), stdcall, Cvoid,
(Ptr{Int16}, Ptr{Int16}),
v1, v2)
# v1 : SHORT* -> Ptr{Int16}
# v2 : SHORT* -> Ptr{Int16}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
void glRectsv(
int16_t* v1,
int16_t* v2);
]]
local opengl32 = ffi.load("opengl32")
-- opengl32.glRectsv(v1, v2)
-- v1 : SHORT*
-- v2 : SHORT*
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('OPENGL32.dll');
const glRectsv = lib.func('__stdcall', 'glRectsv', 'void', ['int16_t *', 'int16_t *']);
// glRectsv(v1, v2)
// v1 : SHORT* -> 'int16_t *'
// v2 : SHORT* -> 'int16_t *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("OPENGL32.dll", {
glRectsv: { parameters: ["pointer", "pointer"], result: "void" },
});
// lib.symbols.glRectsv(v1, v2)
// v1 : SHORT* -> "pointer"
// v2 : SHORT* -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
void glRectsv(
int16_t* v1,
int16_t* v2);
C, "OPENGL32.dll");
// $ffi->glRectsv(v1, v2);
// v1 : SHORT*
// v2 : SHORT*
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;
public interface Opengl32 extends StdCallLibrary {
Opengl32 INSTANCE = Native.load("opengl32", Opengl32.class);
void glRectsv(
ShortByReference v1, // SHORT*
ShortByReference v2 // SHORT*
);
}@[Link("opengl32")]
lib LibOPENGL32
fun glRectsv = glRectsv(
v1 : Int16*, # SHORT*
v2 : Int16* # SHORT*
) : Void
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef glRectsvNative = Void Function(Pointer<Int16>, Pointer<Int16>);
typedef glRectsvDart = void Function(Pointer<Int16>, Pointer<Int16>);
final glRectsv = DynamicLibrary.open('OPENGL32.dll')
.lookupFunction<glRectsvNative, glRectsvDart>('glRectsv');
// v1 : SHORT* -> Pointer<Int16>
// v2 : SHORT* -> Pointer<Int16>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
procedure glRectsv(
v1: Pointer; // SHORT*
v2: Pointer // SHORT*
); stdcall;
external 'OPENGL32.dll' name 'glRectsv';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "glRectsv"
c_glRectsv :: Ptr Int16 -> Ptr Int16 -> IO ()
-- v1 : SHORT* -> Ptr Int16
-- v2 : SHORT* -> Ptr Int16
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let glrectsv =
foreign "glRectsv"
((ptr int16_t) @-> (ptr int16_t) @-> returning void)
(* v1 : SHORT* -> (ptr int16_t) *)
(* v2 : SHORT* -> (ptr int16_t) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library opengl32 (t "OPENGL32.dll"))
(cffi:use-foreign-library opengl32)
(cffi:defcfun ("glRectsv" gl-rectsv :convention :stdcall) :void
(v1 :pointer) ; SHORT*
(v2 :pointer)) ; SHORT*
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $glRectsv = Win32::API::More->new('OPENGL32',
'void glRectsv(LPVOID v1, LPVOID v2)');
# my $ret = $glRectsv->Call($v1, $v2);
# v1 : SHORT* -> LPVOID
# v2 : SHORT* -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。