Struct 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) r
ed, g
reen, b
lue color, and a
lpha channel values.
In total there are 16,777,216 possible color values. Combined with the a
lpha (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
Name | Description |
this
(sdlColor)
|
Constructs a dsdl2.Color from a vanilla SDL_Color from bindbc-sdl
|
this
(r, g, b, a)
|
Constructs a dsdl2.Color by feeding in r ed, g reen, b lue, and optionally a lpha values
|
this
(rgb)
|
Constructs a dsdl2.Color by feeding in an array of r ed, g reen, and b lue, with a lpha being 255
|
this
(rgba)
|
Constructs a dsdl2.Color by feeding in an array of r ed, g reen, b lue, and a lpha
|
Fields
Name | Type | Description |
sdlColor
|
sdl.pixels.SDL_Color | Internal SDL_Color struct
|
Properties
Name | Type | Description |
a [get]
|
inout(ubyte) | Proxy to the alpha transparency value of the dsdl2.Color
|
array [get]
|
inout(ubyte[4]) | Static array proxy of the dsdl2.Color
|
b [get]
|
inout(ubyte) | Proxy to the blue color value of the dsdl2.Color
|
g [get]
|
inout(ubyte) | Proxy to the green color value of the dsdl2.Color
|
r [get]
|
inout(ubyte) | Proxy to the red color value of the dsdl2.Color
|
Methods
Name | Description |
toString
()
|
Formats the dsdl2.Color into its construction representation: "dsdl2.Color(<r>, <g>, <b>, <a>)"
|