Color

Instantiates to a color type. FieldTuple is the color specifier, as parsed by the FieldList template from ae.utils.meta. 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()

Implements conversion to a similar color type.

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.

Meta