ホーム › Graphics.Gdi › PALETTEENTRY
PALETTEENTRY
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| peRed | BYTE | 1 | +0 | +0 | パレットエントリの赤成分の強度(0〜255)。 |
| peGreen | BYTE | 1 | +1 | +1 | パレットエントリの緑成分の強度(0〜255)。 |
| peBlue | BYTE | 1 | +2 | +2 | パレットエントリの青成分の強度(0〜255)。 |
| peFlags | BYTE | 1 | +3 | +3 | エントリの扱いを示すフラグ(PC_RESERVED等)。 |
各言語での定義
#include <windows.h>
// PALETTEENTRY (x64 4 / x86 4 バイト)
typedef struct PALETTEENTRY {
BYTE peRed;
BYTE peGreen;
BYTE peBlue;
BYTE peFlags;
} PALETTEENTRY;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct PALETTEENTRY
{
public byte peRed;
public byte peGreen;
public byte peBlue;
public byte peFlags;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure PALETTEENTRY
Public peRed As Byte
Public peGreen As Byte
Public peBlue As Byte
Public peFlags As Byte
End Structureimport ctypes
from ctypes import wintypes
class PALETTEENTRY(ctypes.Structure):
_fields_ = [
("peRed", ctypes.c_ubyte),
("peGreen", ctypes.c_ubyte),
("peBlue", ctypes.c_ubyte),
("peFlags", ctypes.c_ubyte),
]#[repr(C)]
pub struct PALETTEENTRY {
pub peRed: u8,
pub peGreen: u8,
pub peBlue: u8,
pub peFlags: u8,
}import "golang.org/x/sys/windows"
type PALETTEENTRY struct {
peRed byte
peGreen byte
peBlue byte
peFlags byte
}type
PALETTEENTRY = record
peRed: Byte;
peGreen: Byte;
peBlue: Byte;
peFlags: Byte;
end;const PALETTEENTRY = extern struct {
peRed: u8,
peGreen: u8,
peBlue: u8,
peFlags: u8,
};type
PALETTEENTRY {.bycopy.} = object
peRed: uint8
peGreen: uint8
peBlue: uint8
peFlags: uint8struct PALETTEENTRY
{
ubyte peRed;
ubyte peGreen;
ubyte peBlue;
ubyte peFlags;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; PALETTEENTRY サイズ: 4 バイト(x64)
dim st, 1 ; 4byte整数×1(構造体サイズ 4 / 4 切り上げ)
; peRed : BYTE (+0, 1byte) poke st,0,値 / 値 = peek(st,0)
; peGreen : BYTE (+1, 1byte) poke st,1,値 / 値 = peek(st,1)
; peBlue : BYTE (+2, 1byte) poke st,2,値 / 値 = peek(st,2)
; peFlags : BYTE (+3, 1byte) poke st,3,値 / 値 = peek(st,3)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global PALETTEENTRY
#field byte peRed
#field byte peGreen
#field byte peBlue
#field byte peFlags
#endstruct
stdim st, PALETTEENTRY ; NSTRUCT 変数を確保
st->peRed = 100
mes "peRed=" + st->peRed