ae.utils.graphics.color

Color type and operations.

Members

Aliases

BGR
alias BGR = Color!(ubyte, "b", "g", "r")

Definitions for common color types.

BGRA
alias BGRA = Color!(ubyte, "b", "g", "r", "a")

Definitions for common color types.

BGRX
alias BGRX = Color!(ubyte, "b", "g", "r", "x")

Definitions for common color types.

ExpandChannelType
alias ExpandChannelType(COLOR, int BYTES) = ChangeChannelType!(COLOR, ExpandNumericType!(ChannelType!COLOR, BYTES * 8))

Resolves to a Color instance with its ChannelType expanded by BYTES bytes.

ExpandChannelTypeSigned
alias ExpandChannelTypeSigned(COLOR, int BYTES) = ChangeChannelType!(COLOR, Signed!(ExpandNumericType!(ChannelType!COLOR, BYTES * 8)))

Resolves to a Color instance with its ChannelType expanded by BYTES bytes and made signed.

L16
alias L16 = Color!(ushort, "l")

Definitions for common color types.

L8
alias L8 = Color!(ubyte, "l")

Definitions for common color types.

LA
alias LA = Color!(ubyte, "l", "a")

Definitions for common color types.

LA16
alias LA16 = Color!(ushort, "l", "a")

Definitions for common color types.

OneBitStorageBE
alias OneBitStorageBE = BitStorageUnit!(bool, 1, ubyte, true)

8 monochrome bits packed into a byte, in the usual big-endian order.

OneBitStorageLE
alias OneBitStorageLE = BitStorageUnit!(bool, 1, ubyte, false)

As above, but in little-endian order.

PlainStorageUnit
alias PlainStorageUnit(Color) = Color[1]

Color storage unit for as-is storage.

RGB
alias RGB = Color!(ubyte, "r", "g", "b")

Definitions for common color types.

RGB16
alias RGB16 = Color!(ushort, "r", "g", "b")

Definitions for common color types.

RGBA
alias RGBA = Color!(ubyte, "r", "g", "b", "a")

Definitions for common color types.

RGBA16
alias RGBA16 = Color!(ushort, "r", "g", "b", "a")

Definitions for common color types.

RGBX
alias RGBX = Color!(ubyte, "r", "g", "b", "x")

Definitions for common color types.

RGBX16
alias RGBX16 = Color!(ushort, "r", "g", "b", "x")

Definitions for common color types.

RGBd
alias RGBd = Color!(double, "r", "g", "b")

Definitions for common color types.

RGBf
alias RGBf = Color!(float, "r", "g", "b")

Definitions for common color types.

S16
alias S16 = Color!(short, "l")

Definitions for common color types.

S8
alias S8 = Color!(byte, "l")

Definitions for common color types.

StorageColor
alias StorageColor(StorageType) = typeof(StorageType.init[0])

Get the color value of a storage unit type.

blend
deprecated alias blend = _blend
Undocumented in source.

Functions

_blend
T _blend(T f, T b, T a)
Undocumented in source. Be warned that the author may not have intended to support it.
solidStorageUnit
StorageType solidStorageUnit(StorageColor!StorageType color)

Construct a StorageType with all colors set to the indicated value.

Structs

BitStorageUnit
struct BitStorageUnit(ValueType, size_t valueBits, StorageType, bool bigEndian)

Color storage unit description for packed bit colors (1-bit, 2-bit, 4-bit etc.)

Color
struct Color(FieldTuple...)

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

Gradient
struct Gradient(Value, Color)

Calculate an interpolated color on a gradient with multiple points

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 homogeneous colors.

ExpandIntegerType
template ExpandIntegerType(T, size_t bits)

Wrapper around ExpandNumericType to only expand integer types.

TransformChannelType
template TransformChannelType(COLOR, alias Transformer)

Resolves to a Color instance with a different ChannelType.

channelMap
template channelMap(T, alias expr = a => a)
template channelMap(alias expr)

Applies a transformation per-channel. expr may be in the form of a => ..., or (a, ref b) { b = ...; } (only if T is explicitly specified).

Variables

isStorageColorLValue
enum bool isStorageColorLValue(StorageType);

True when we can take the address of an individual color within a storage unit.

storageColorBits
enum size_t storageColorBits(StorageType);

The number of bits that one individual color takes up.

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/.

Authors

Vladimir Panteleev <ae@cy.md>