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

glBitmap

関数
現在のラスタ位置にビットマップを描画する。
DLLOPENGL32.dll呼出規約winapi

シグネチャ

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

void glBitmap(
    INT width,
    INT height,
    FLOAT xorig,
    FLOAT yorig,
    FLOAT xmove,
    FLOAT ymove,
    const BYTE* bitmap
);

パラメーター

名前方向
widthINTin
heightINTin
xorigFLOATin
yorigFLOATin
xmoveFLOATin
ymoveFLOATin
bitmapBYTE*in

戻り値の型: void

各言語での呼び出し定義

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

void glBitmap(
    INT width,
    INT height,
    FLOAT xorig,
    FLOAT yorig,
    FLOAT xmove,
    FLOAT ymove,
    const BYTE* bitmap
);
[DllImport("OPENGL32.dll", ExactSpelling = true)]
static extern void glBitmap(
    int width,   // INT
    int height,   // INT
    float xorig,   // FLOAT
    float yorig,   // FLOAT
    float xmove,   // FLOAT
    float ymove,   // FLOAT
    IntPtr bitmap   // BYTE*
);
<DllImport("OPENGL32.dll", ExactSpelling:=True)>
Public Shared Sub glBitmap(
    width As Integer,   ' INT
    height As Integer,   ' INT
    xorig As Single,   ' FLOAT
    yorig As Single,   ' FLOAT
    xmove As Single,   ' FLOAT
    ymove As Single,   ' FLOAT
    bitmap As IntPtr   ' BYTE*
)
End Sub
' width : INT
' height : INT
' xorig : FLOAT
' yorig : FLOAT
' xmove : FLOAT
' ymove : FLOAT
' bitmap : BYTE*
Declare PtrSafe Sub glBitmap Lib "opengl32" ( _
    ByVal width As Long, _
    ByVal height As Long, _
    ByVal xorig As Single, _
    ByVal yorig As Single, _
    ByVal xmove As Single, _
    ByVal ymove As Single, _
    ByVal bitmap As LongPtr)
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

glBitmap = ctypes.windll.opengl32.glBitmap
glBitmap.restype = None
glBitmap.argtypes = [
    ctypes.c_int,  # width : INT
    ctypes.c_int,  # height : INT
    ctypes.c_float,  # xorig : FLOAT
    ctypes.c_float,  # yorig : FLOAT
    ctypes.c_float,  # xmove : FLOAT
    ctypes.c_float,  # ymove : FLOAT
    ctypes.POINTER(ctypes.c_ubyte),  # bitmap : BYTE*
]
require 'fiddle'
require 'fiddle/import'

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

var (
	opengl32 = windows.NewLazySystemDLL("OPENGL32.dll")
	procglBitmap = opengl32.NewProc("glBitmap")
)

// width (INT), height (INT), xorig (FLOAT), yorig (FLOAT), xmove (FLOAT), ymove (FLOAT), bitmap (BYTE*)
r1, _, err := procglBitmap.Call(
	uintptr(width),
	uintptr(height),
	uintptr(math.Float32bits(xorig)),
	uintptr(math.Float32bits(yorig)),
	uintptr(math.Float32bits(xmove)),
	uintptr(math.Float32bits(ymove)),
	uintptr(bitmap),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // void
// 注意: float/double 引数は proc.Call では XMM レジスタに渡せません。
// windows.SyscallN(proc.Addr(), math.Float64bits(x), ...) もしくは cgo を使用してください。
procedure glBitmap(
  width: Integer;   // INT
  height: Integer;   // INT
  xorig: Single;   // FLOAT
  yorig: Single;   // FLOAT
  xmove: Single;   // FLOAT
  ymove: Single;   // FLOAT
  bitmap: Pointer   // BYTE*
); stdcall;
  external 'OPENGL32.dll' name 'glBitmap';
result := DllCall("OPENGL32\glBitmap"
    , "Int", width   ; INT
    , "Int", height   ; INT
    , "Float", xorig   ; FLOAT
    , "Float", yorig   ; FLOAT
    , "Float", xmove   ; FLOAT
    , "Float", ymove   ; FLOAT
    , "Ptr", bitmap   ; BYTE*
    , "Int")   ; return: void
●glBitmap(width, height, xorig, yorig, xmove, ymove, bitmap) = DLL("OPENGL32.dll", "int glBitmap(int, int, float, float, float, float, void*)")
# 呼び出し: glBitmap(width, height, xorig, yorig, xmove, ymove, bitmap)
# width : INT -> "int"
# height : INT -> "int"
# xorig : FLOAT -> "float"
# yorig : FLOAT -> "float"
# xmove : FLOAT -> "float"
# ymove : FLOAT -> "float"
# bitmap : BYTE* -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。