Class Palette

D class that wraps SDL_Palette storing multiple dsdl.Color as a palette to use along with indexed dsdl.PixelFormat instances

class Palette ;

Constructors

NameDescription
this (sdlPalette, isOwner, userRef) Constructs a dsdl.Palette from a vanilla SDL_Palette* from bindbc-sdl
this (ncolors) Constructs a dsdl.Palette and allocate memory for a set amount of dsdl.Colors
this (colors) Constructs a dsdl.Palette from an array of dsdl.Colors

Fields

NameTypeDescription
sdlPalette sdl.pixels.SDL_Palette*Internal SDL_Palette pointer

Properties

NameTypeDescription
colors[get] inout(Color[])Proxy to the dsdl.Color array of the dsdl.Palette
length[get] ulongGets the length of dsdl.Colors allocated in the dsdl.Palette

Methods

NameDescription
opDollar () Dollar sign overload
opEquals (rhs) Equality operator overload
opIndex (i) Indexing operation overload
toHash () Gets the hash of the dsdl.Palette
toString () Formats the dsdl.Palette into its construction representation: "dsdl.Palette([<list of dsdl.Color>])"

Example

auto myPalette = new dsdl.Palette([dsdl.Color(1, 2, 3), dsdl.Color(3, 2, 1)]);
assert(myPalette.length == 2);
assert(myPalette[0] == dsdl.Color(1, 2, 3));