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