Class Palette
D class that wraps SDL_Palette
storing multiple dsdl2.Color
as a palette to use along with indexed
dsdl2.PixelFormat
instances
Constructors
Name | Description |
this
(sdlPalette, isOwner, userRef)
|
Constructs a dsdl2.Palette from a vanilla SDL_Palette* from bindbc-sdl
|
this
(ncolors)
|
Constructs a dsdl2.Palette and allocate memory for a set amount of dsdl2.Color s
|
this
(colors)
|
Constructs a dsdl2.Palette from an array of dsdl2.Color s
|
Fields
Name | Type | Description |
sdlPalette
|
sdl.pixels.SDL_Palette* | Internal SDL_Palette pointer
|
Properties
Name | Type | Description |
colors [get]
|
inout(Color[]) | Proxy to the dsdl2.Color array of the dsdl2.Palette
|
length [get]
|
ulong | Gets the length of dsdl2.Color s allocated in the dsdl2.Palette
|
Methods
Name | Description |
opDollar
()
|
Dollar sign overload
|
opEquals
(rhs)
|
Equality operator overload
|
opIndex
(i)
|
Indexing operation overload
|
toHash
()
|
Gets the hash of the dsdl2.Palette
|
toString
()
|
Formats the dsdl2.Palette into its construction representation: "dsdl2.Palette([<list of dsdl2.Color>])"
|
Example
auto myPalette = new dsdl2.Palette([dsdl2.Color(1, 2, 3), dsdl2.Color(3, 2, 1)]);
assert(myPalette.length == 2);
assert(myPalette[0] == dsdl2.Color(1, 2, 3));