dplug.graphics.color

Color type and operations. Port of ae.utils.graphics.

Members

Aliases

ExpandNumericType
alias ExpandNumericType(T, uint additionalBits) = ResizeNumericType!(T, valueBits!T + additionalBits)

Expand to a built-in numeric type of the same kind (signed integer / unsigned integer / floating-point) with at least additionalBits more bits of precision.

Mixin templates

FieldList
mixin template FieldList(Fields...)

Like std.typecons.Tuple, but a template mixin. Unlike std.typecons.Tuple, names may not be omitted - but repeating types may be.

Properties

structFields
string[] structFields [@property getter]

Evaluates to array of strings with name for each field.

Structs

Color
struct Color(FieldTuple...)

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

Templates

ChangeChannelType
template ChangeChannelType(COLOR, T)

Resolves to a Color instance with a different ChannelType.

ChannelType
template ChannelType(T)

Obtains the type of each channel for homogenous colors.

ExpandIntegerType
template ExpandIntegerType(T, size_t bits)

Wrapper around ExpandNumericType to only expand numeric types.

ResizeNumericType
template ResizeNumericType(T, uint bits)

Expand to a built-in numeric type of the same kind (signed integer / unsigned integer / floating-point) with at least the indicated number of bits of precision.

UnsignedBitsType
template UnsignedBitsType(uint bits)

Unsigned integer type big enough to fit N bits of precision.

valueBits
template valueBits(T)

Return the number of bits used to store the value part, i.e. T.sizeof*8 for integer parts and the mantissa size for floating-point types.

Meta

License

This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.