Color

Represents a tuple of samples, usually used to represent a single color in some color space. This helper type allows manipulating such tuples more easily, and has special behavior for common color representations (e.g. special treatment of the "a" field as an alpha channel, and construction from hex strings for R/G/B colors). FieldTuple is a field spec, as parsed by ae.utils.meta.FieldList. By convention, each field's name indicates its purpose: - x: padding - a: alpha - l: lightness (or grey, for monochrome images) - others (r, g, b, etc.): color information

Members

Aliases

ChannelType
alias ChannelType = typeof(Fields.init.tupleof[0])

Additional properties for homogeneous colors.

Spec
alias Spec = FieldTuple
Undocumented in source.
homogenous
deprecated alias homogenous = homogeneous
Undocumented in source.

Functions

opBinary
typeof(this) opBinary(T o)

Warning: overloaded operators preserve types and may cause overflows

opCast
T opCast()

Perform a per-channel hard-cast. Provides continuity with casting of D basic types. If this is not needed, consider using channelMap instead.

opOpAssign
typeof(this) opOpAssign(int o)
typeof(this) opOpAssign(T o)

Warning: overloaded operators preserve types and may cause overflows

opUnary
typeof(this) opUnary()

Warning: overloaded operators preserve types and may cause overflows

sum
ExpandIntegerType!(ChannelType, ilog2(nextPowerOfTwo(channels))) sum()

Sum of all channels

toHex
string toHex()

Construct an RGB color from a typical hex string.

Manifest constants

channelBits
enum channelBits;
Undocumented in source.
channels
enum channels;

The number of fields in this color type.

homogeneous
enum homogeneous;

Whether or not all channel fields have the same base type.

Mixins

__anonymous
mixin FieldList!FieldTuple
Undocumented in source.

Properties

max
Color max [@property getter]

Returns an instance of this color type with all fields set at their maximum values.

min
Color min [@property getter]

Returns an instance of this color type with all fields set at their minimum values.

Static functions

blend
typeof(this) blend(typeof(this) c0, typeof(this) c1)

Alpha-blend two colors.

blend
typeof(this) blend(typeof(this) c0, C c1)

Alpha-blend a color with an alpha channel on top of one without.

fromHex
typeof(this) fromHex(char[] s)

Construct an RGB color from a typical hex string.

itpl
typeof(this) itpl(typeof(this) c0, typeof(this) c1, P p, P p0, P p1)

Interpolate between two colors. See also: Gradient

monochrome
typeof(this) monochrome(ChannelType value)

Return a Color instance with all fields set to "value".

op
typeof(this) op(T values)

Apply a custom operation for each channel. Example: COLOR.op!q{(a + b) / 2}(colorA, colorB);

Variables

black
enum typeof(this) black;

Additional properties for integer colors.

white
enum typeof(this) white;

Additional properties for integer colors.

Mixed In Members

From mixin FieldList!FieldTuple

_GenFieldList
template _GenFieldList(size_t ti, size_t i)
Undocumented in source.

Meta