Last update Sun May 11 01:02:33 2014


zlib (See accompanying LICENSE file)

Mike Wey

class Color;

A container for the pixel values: red, green, blue and opacity.


this(Quantum red, Quantum green, Quantum blue, Quantum opacity = OpaqueOpacity);

Create a Color from the specified Quantums.

this(string color);

Create a Color from a X11 color specification string

this(PixelPacket packet);

Create a Color from this PixelPacket.

package this(PixelPacket* packet);

Create a Color and set the internal pointer to this PixelPacket. We can use this to change pixels in an image through Color.

bool opEquals(Object obj);

const string toString();

Returns the value as a hex string.

T opCast(T : Color)();

Support casting between different colors. You can also use

void redQuantum(Quantum red);
Quantum redQuantum();

The value for red in the range [0 .. QuantumRange]

void greenQuantum(Quantum green);
Quantum greenQuantum();

The value for green in the range [0 .. QuantumRange]

void blueQuantum(Quantum blue);
Quantum blueQuantum();

The value for blue in the range [0 .. QuantumRange]

void opacityByte(ubyte opacity);
ubyte opacityByte();

The opacity as a byte. [0 .. 255]

void opacityQuantum(Quantum opacity);
Quantum opacityQuantum();

The value for opacity in the range [0 .. QuantumRange]

void opacity(double opacity);
double opacity();

The value for opacity as a double in the range [0.0 .. 1.0]

double intensity();

The intensity of this color.

Color clone();

Create a copy of this Color.

string name();

Returns the name of the color or the value as a hex string.