![]() |
![]() |
![]() |
HOME | DOWNLOAD | DOCS | DEVELOPMENT | LICENSE | CREDITS |
Color palette. More...
#include <iPalette.h>
Public Member Functions | |
iPalette () | |
Constructs an empty color palette. | |
iPalette (const iPalette &pal) | |
Copy constructor. | |
iPalette (iPalFormat tp, int num=10) | |
Constructs a color palette. | |
iPalette (const Iubyte *d, iPalFormat fmt, int num) | |
Constructs a palette from existing color data. | |
~iPalette () | |
Destructor. | |
void | clear () |
Deletes palette data and resets all data members to their initial values. | |
bool | isNull () const |
Checks whether or not the palette is empty. | |
void | setData (const Iubyte *d, iPalFormat fmt, int num) |
Adds a series of palette entries using existing color data. | |
const Iubyte * | getData () const |
Returns a pointer to the palette data. | |
int | length () const |
Returns the number of color entries in the palette. | |
int | getBpp () const |
Returns the pixel depth of the palette (bytes per pixel). | |
int | depth () const |
Returns the pixel depth of the palette (bits per pixel). | |
int | dataSize () const |
Returns the size of the palette data in bytes. | |
iPalFormat | getFormat () const |
Returns the palette type. | |
void | addEntry (iColor entry) |
Adds a color entry. | |
void | delEntry () |
Deletes a color entry. | |
iColor | getEntry (int index) |
Gets the color of the entry at the given index. | |
void | setAllocSize (int size) |
Sets the number of entries that should be pre-allocated when reallocating data. | |
void | resize (int size) |
Resizes the palette to hold the specified number of entries. | |
void | swapRGB () |
Swaps the red and blue components of all entries. | |
void | convertFormat (iPalFormat fmt, int alpha=255) |
Converts the palette to the specified format. | |
iPalette & | operator= (const iPalette &pal) |
Color palette.
Constructs an empty color palette.
imagen::iPalette::iPalette | ( | const iPalette & | pal | ) |
Copy constructor.
imagen::iPalette::iPalette | ( | iPalFormat | tp, |
int | num = 10 |
||
) |
Constructs a color palette.
tp | : Color palette type. |
num | : The number of entries to allocate. |
imagen::iPalette::iPalette | ( | const Iubyte * | d, |
iPalFormat | fmt, | ||
int | num | ||
) |
Constructs a palette from existing color data.
void imagen::iPalette::clear | ( | ) |
Deletes palette data and resets all data members to their initial values.
bool imagen::iPalette::isNull | ( | ) | const |
Checks whether or not the palette is empty.
void imagen::iPalette::setData | ( | const Iubyte * | d, |
iPalFormat | fmt, | ||
int | num | ||
) |
Adds a series of palette entries using existing color data.
d | : Pointer to color data. |
fmt | : Palette format. |
num | : Number of entries to copy. |
const Iubyte* imagen::iPalette::getData | ( | ) | const [inline] |
Returns a pointer to the palette data.
int imagen::iPalette::length | ( | ) | const [inline] |
Returns the number of color entries in the palette.
int imagen::iPalette::getBpp | ( | ) | const [inline] |
Returns the pixel depth of the palette (bytes per pixel).
int imagen::iPalette::depth | ( | ) | const [inline] |
Returns the pixel depth of the palette (bits per pixel).
int imagen::iPalette::dataSize | ( | ) | const [inline] |
Returns the size of the palette data in bytes.
iPalFormat imagen::iPalette::getFormat | ( | ) | const [inline] |
Returns the palette type.
void imagen::iPalette::addEntry | ( | iColor | entry | ) |
Adds a color entry.
void imagen::iPalette::delEntry | ( | ) |
Deletes a color entry.
This will not delete the memory allocated by this entry.
iColor imagen::iPalette::getEntry | ( | int | index | ) |
Gets the color of the entry at the given index.
void imagen::iPalette::setAllocSize | ( | int | size | ) | [inline] |
void imagen::iPalette::resize | ( | int | size | ) |
Resizes the palette to hold the specified number of entries.
Although this function does attempt to retain the current palette entries, it will remove entries if the new size is smaller than the previous size of the palette.
This function does not pre-allocate any extra memory.
void imagen::iPalette::swapRGB | ( | ) |
Swaps the red and blue components of all entries.
void imagen::iPalette::convertFormat | ( | iPalFormat | fmt, |
int | alpha = 255 |
||
) |
Converts the palette to the specified format.
fmt | : The format to convert to. |
alpha | : The alpha value to use when converting from a format without an alpha channel to a format with an alpha channel. |
![]() |
Generated by
![]() |