Color

Color defines a structure which contains 4 ubyte values, each for red, green, blue and alpha. Alpha is default 255 (1.0).

Constructors

this
this(ubyte red, ubyte green, ubyte blue, ubyte alpha)

CTor

this
this(float red, float green, float blue, float alpha)

CTor Expect that every component is in range 0.0 .. 1.0

Members

Functions

asGLColor
float[4] asGLColor()

Returns a static float array with all color components. Every component is converted into OpenGL style. Means every component is in range 0.0 .. 1.0

asRGB
ubyte[3] asRGB()

Returns RGB the color information as static array

asRGBA
ubyte[4] asRGBA()

Returns the RGBA color information as static array

opEquals
bool opEquals(Color col)

opEquals: compares two Colors.

set
void set(ubyte red, ubyte green, ubyte blue, ubyte alpha)

Set all color components to new values

set
void set(float red, float green, float blue, float alpha)

Set all color components to new values Expect that every component is in range 0.0 .. 1.0

transferTo
void transferTo(SDL_Color* col)

Transfer the internal data to the SDL_Color

withTransparency
Color withTransparency(ubyte alpha)

Returns a copy of the current Color with a given transpareny.

Static variables

Black
Color Black;

Black Color (0, 0, 0)

Blue
Color Blue;

Blue Color (0, 0, 255)

Cyan
Color Cyan;

Cyan Color (0, 255, 255)

Gray
Color Gray;

Gray Color (0.7, 0.7, 0.7)

Green
Color Green;

Green Color (0, 255, 0)

Magenta
Color Magenta;

Magenta Color (255, 0, 255)

Red
Color Red;

Red Color (255, 0, 0)

White
Color White;

White Color (255, 255, 255)

Yellow
Color Yellow;

Yellow Color (255, 255, 0)

Variables

alpha
ubyte alpha;
blue
ubyte blue;
green
ubyte green;

The color components

red
ubyte red;

The color components

Meta

Authors

rschuett