Win32 API 日本語リファレンス
ホームDevices.Display › COLORSPACE_TRANSFORM_MATRIX_V2

COLORSPACE_TRANSFORM_MATRIX_V2

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

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

フィールド

フィールドサイズx64x86説明
StageControlLookupTable1DDegammaCOLORSPACE_TRANSFORM_STAGE_CONTROL4+0+0デガンマ1次元LUT段の有効/無効などを制御する列挙値。
LookupTable1DDegammaGAMMA_RAMP_RGB49152+4+4入力線形化用のデガンマ1次元LUTをGAMMA_RAMP_RGBで保持する。
StageControlColorMatrix3x3COLORSPACE_TRANSFORM_STAGE_CONTROL4+49156+491563x3行列変換段の有効/無効などを制御する列挙値。
ColorMatrix3x3FLOAT36+49160+491603行3列の色変換行列を表す浮動小数点配列。
StageControlLookupTable1DRegammaCOLORSPACE_TRANSFORM_STAGE_CONTROL4+49196+49196リガンマ1次元LUT段の有効/無効などを制御する列挙値。
LookupTable1DRegammaGAMMA_RAMP_RGB49152+49200+49200出力ガンマ再適用用のリガンマ1次元LUTをGAMMA_RAMP_RGBで保持する。

各言語での定義

#include <windows.h>

// GAMMA_RAMP_RGB  (x64 12 / x86 12 バイト)
typedef struct GAMMA_RAMP_RGB {
    FLOAT Red;
    FLOAT Green;
    FLOAT Blue;
} GAMMA_RAMP_RGB;

// COLORSPACE_TRANSFORM_MATRIX_V2  (x64 98352 / x86 98352 バイト)
typedef struct COLORSPACE_TRANSFORM_MATRIX_V2 {
    COLORSPACE_TRANSFORM_STAGE_CONTROL StageControlLookupTable1DDegamma;
    GAMMA_RAMP_RGB LookupTable1DDegamma[4096];
    COLORSPACE_TRANSFORM_STAGE_CONTROL StageControlColorMatrix3x3;
    FLOAT ColorMatrix3x3[9];
    COLORSPACE_TRANSFORM_STAGE_CONTROL StageControlLookupTable1DRegamma;
    GAMMA_RAMP_RGB LookupTable1DRegamma[4096];
} COLORSPACE_TRANSFORM_MATRIX_V2;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct GAMMA_RAMP_RGB
{
    public float Red;
    public float Green;
    public float Blue;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct COLORSPACE_TRANSFORM_MATRIX_V2
{
    public int StageControlLookupTable1DDegamma;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4096)] public GAMMA_RAMP_RGB[] LookupTable1DDegamma;
    public int StageControlColorMatrix3x3;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 9)] public float[] ColorMatrix3x3;
    public int StageControlLookupTable1DRegamma;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4096)] public GAMMA_RAMP_RGB[] LookupTable1DRegamma;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure GAMMA_RAMP_RGB
    Public Red As Single
    Public Green As Single
    Public Blue As Single
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure COLORSPACE_TRANSFORM_MATRIX_V2
    Public StageControlLookupTable1DDegamma As Integer
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=4096)> Public LookupTable1DDegamma() As GAMMA_RAMP_RGB
    Public StageControlColorMatrix3x3 As Integer
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=9)> Public ColorMatrix3x3() As Single
    Public StageControlLookupTable1DRegamma As Integer
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=4096)> Public LookupTable1DRegamma() As GAMMA_RAMP_RGB
End Structure
import ctypes
from ctypes import wintypes

class GAMMA_RAMP_RGB(ctypes.Structure):
    _fields_ = [
        ("Red", ctypes.c_float),
        ("Green", ctypes.c_float),
        ("Blue", ctypes.c_float),
    ]

class COLORSPACE_TRANSFORM_MATRIX_V2(ctypes.Structure):
    _fields_ = [
        ("StageControlLookupTable1DDegamma", ctypes.c_int),
        ("LookupTable1DDegamma", GAMMA_RAMP_RGB * 4096),
        ("StageControlColorMatrix3x3", ctypes.c_int),
        ("ColorMatrix3x3", ctypes.c_float * 9),
        ("StageControlLookupTable1DRegamma", ctypes.c_int),
        ("LookupTable1DRegamma", GAMMA_RAMP_RGB * 4096),
    ]
#[repr(C)]
pub struct GAMMA_RAMP_RGB {
    pub Red: f32,
    pub Green: f32,
    pub Blue: f32,
}

#[repr(C)]
pub struct COLORSPACE_TRANSFORM_MATRIX_V2 {
    pub StageControlLookupTable1DDegamma: i32,
    pub LookupTable1DDegamma: [GAMMA_RAMP_RGB; 4096],
    pub StageControlColorMatrix3x3: i32,
    pub ColorMatrix3x3: [f32; 9],
    pub StageControlLookupTable1DRegamma: i32,
    pub LookupTable1DRegamma: [GAMMA_RAMP_RGB; 4096],
}
import "golang.org/x/sys/windows"

