ホーム › Devices.Display › VIDEO_CLUT
VIDEO_CLUT
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| NumEntries | WORD | 2 | +0 | +0 | 設定するカラールックアップテーブルのエントリ数。 |
| FirstEntry | WORD | 2 | +2 | +2 | 設定開始のCLUTインデックス。 |
| LookupTable | _Anonymous_e__Union | 4 | +4 | +4 | 色データを保持する無名共用体(VIDEO_CLUTDATA配列等)。 |
共用体: _Anonymous_e__Union x64 4B / x86 4B
| フィールド | 型 | サイズ | x64 | x86 |
|---|---|---|---|---|
| RgbArray | VIDEO_CLUTDATA | 4 | +0 | +0 |
| RgbLong | DWORD | 4 | +0 | +0 |
各言語での定義
#include <windows.h>
// VIDEO_CLUT (x64 8 / x86 8 バイト)
typedef struct VIDEO_CLUT {
WORD NumEntries;
WORD FirstEntry;
_Anonymous_e__Union LookupTable[1];
} VIDEO_CLUT;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct VIDEO_CLUT
{
public ushort NumEntries;
public ushort FirstEntry;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public _Anonymous_e__Union[] LookupTable;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure VIDEO_CLUT
Public NumEntries As UShort
Public FirstEntry As UShort
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=1)> Public LookupTable() As _Anonymous_e__Union
End Structureimport ctypes
from ctypes import wintypes
class VIDEO_CLUT(ctypes.Structure):
_fields_ = [
("NumEntries", ctypes.c_ushort),
("FirstEntry", ctypes.c_ushort),
("LookupTable", _Anonymous_e__Union * 1),
]#[repr(C)]
pub struct VIDEO_CLUT {
pub NumEntries: u16,
pub FirstEntry: u16,
pub LookupTable: [_Anonymous_e__Union; 1],
}import "golang.org/x/sys/windows"
type VIDEO_CLUT struct {
NumEntries uint16
FirstEntry uint16
LookupTable [1]_Anonymous_e__Union
}type
VIDEO_CLUT = record
NumEntries: Word;
FirstEntry: Word;
LookupTable: array[0..0] of _Anonymous_e__Union;
end;const VIDEO_CLUT = extern struct {
NumEntries: u16,
FirstEntry: u16,
LookupTable: [1]_Anonymous_e__Union,
};type
VIDEO_CLUT {.bycopy.} = object
NumEntries: uint16
FirstEntry: uint16
LookupTable: array[1, _Anonymous_e__Union]struct VIDEO_CLUT
{
ushort NumEntries;
ushort FirstEntry;
_Anonymous_e__Union[1] LookupTable;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; VIDEO_CLUT サイズ: 8 バイト(x64)
dim st, 2 ; 4byte整数×2(構造体サイズ 8 / 4 切り上げ)
; NumEntries : WORD (+0, 2byte) wpoke st,0,値 / 値 = wpeek(st,0)
; FirstEntry : WORD (+2, 2byte) wpoke st,2,値 / 値 = wpeek(st,2)
; LookupTable : _Anonymous_e__Union (+4, 4byte) varptr(st)+4 を基点に操作(4byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global VIDEO_CLUT
#field short NumEntries
#field short FirstEntry
#field byte LookupTable 4
#endstruct
stdim st, VIDEO_CLUT ; NSTRUCT 変数を確保
st->NumEntries = 100
mes "NumEntries=" + st->NumEntries
; ※union フィールドは byte 列で確保(NSTRUCT は union 非対応)。必要に応じ手動でアクセス。