ホーム › Graphics.OpenGL › glCopyPixels
glCopyPixels
関数フレームバッファ内の矩形領域のピクセルを複写する。
シグネチャ
// OPENGL32.dll
#include <windows.h>
void glCopyPixels(
INT x,
INT y,
INT width,
INT height,
DWORD type
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| x | INT | in |
| y | INT | in |
| width | INT | in |
| height | INT | in |
| type | DWORD | in |
戻り値の型: void
各言語での呼び出し定義
// OPENGL32.dll
#include <windows.h>
void glCopyPixels(
INT x,
INT y,
INT width,
INT height,
DWORD type
);[DllImport("OPENGL32.dll", ExactSpelling = true)]
static extern void glCopyPixels(
int x, // INT
int y, // INT
int width, // INT
int height, // INT
uint type // DWORD
);<DllImport("OPENGL32.dll", ExactSpelling:=True)>
Public Shared Sub glCopyPixels(
x As Integer, ' INT
y As Integer, ' INT
width As Integer, ' INT
height As Integer, ' INT
type As UInteger ' DWORD
)
End Sub' x : INT
' y : INT
' width : INT
' height : INT
' type : DWORD
Declare PtrSafe Sub glCopyPixels Lib "opengl32" ( _
ByVal x As Long, _
ByVal y As Long, _
ByVal width As Long, _
ByVal height As Long, _
ByVal type As Long)
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
glCopyPixels = ctypes.windll.opengl32.glCopyPixels
glCopyPixels.restype = None
glCopyPixels.argtypes = [
ctypes.c_int, # x : INT
ctypes.c_int, # y : INT
ctypes.c_int, # width : INT
ctypes.c_int, # height : INT
wintypes.DWORD, # type : DWORD
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('OPENGL32.dll')
glCopyPixels = Fiddle::Function.new(
lib['glCopyPixels'],
[
Fiddle::TYPE_INT, # x : INT
Fiddle::TYPE_INT, # y : INT
Fiddle::TYPE_INT, # width : INT
Fiddle::TYPE_INT, # height : INT
-Fiddle::TYPE_INT, # type : DWORD
],
Fiddle::TYPE_VOID)#[link(name = "opengl32")]
extern "system" {
fn glCopyPixels(
x: i32, // INT
y: i32, // INT
width: i32, // INT
height: i32, // INT
type: u32 // DWORD
);
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("OPENGL32.dll")]
public static extern void glCopyPixels(int x, int y, int width, int height, uint type);
"@
$api = Add-Type -MemberDefinition $sig -Name 'OPENGL32_glCopyPixels' -Namespace Win32 -PassThru
# $api::glCopyPixels(x, y, width, height, type)#uselib "OPENGL32.dll"
#func global glCopyPixels "glCopyPixels" sptr, sptr, sptr, sptr, sptr
; glCopyPixels x, y, width, height, type
; x : INT -> "sptr"
; y : INT -> "sptr"
; width : INT -> "sptr"
; height : INT -> "sptr"
; type : DWORD -> "sptr"#uselib "OPENGL32.dll"
#func global glCopyPixels "glCopyPixels" int, int, int, int, int
; glCopyPixels x, y, width, height, type
; x : INT -> "int"
; y : INT -> "int"
; width : INT -> "int"
; height : INT -> "int"
; type : DWORD -> "int"; void glCopyPixels(INT x, INT y, INT width, INT height, DWORD type)
#uselib "OPENGL32.dll"
#func global glCopyPixels "glCopyPixels" int, int, int, int, int
; glCopyPixels x, y, width, height, type
; x : INT -> "int"
; y : INT -> "int"
; width : INT -> "int"
; height : INT -> "int"
; type : DWORD -> "int"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
opengl32 = windows.NewLazySystemDLL("OPENGL32.dll")
procglCopyPixels = opengl32.NewProc("glCopyPixels")
)
// x (INT), y (INT), width (INT), height (INT), type (DWORD)
r1, _, err := procglCopyPixels.Call(
uintptr(x),
uintptr(y),
uintptr(width),
uintptr(height),
uintptr(type),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // voidprocedure glCopyPixels(
x: Integer; // INT
y: Integer; // INT
width: Integer; // INT
height: Integer; // INT
type: DWORD // DWORD
); stdcall;
external 'OPENGL32.dll' name 'glCopyPixels';result := DllCall("OPENGL32\glCopyPixels"
, "Int", x ; INT
, "Int", y ; INT
, "Int", width ; INT
, "Int", height ; INT
, "UInt", type ; DWORD
, "Int") ; return: void●glCopyPixels(x, y, width, height, type) = DLL("OPENGL32.dll", "int glCopyPixels(int, int, int, int, dword)")
# 呼び出し: glCopyPixels(x, y, width, height, type)
# x : INT -> "int"
# y : INT -> "int"
# width : INT -> "int"
# height : INT -> "int"
# type : DWORD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。