type GAMMA_RAMP_RGB struct {
	Red float32
	Green float32
	Blue float32
}

type COLORSPACE_TRANSFORM_MATRIX_V2 struct {
	StageControlLookupTable1DDegamma int32
	LookupTable1DDegamma [4096]GAMMA_RAMP_RGB
	StageControlColorMatrix3x3 int32
	ColorMatrix3x3 [9]float32
	StageControlLookupTable1DRegamma int32
	LookupTable1DRegamma [4096]GAMMA_RAMP_RGB
}
type
  GAMMA_RAMP_RGB = record
    Red: Single;
    Green: Single;
    Blue: Single;
  end;

  COLORSPACE_TRANSFORM_MATRIX_V2 = record
    StageControlLookupTable1DDegamma: Integer;
    LookupTable1DDegamma: array[0..4095] of GAMMA_RAMP_RGB;
    StageControlColorMatrix3x3: Integer;
    ColorMatrix3x3: array[0..8] of Single;
    StageControlLookupTable1DRegamma: Integer;
    LookupTable1DRegamma: array[0..4095] of GAMMA_RAMP_RGB;
  end;
const GAMMA_RAMP_RGB = extern struct {
    Red: f32,
    Green: f32,
    Blue: f32,
};

const COLORSPACE_TRANSFORM_MATRIX_V2 = extern struct {
    StageControlLookupTable1DDegamma: i32,
    LookupTable1DDegamma: [4096]GAMMA_RAMP_RGB,
    StageControlColorMatrix3x3: i32,
    ColorMatrix3x3: [9]f32,
    StageControlLookupTable1DRegamma: i32,
    LookupTable1DRegamma: [4096]GAMMA_RAMP_RGB,
};
type
  GAMMA_RAMP_RGB {.bycopy.} = object
    Red: float32
    Green: float32
    Blue: float32

  COLORSPACE_TRANSFORM_MATRIX_V2 {.bycopy.} = object
    StageControlLookupTable1DDegamma: int32
    LookupTable1DDegamma: array[4096, GAMMA_RAMP_RGB]
    StageControlColorMatrix3x3: int32
    ColorMatrix3x3: array[9, float32]
    StageControlLookupTable1DRegamma: int32
    LookupTable1DRegamma: array[4096, GAMMA_RAMP_RGB]
struct GAMMA_RAMP_RGB
{
    float Red;
    float Green;
    float Blue;
}

struct COLORSPACE_TRANSFORM_MATRIX_V2
{
    int StageControlLookupTable1DDegamma;
    GAMMA_RAMP_RGB[4096] LookupTable1DDegamma;
    int StageControlColorMatrix3x3;
    float[9] ColorMatrix3x3;
    int StageControlLookupTable1DRegamma;
    GAMMA_RAMP_RGB[4096] LookupTable1DRegamma;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; COLORSPACE_TRANSFORM_MATRIX_V2 サイズ: 98352 バイト(x64)
dim st, 24588    ; 4byte整数×24588(構造体サイズ 98352 / 4 切り上げ)
; StageControlLookupTable1DDegamma : COLORSPACE_TRANSFORM_STAGE_CONTROL (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; LookupTable1DDegamma : GAMMA_RAMP_RGB (+4, 49152byte)  varptr(st)+4 を基点に操作(49152byte:入れ子/配列)
; StageControlColorMatrix3x3 : COLORSPACE_TRANSFORM_STAGE_CONTROL (+49156, 4byte)  st.12289 = 値  /  値 = st.12289   (lpoke/lpeek も可)
; ColorMatrix3x3 : FLOAT (+49160, 36byte)  varptr(st)+49160 を基点に操作(36byte:入れ子/配列)
; StageControlLookupTable1DRegamma : COLORSPACE_TRANSFORM_STAGE_CONTROL (+49196, 4byte)  st.12299 = 値  /  値 = st.12299   (lpoke/lpeek も可)
; LookupTable1DRegamma : GAMMA_RAMP_RGB (+49200, 49152byte)  varptr(st)+49200 を基点に操作(49152byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global GAMMA_RAMP_RGB
    #field float Red
    #field float Green
    #field float Blue
#endstruct

#defstruct global COLORSPACE_TRANSFORM_MATRIX_V2
    #field int StageControlLookupTable1DDegamma
    #field GAMMA_RAMP_RGB LookupTable1DDegamma 4096
    #field int StageControlColorMatrix3x3
    #field float ColorMatrix3x3 9
    #field int StageControlLookupTable1DRegamma
    #field GAMMA_RAMP_RGB LookupTable1DRegamma 4096
#endstruct

stdim st, COLORSPACE_TRANSFORM_MATRIX_V2        ; NSTRUCT 変数を確保
st->StageControlLookupTable1DDegamma = 100
mes "StageControlLookupTable1DDegamma=" + st->StageControlLookupTable1DDegamma