The OpenD Programming Language

XYZ

A CIE 1931 XYZ color, parameterised for component type.

Constructors

this
this(ComponentType X, ComponentType Y, ComponentType Z)

Construct a color from XYZ values.

Members

Aliases

ComponentType
alias ComponentType = F

Type of the color components.

Functions

opBinary
typeof(this) opBinary(S rh)

Binary operators.

opBinary
typeof(this) opBinary(typeof(this) rh)

Binary operators.

opCast
Color opCast()

Cast to other color types.

opOpAssign
typeof(this) opOpAssign(typeof(this) rh)

Binary assignment operators.

opOpAssign
typeof(this) opOpAssign(S rh)

Binary assignment operators.

opUnary
typeof(this) opUnary()

Unary operators.

Properties

tristimulus
auto tristimulus [@property getter]

Return the XYZ tristimulus values as a tuple.

Variables

X
F X;

X value.

Y
F Y;

Y value.

Z
F Z;

Z value.

Examples

// CIE XYZ 1931 color with float components
alias XYZf = XYZ!float;

XYZf c = XYZf(0.8, 1, 1.2);

// tristimulus() returns a tuple of the components
assert(c.tristimulus == tuple(c.X, c.Y, c.Z));

// test XYZ operators and functions
static assert(XYZf(0, 0.5, 0) + XYZf(0.5, 0.5, 1) == XYZf(0.5, 1, 1));
static assert(XYZf(0.5, 0.5, 1) * 100.0 == XYZf(50, 50, 100));

Meta