Palette

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

Constructors

this
this(SDL_Palette* sdlPalette, bool isOwner, void* userRef)

Constructs a dsdl2.Palette from a vanilla SDL_Palette* from bindbc-sdl

this
this(uint ncolors)

Constructs a dsdl2.Palette and allocate memory for a set amount of dsdl2.Colors

this
this(Color[] colors)

Constructs a dsdl2.Palette from an array of dsdl2.Colors

Destructor

~this
~this()
Undocumented in source.

Members

Functions

colors
inout(Color[]) colors()

Proxy to the dsdl2.Color array of the dsdl2.Palette

length
size_t length()

Gets the length of dsdl2.Colors allocated in the dsdl2.Palette

opDollar
size_t opDollar()

Dollar sign overload

opEquals
bool opEquals(Palette rhs)

Equality operator overload

opIndex
inout(Color) opIndex(size_t i)

Indexing operation overload

toHash
hash_t toHash()

Gets the hash of the dsdl2.Palette

toString
string toString()

Formats the dsdl2.Palette into its construction representation: "dsdl2.Palette([<list of dsdl2.Color>])"

Variables

sdlPalette
SDL_Palette* sdlPalette;

Internal SDL_Palette pointer

Examples

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));

Meta