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.

L16
alias L16 = DefColor!(ushort, "l")
Undocumented in source.
L32f
alias L32f = DefColor!(float, "l")
Undocumented in source.
L8
alias L8 = DefColor!(ubyte, "l")
Undocumented in source.
RGB
alias RGB = DefColor!(ubyte, "r", "g", "b")
Undocumented in source.
RGBA
alias RGBA = DefColor!(ubyte, "r", "g", "b", "a")
Undocumented in source.
RGBA16
alias RGBA16 = DefColor!(ushort, "r", "g", "b", "a")
Undocumented in source.
RGBAf
alias RGBAf = DefColor!(float, "r", "g", "b", "a")
Undocumented in source.
RGBf
alias RGBf = DefColor!(float, "r", "g", "b")
Undocumented in source.

Functions

blendColor
RGB blendColor(RGB fg, RGB bg, ubyte alpha)
Undocumented in source. Be warned that the author may not have intended to support it.
blendColor
L16 blendColor(L16 fg, L16 bg, ushort alpha)
Undocumented in source. Be warned that the author may not have intended to support it.
blendColor
RGBA blendColor(RGBA fg, RGBA bg, ubyte alpha)
Undocumented in source. Be warned that the author may not have intended to support it.
blendColorPremul
RGBA blendColorPremul(RGBA fg, RGBA bg, ubyte alpha)

Blend two colors, where fg is a premultiplied color by its own alpha. We consider fg to be already scaled by (alpha/255) Return: (255-alpha)

itpl
T itpl(T low, T high, U r, U rLow, U rHigh)
Undocumented in source. Be warned that the author may not have intended to support it.
sign
byte sign(T x)
Undocumented in source. Be warned that the author may not have intended to support it.
sort2
void sort2(T x, T y)
Undocumented in source. Be warned that the author may not have intended to support it.
sqr
auto sqr(T x)
Undocumented in source. Be warned that the author may not have intended to support it.

Mixin templates

FieldList
mixintemplate 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

DefColor
struct DefColor(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.

GenFieldList
template GenFieldList(T, Fields...)
Undocumented in source.
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.

SignedBitsType
template SignedBitsType(uint bits)
Undocumented in source.
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/.