Win32 API 日本語リファレンス
ホームUI.ColorSystem › PrimaryXYZColors

PrimaryXYZColors

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

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

フィールド

フィールドサイズx64x86説明
redXYZColorF12+0+0XYZ色空間での赤原色。
yellowXYZColorF12+12+12XYZ色空間での黄原色。
greenXYZColorF12+24+24XYZ色空間での緑原色。
cyanXYZColorF12+36+36XYZ色空間でのシアン原色。
blueXYZColorF12+48+48XYZ色空間での青原色。
magentaXYZColorF12+60+60XYZ色空間でのマゼンタ原色。
blackXYZColorF12+72+72XYZ色空間での黒点。
whiteXYZColorF12+84+84XYZ色空間での白点。

各言語での定義

#include <windows.h>

// XYZColorF  (x64 12 / x86 12 バイト)
typedef struct XYZColorF {
    FLOAT X;
    FLOAT Y;
    FLOAT Z;
} XYZColorF;

// PrimaryXYZColors  (x64 96 / x86 96 バイト)
typedef struct PrimaryXYZColors {
    XYZColorF red;
    XYZColorF yellow;
    XYZColorF green;
    XYZColorF cyan;
    XYZColorF blue;
    XYZColorF magenta;
    XYZColorF black;
    XYZColorF white;
} PrimaryXYZColors;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct XYZColorF
{
    public float X;
    public float Y;
    public float Z;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct PrimaryXYZColors
{
    public XYZColorF red;
    public XYZColorF yellow;
    public XYZColorF green;
    public XYZColorF cyan;
    public XYZColorF blue;
    public XYZColorF magenta;
    public XYZColorF black;
    public XYZColorF white;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure XYZColorF
    Public X As Single
    Public Y As Single
    Public Z As Single
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure PrimaryXYZColors
    Public red As XYZColorF
    Public yellow As XYZColorF
    Public green As XYZColorF
    Public cyan As XYZColorF
    Public blue As XYZColorF
    Public magenta As XYZColorF
    Public black As XYZColorF
    Public white As XYZColorF
End Structure
import ctypes
from ctypes import wintypes

class XYZColorF(ctypes.Structure):
    _fields_ = [
        ("X", ctypes.c_float),
        ("Y", ctypes.c_float),
        ("Z", ctypes.c_float),
    ]

class PrimaryXYZColors(ctypes.Structure):
    _fields_ = [
        ("red", XYZColorF),
        ("yellow", XYZColorF),
        ("green", XYZColorF),
        ("cyan", XYZColorF),
        ("blue", XYZColorF),
        ("magenta", XYZColorF),
        ("black", XYZColorF),
        ("white", XYZColorF),
    ]
#[repr(C)]
pub struct XYZColorF {
    pub X: f32,
    pub Y: f32,
    pub Z: f32,
}

#[repr(C)]
pub struct PrimaryXYZColors {
    pub red: XYZColorF,
    pub yellow: XYZColorF,
    pub green: XYZColorF,
    pub cyan: XYZColorF,
    pub blue: XYZColorF,
    pub magenta: XYZColorF,
    pub black: XYZColorF,
    pub white: XYZColorF,
}
import "golang.org/x/sys/windows"

type XYZColorF struct {
	X float32
	Y float32
	Z float32
}

type PrimaryXYZColors struct {
	red XYZColorF
	yellow XYZColorF
	green XYZColorF
	cyan XYZColorF
	blue XYZColorF
	magenta XYZColorF
	black XYZColorF
	white XYZColorF
}
type
  XYZColorF = record
    X: Single;
    Y: Single;
    Z: Single;
  end;

  PrimaryXYZColors = record
    red: XYZColorF;
    yellow: XYZColorF;
    green: XYZColorF;
    cyan: XYZColorF;
    blue: XYZColorF;
    magenta: XYZColorF;
    black: XYZColorF;
    white: XYZColorF;
  end;
const XYZColorF = extern struct {
    X: f32,
    Y: f32,
    Z: f32,
};

const PrimaryXYZColors = extern struct {
    red: XYZColorF,
    yellow: XYZColorF,
    green: XYZColorF,
    cyan: XYZColorF,
    blue: XYZColorF,
    magenta: XYZColorF,
    black: XYZColorF,
    white: XYZColorF,
};
type
  XYZColorF {.bycopy.} = object
    X: float32
    Y: float32
    Z: float32

  PrimaryXYZColors {.bycopy.} = object
    red: XYZColorF
    yellow: XYZColorF
    green: XYZColorF
    cyan: XYZColorF
    blue: XYZColorF
    magenta: XYZColorF
    black: XYZColorF
    white: XYZColorF
struct XYZColorF
{
    float X;
    float Y;
    float Z;
}

struct PrimaryXYZColors
{
    XYZColorF red;
    XYZColorF yellow;
    XYZColorF green;
    XYZColorF cyan;
    XYZColorF blue;
    XYZColorF magenta;
    XYZColorF black;
    XYZColorF white;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; PrimaryXYZColors サイズ: 96 バイト(x64)
dim st, 24    ; 4byte整数×24(構造体サイズ 96 / 4 切り上げ)
; red : XYZColorF (+0, 12byte)  varptr(st)+0 を基点に操作(12byte:入れ子/配列)
; yellow : XYZColorF (+12, 12byte)  varptr(st)+12 を基点に操作(12byte:入れ子/配列)
; green : XYZColorF (+24, 12byte)  varptr(st)+24 を基点に操作(12byte:入れ子/配列)
; cyan : XYZColorF (+36, 12byte)  varptr(st)+36 を基点に操作(12byte:入れ子/配列)
; blue : XYZColorF (+48, 12byte)  varptr(st)+48 を基点に操作(12byte:入れ子/配列)
; magenta : XYZColorF (+60, 12byte)  varptr(st)+60 を基点に操作(12byte:入れ子/配列)
; black : XYZColorF (+72, 12byte)  varptr(st)+72 を基点に操作(12byte:入れ子/配列)
; white : XYZColorF (+84, 12byte)  varptr(st)+84 を基点に操作(12byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global XYZColorF
    #field float X
    #field float Y
    #field float Z
#endstruct

#defstruct global PrimaryXYZColors
    #field XYZColorF red
    #field XYZColorF yellow
    #field XYZColorF green
    #field XYZColorF cyan
    #field XYZColorF blue
    #field XYZColorF magenta
    #field XYZColorF black
    #field XYZColorF white
#endstruct

stdim st, PrimaryXYZColors        ; NSTRUCT 変数を確保