Public Member Functions
imagen::iPalette Class Reference

Color palette. More...

#include <iPalette.h>

List of all members.

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 IubytegetData () 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.
iPaletteoperator= (const iPalette &pal)

Detailed Description

Color palette.


Constructor & Destructor Documentation

Constructs an empty color palette.

Copy constructor.

imagen::iPalette::iPalette ( iPalFormat  tp,
int  num = 10 
)

Constructs a color palette.

Parameters:
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.

See also:
setData()

Destructor.

Deletes palette data.

See also:
clear()

Member Function Documentation

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.

Parameters:
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.

Returns the palette type.

Adds a color entry.

Deletes a color entry.

This will not delete the memory allocated by this entry.

Gets the color of the entry at the given index.

void imagen::iPalette::setAllocSize ( int  size) [inline]

Sets the number of entries that should be pre-allocated when reallocating data.

The default pre-allocation size is 10.
This value will be used by iPalette's internal reallocation function, and will not be used by the public resize() function.

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.

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.

Parameters:
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.
iPalette& imagen::iPalette::operator= ( const iPalette pal)

The documentation for this class was generated from the following file: