Win32 API 日本語リファレンス
ホームGraphics.OpenGL › glRectiv

glRectiv

関数
整数座標配列で塗りつぶし矩形を描画する。
DLLOPENGL32.dll呼出規約winapi

シグネチャ

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

void glRectiv(
    const INT* v1,
    const INT* v2
);

パラメーター

名前方向説明
v1INT*in矩形の一方の頂点のx,y座標を保持する整数配列へのポインタ。
v2INT*in対角の頂点のx,y座標を保持する整数配列へのポインタ。

戻り値の型: void

各言語での呼び出し定義

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

void glRectiv(
    const INT* v1,
    const INT* v2
);
[DllImport("OPENGL32.dll", ExactSpelling = true)]
static extern void glRectiv(
    ref int v1,   // INT*
    ref int v2   // INT*
);
<DllImport("OPENGL32.dll", ExactSpelling:=True)>
Public Shared Sub glRectiv(
    ByRef v1 As Integer,   ' INT*
    ByRef v2 As Integer   ' INT*
)
End Sub
' v1 : INT*
' v2 : INT*
Declare PtrSafe Sub glRectiv Lib "opengl32" ( _
    ByRef v1 As Long, _
    ByRef v2 As Long)
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

glRectiv = ctypes.windll.opengl32.glRectiv
glRectiv.restype = None
glRectiv.argtypes = [
    ctypes.POINTER(ctypes.c_int),  # v1 : INT*
    ctypes.POINTER(ctypes.c_int),  # v2 : INT*
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('OPENGL32.dll')
glRectiv = Fiddle::Function.new(
  lib['glRectiv'],
  [
    Fiddle::TYPE_VOIDP,  # v1 : INT*
    Fiddle::TYPE_VOIDP,  # v2 : INT*
  ],
  Fiddle::TYPE_VOID)
#[link(name = "opengl32")]
extern "system" {
    fn glRectiv(
        v1: *const i32,  // INT*
        v2: *const i32  // INT*
    );
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("OPENGL32.dll")]
public static extern void glRectiv(ref int v1, ref int v2);
"@
$api = Add-Type -MemberDefinition $sig -Name 'OPENGL32_glRectiv' -Namespace Win32 -PassThru
# $api::glRectiv(v1, v2)
#uselib "OPENGL32.dll"
#func global glRectiv "glRectiv" sptr, sptr
; glRectiv varptr(v1), varptr(v2)
; v1 : INT* -> "sptr"
; v2 : INT* -> "sptr"
出力引数:
#uselib "OPENGL32.dll"
#func global glRectiv "glRectiv" var, var
; glRectiv v1, v2
; v1 : INT* -> "var"
; v2 : INT* -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; void glRectiv(INT* v1, INT* v2)
#uselib "OPENGL32.dll"
#func global glRectiv "glRectiv" var, var
; glRectiv v1, v2
; v1 : INT* -> "var"
; v2 : INT* -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	opengl32 = windows.NewLazySystemDLL("OPENGL32.dll")
	procglRectiv = opengl32.NewProc("glRectiv")
)

// v1 (INT*), v2 (INT*)
r1, _, err := procglRectiv.Call(
	uintptr(v1),
	uintptr(v2),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // void
procedure glRectiv(
  v1: Pointer;   // INT*
  v2: Pointer   // INT*
); stdcall;
  external 'OPENGL32.dll' name 'glRectiv';
result := DllCall("OPENGL32\glRectiv"
    , "Ptr", v1   ; INT*
    , "Ptr", v2   ; INT*
    , "Int")   ; return: void
●glRectiv(v1, v2) = DLL("OPENGL32.dll", "int glRectiv(void*, void*)")
# 呼び出し: glRectiv(v1, v2)
# v1 : INT* -> "void*"
# v2 : INT* -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
const std = @import("std");

extern "opengl32" fn glRectiv(
    v1: [*c]i32, // INT*
    v2: [*c]i32 // INT*
) callconv(std.os.windows.WINAPI) void;
proc glRectiv(
    v1: ptr int32,  # INT*
    v2: ptr int32  # INT*
) {.importc: "glRectiv", stdcall, dynlib: "OPENGL32.dll".}
pragma(lib, "opengl32");
extern(Windows)
void glRectiv(
    int* v1,   // INT*
    int* v2   // INT*
);
ccall((:glRectiv, "OPENGL32.dll"), stdcall, Cvoid,
      (Ptr{Int32}, Ptr{Int32}),
      v1, v2)
# v1 : INT* -> Ptr{Int32}
# v2 : INT* -> Ptr{Int32}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
void glRectiv(
    int32_t* v1,
    int32_t* v2);
]]
local opengl32 = ffi.load("opengl32")
-- opengl32.glRectiv(v1, v2)
-- v1 : INT*
-- v2 : INT*
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('OPENGL32.dll');
const glRectiv = lib.func('__stdcall', 'glRectiv', 'void', ['int32_t *', 'int32_t *']);
// glRectiv(v1, v2)
// v1 : INT* -> 'int32_t *'
// v2 : INT* -> 'int32_t *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("OPENGL32.dll", {
  glRectiv: { parameters: ["pointer", "pointer"], result: "void" },
});
// lib.symbols.glRectiv(v1, v2)
// v1 : INT* -> "pointer"
// v2 : INT* -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
void glRectiv(
    int32_t* v1,
    int32_t* v2);
C, "OPENGL32.dll");
// $ffi->glRectiv(v1, v2);
// v1 : INT*
// v2 : INT*
// 構造体/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 glRectiv(
        IntByReference v1,   // INT*
        IntByReference v2   // INT*
    );
}
@[Link("opengl32")]
lib LibOPENGL32
  fun glRectiv = glRectiv(
    v1 : Int32*,   # INT*
    v2 : Int32*   # INT*
  ) : Void
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef glRectivNative = Void Function(Pointer<Int32>, Pointer<Int32>);
typedef glRectivDart = void Function(Pointer<Int32>, Pointer<Int32>);
final glRectiv = DynamicLibrary.open('OPENGL32.dll')
    .lookupFunction<glRectivNative, glRectivDart>('glRectiv');
// v1 : INT* -> Pointer<Int32>
// v2 : INT* -> Pointer<Int32>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
procedure glRectiv(
  v1: Pointer;   // INT*
  v2: Pointer   // INT*
); stdcall;
  external 'OPENGL32.dll' name 'glRectiv';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "glRectiv"
  c_glRectiv :: Ptr Int32 -> Ptr Int32 -> IO ()
-- v1 : INT* -> Ptr Int32
-- v2 : INT* -> Ptr Int32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let glrectiv =
  foreign "glRectiv"
    ((ptr int32_t) @-> (ptr int32_t) @-> returning void)
(* v1 : INT* -> (ptr int32_t) *)
(* v2 : INT* -> (ptr int32_t) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library opengl32 (t "OPENGL32.dll"))
(cffi:use-foreign-library opengl32)

(cffi:defcfun ("glRectiv" gl-rectiv :convention :stdcall) :void
  (v1 :pointer)   ; INT*
  (v2 :pointer))   ; INT*
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $glRectiv = Win32::API::More->new('OPENGL32',
    'void glRectiv(LPVOID v1, LPVOID v2)');
# my $ret = $glRectiv->Call($v1, $v2);
# v1 : INT* -> LPVOID
# v2 : INT* -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。