Color

D struct that wraps SDL_Color containing 4 bytes for storing color values of 3 color channels and 1 alpha channel.

dsdl2.Color stores unsigned byte-sized (0-255) red, green, blue color, and alpha channel values. In total there are 16,777,216 possible color values. Combined with the alpha (transparency) channel, there are 4,294,967,296 combinations.

Examples

auto red = dsdl2.Color(255, 0, 0);
auto translucentRed = dsdl2.Color(255, 0, 0, 128);

Constructors

this
this()
Undocumented in source.
this
this(SDL_Color sdlColor)

Constructs a dsdl2.Color from a vanilla SDL_Color from bindbc-sdl

this
this(ubyte r, ubyte g, ubyte b, ubyte a)

Constructs a dsdl2.Color by feeding in red, green, blue, and optionally alpha values

this
this(ubyte[3] rgb)

Constructs a dsdl2.Color by feeding in an array of red, green, and blue, with alpha being 255

this
this(ubyte[4] rgba)

Constructs a dsdl2.Color by feeding in an array of red, green, blue, and alpha

Members

Functions

a
inout(ubyte) a()

Proxy to the alpha transparency value of the dsdl2.Color

array
inout(ubyte[4]) array()

Static array proxy of the dsdl2.Color

b
inout(ubyte) b()

Proxy to the blue color value of the dsdl2.Color

g
inout(ubyte) g()

Proxy to the green color value of the dsdl2.Color

r
inout(ubyte) r()

Proxy to the red color value of the dsdl2.Color

toString
string toString()

Formats the dsdl2.Color into its construction representation: "dsdl2.Color(<r>, <g>, <b>, <a>)"

Variables

sdlColor
SDL_Color sdlColor;

Internal SDL_Color struct

Meta