Win32 API 日本語リファレンス
ホームMedia.KernelStreaming › KS_TRUECOLORINFO

KS_TRUECOLORINFO

構造体
サイズx64: 1036 バイト / x86: 1036 バイト

サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。

フィールド

フィールドサイズx64x86説明
dwBitMasksDWORD12+0+0各色成分のビットマスクを表す配列である。
bmiColorsKS_RGBQUAD1024+12+12カラーパレットを表すKS_RGBQUAD配列の先頭要素。

各言語での定義

#include <windows.h>

// KS_RGBQUAD  (x64 4 / x86 4 バイト)
typedef struct KS_RGBQUAD {
    BYTE rgbBlue;
    BYTE rgbGreen;
    BYTE rgbRed;
    BYTE rgbReserved;
} KS_RGBQUAD;

// KS_TRUECOLORINFO  (x64 1036 / x86 1036 バイト)
typedef struct KS_TRUECOLORINFO {
    DWORD dwBitMasks[3];
    KS_RGBQUAD bmiColors[256];
} KS_TRUECOLORINFO;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct KS_RGBQUAD
{
    public byte rgbBlue;
    public byte rgbGreen;
    public byte rgbRed;
    public byte rgbReserved;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct KS_TRUECOLORINFO
{
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public uint[] dwBitMasks;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 256)] public KS_RGBQUAD[] bmiColors;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure KS_RGBQUAD
    Public rgbBlue As Byte
    Public rgbGreen As Byte
    Public rgbRed As Byte
    Public rgbReserved As Byte
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure KS_TRUECOLORINFO
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=3)> Public dwBitMasks() As UInteger
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=256)> Public bmiColors() As KS_RGBQUAD
End Structure
import ctypes
from ctypes import wintypes

class KS_RGBQUAD(ctypes.Structure):
    _fields_ = [
        ("rgbBlue", ctypes.c_ubyte),
        ("rgbGreen", ctypes.c_ubyte),
        ("rgbRed", ctypes.c_ubyte),
        ("rgbReserved", ctypes.c_ubyte),
    ]

class KS_TRUECOLORINFO(ctypes.Structure):
    _fields_ = [
        ("dwBitMasks", wintypes.DWORD * 3),
        ("bmiColors", KS_RGBQUAD * 256),
    ]
#[repr(C)]
pub struct KS_RGBQUAD {
    pub rgbBlue: u8,
    pub rgbGreen: u8,
    pub rgbRed: u8,
    pub rgbReserved: u8,
}

#[repr(C)]
pub struct KS_TRUECOLORINFO {
    pub dwBitMasks: [u32; 3],
    pub bmiColors: [KS_RGBQUAD; 256],
}
import "golang.org/x/sys/windows"

type KS_RGBQUAD struct {
	rgbBlue byte
	rgbGreen byte
	rgbRed byte
	rgbReserved byte
}

type KS_TRUECOLORINFO struct {
	dwBitMasks [3]uint32
	bmiColors [256]KS_RGBQUAD
}
type
  KS_RGBQUAD = record
    rgbBlue: Byte;
    rgbGreen: Byte;
    rgbRed: Byte;
    rgbReserved: Byte;
  end;

  KS_TRUECOLORINFO = record
    dwBitMasks: array[0..2] of DWORD;
    bmiColors: array[0..255] of KS_RGBQUAD;
  end;
const KS_RGBQUAD = extern struct {
    rgbBlue: u8,
    rgbGreen: u8,
    rgbRed: u8,
    rgbReserved: u8,
};

const KS_TRUECOLORINFO = extern struct {
    dwBitMasks: [3]u32,
    bmiColors: [256]KS_RGBQUAD,
};
type
  KS_RGBQUAD {.bycopy.} = object
    rgbBlue: uint8
    rgbGreen: uint8
    rgbRed: uint8
    rgbReserved: uint8

  KS_TRUECOLORINFO {.bycopy.} = object
    dwBitMasks: array[3, uint32]
    bmiColors: array[256, KS_RGBQUAD]
struct KS_RGBQUAD
{
    ubyte rgbBlue;
    ubyte rgbGreen;
    ubyte rgbRed;
    ubyte rgbReserved;
}

struct KS_TRUECOLORINFO
{
    uint[3] dwBitMasks;
    KS_RGBQUAD[256] bmiColors;
}

HSP用 定義

HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; KS_TRUECOLORINFO サイズ: 1036 バイト(x64)
dim st, 259    ; 4byte整数×259(構造体サイズ 1036 / 4 切り上げ)
; dwBitMasks : DWORD (+0, 12byte)  varptr(st)+0 を基点に操作(12byte:入れ子/配列)
; bmiColors : KS_RGBQUAD (+12, 1024byte)  varptr(st)+12 を基点に操作(1024byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global KS_RGBQUAD
    #field byte rgbBlue
    #field byte rgbGreen
    #field byte rgbRed
    #field byte rgbReserved
#endstruct

#defstruct global KS_TRUECOLORINFO
    #field int dwBitMasks 3
    #field KS_RGBQUAD bmiColors 256
#endstruct

stdim st, KS_TRUECOLORINFO        ; NSTRUCT 変数を確保