tida.color

Color manipulation module. Mixing, converting, parsing colors.

For mixing use implementations: BlendImpl, using you will get the desired mixing result as a function. An example would be the simplest blending by alpha value:

BlendImpl!(BlendFactor.SrcAlpha, BlendFactor.OneMinusSrcAlpha, Type).

If you need to convert a set of bytes to a set of colors, use the fromColors function.

Members

Aliases

BlendAdd
alias BlendAdd(T) = BlendImpl!(BlendFactor.One, BlendFactor.One, T)
Undocumented in source.
BlendAddAlpha
alias BlendAddAlpha(T) = BlendImpl!(BlendFactor.SrcAlpha, BlendFactor.One, T)
Undocumented in source.
BlendAddMul
alias BlendAddMul(T) = BlendImpl!(BlendFactor.OneMinusDstColor, BlendFactor.One, T)
Undocumented in source.
BlendAlpha
alias BlendAlpha(T) = BlendImpl!(BlendFactor.SrcAlpha, BlendFactor.OneMinusSrcAlpha, T)
Undocumented in source.
BlendMultiply
alias BlendMultiply(T) = BlendImpl!(BlendFactor.DstColor, BlendFactor.Zero, T)
Undocumented in source.
BlendSrc2DST
alias BlendSrc2DST(T) = BlendImpl!(BlendFactor.SrcColor, BlendFactor.One, T)
Undocumented in source.
FuncBlend
alias FuncBlend(T) = Color!T function(Color!T, Color!T) @(safe) nothrow pure
Undocumented in source.
mix
alias mix(T) = BlendMultiply!T
Undocumented in source.

Enums

BlendFactor
enum BlendFactor

Mixing factor of two colors.

PixelFormat
enum PixelFormat

Pixel representation format.

Functions

BlendFunc
FuncBlend!T BlendFunc(int fac1, int fac2)

Returns a reference to a function that implements mixing two colors by mixing factors.

BlendImpl
Color!T BlendImpl(Color!T orig, Color!T color)

Color mixing implementations.

convert
Color!To convert(Color!From color)

Converts one sample color to another.

fromColor
Color!ubyte fromColor(ubyte[] bytes)

Will change the byte sequence to color.

fromColors
Color!ubyte[] fromColors(ubyte[] bytes)

Will change the sequence of bytes into a collection of colors.

fromFormat
ubyte[] fromFormat(ubyte[] pixels)

Converts the format of a sequence of color bytes.

hexTo
T hexTo(R hexData)
Undocumented in source. Be warned that the author may not have intended to support it.
parseColor
Color!C parseColor(T hex)

Recognizes a hex format string, converting it to RGBA representation as a Color!ubyte structure.

rgb
Color!ubyte rgb(ubyte red, ubyte green, ubyte blue)

Creates an RGB color.

rgb
Color!ubyte rgb(ubyte[] data)
Undocumented in source. Be warned that the author may not have intended to support it.
rgba
Color!ubyte rgba(ubyte[] data)
Undocumented in source. Be warned that the author may not have intended to support it.
rgba
Color!ubyte rgba(ubyte red, ubyte green, ubyte blue, ubyte alpha)

Creates an RGBA color.

validateBytes
bool validateBytes(inout(ubyte[]) pixels)

Checks if the byte array is valid for the color description.

Manifest constants

CannotDetectAuto
enum CannotDetectAuto;
Undocumented in source.

Structs

Color
struct Color(T)
Undocumented in source.

Templates

bytesPerColor
template bytesPerColor(int pixelformat, T = ubyte)

Shows how many bytes are contained in a color unit.

isColor
template isColor(T)

Checks if the structure is a color.

isValidFormat
template isValidFormat(int pixelformat)

Whether the pixel format is valid for the job.

Meta

Authors

License