tbx
0.7.3
|
A class to hold a list of Colours for the a colour palette. More...
#include <sprite.h>
Public Member Functions | |
ColourPalette (int size=0) | |
Construct a colour palette of a specified size. More... | |
ColourPalette (const ColourPalette &other) | |
Construct a palette by making a copy of another palette. More... | |
void | resize (int new_size) |
Resize the colour palette. More... | |
void | desktop_palette () |
Convert this palette to the current desktop palette. | |
ColourPalette & | operator= (const ColourPalette &other) |
Assign to a copy of another palette. More... | |
bool | operator== (const ColourPalette &other) |
Check if two palettes contain all the same colours. More... | |
bool | operator!= (const ColourPalette &other) |
Check if two palette have one or more colours different. More... | |
Colour & | operator[] (int index) |
Get reference to colour in the palette. More... | |
const Colour & | operator[] (int index) const |
Get constant reference to colour in the palette. More... | |
void | entry (int index, const Colour &col) |
Set the specified index to the given colour. More... | |
Colour | entry (int index) const |
Return the colour for the specified index. More... | |
int | size () const |
Return the size of the palette. | |
const Colour * | address () const |
Get a pointer to the array of colours. | |
A class to hold a list of Colours for the a colour palette.
Typically this is returned from a sprite that has < 32 thousand colours
ColourPalette::ColourPalette | ( | int | size = 0 | ) |
Construct a colour palette of a specified size.
The palette will just consist of black entries
size | number of colours in the palette |
ColourPalette::ColourPalette | ( | const ColourPalette & | other | ) |
Construct a palette by making a copy of another palette.
other | palette to copy |
|
inline |
Set the specified index to the given colour.
index | index of entry to set palette for (0 to size-1) |
col | new colour for the entry |
|
inline |
Return the colour for the specified index.
index | index of entry to return palette from (0 to size-1) |
bool ColourPalette::operator!= | ( | const ColourPalette & | other | ) |
Check if two palette have one or more colours different.
other | palette to compare to |
ColourPalette & ColourPalette::operator= | ( | const ColourPalette & | other | ) |
Assign to a copy of another palette.
other | palette to copy |
bool ColourPalette::operator== | ( | const ColourPalette & | other | ) |
Check if two palettes contain all the same colours.
other | palette to compare to |
|
inline |
Get reference to colour in the palette.
index | index of entry in the palette (0 to size-1) |
|
inline |
Get constant reference to colour in the palette.
index | index of entry in the palette (0 to size-1) |
void ColourPalette::resize | ( | int | newsize | ) |
Resize the colour palette.
Note: Old colours are not preserved and the palette is reset so all entries are black
newsize | new number of colours in the palette |