cPalette Class Reference

#include <osd.h>

Inheritance diagram for cPalette:

Inheritance graph
[legend]

List of all members.

Public Member Functions

 cPalette (int Bpp=8)
 Initializes the palette with the given color depth.
int Bpp (void)
void Reset (void)
 Resets the palette, making it contain no colors.
int Index (tColor Color)
tColor Color (int Index)
void SetBpp (int Bpp)
void SetColor (int Index, tColor Color)
const tColorColors (int &NumColors)
void Take (const cPalette &Palette, tIndexes *Indexes=NULL, tColor ColorFg=0, tColor ColorBg=0)
void Replace (const cPalette &Palette)

Protected Types

typedef tIndex tIndexes [MAXNUMCOLORS]

Private Attributes

tColor color [MAXNUMCOLORS]
int bpp
int maxColors
int numColors
bool modified


Detailed Description

Definition at line 47 of file osd.h.


Member Typedef Documentation

typedef tIndex cPalette::tIndexes[MAXNUMCOLORS] [protected]

Definition at line 54 of file osd.h.


Constructor & Destructor Documentation

cPalette::cPalette ( int  Bpp = 8  ) 

Initializes the palette with the given color depth.

Definition at line 20 of file osd.c.

References SetBpp().

Here is the call graph for this function:


Member Function Documentation

int cPalette::Bpp ( void   )  [inline]

Definition at line 58 of file osd.h.

References bpp.

Referenced by cDvbOsd::Flush().

void cPalette::Reset ( void   ) 

Resets the palette, making it contain no colors.

Definition at line 25 of file osd.c.

References modified, and numColors.

Referenced by cBitmap::DrawBitmap(), cBitmap::DrawRectangle(), and SetBpp().

int cPalette::Index ( tColor  Color  ) 

Returns the index of the given Color (the first color has index 0). If Color is not yet contained in this palette, it will be added if there is a free slot. If the color can't be added to this palette, 0 will be returned.

Definition at line 31 of file osd.c.

References color, dsyslog, maxColors, modified, and numColors.

Referenced by cBitmap::DrawPixel(), cBitmap::DrawRectangle(), cBitmap::DrawText(), and Take().

tColor cPalette::Color ( int  Index  )  [inline]

Returns the color at the given Index. If Index is outside the valid range, 0 will be returned.

Definition at line 66 of file osd.h.

References color, and maxColors.

Referenced by Take().

void cPalette::SetBpp ( int  Bpp  ) 

Sets the color depth of this palette to the given value. The palette contents will be reset, so that it contains no colors.

Definition at line 47 of file osd.c.

References bpp, maxColors, and Reset().

Referenced by cPalette(), and cBitmap::SetXpm().

Here is the call graph for this function:

void cPalette::SetColor ( int  Index,
tColor  Color 
)

Sets the palette entry at Index to Color. If Index is larger than the number of currently used entries in this palette, the entries in between will have undefined values.

Definition at line 54 of file osd.c.

References color, maxColors, modified, and numColors.

Referenced by cDvbSpuBitmap::getBitmap(), Replace(), and cBitmap::SetXpm().

const tColor * cPalette::Colors ( int &  NumColors  ) 

Returns a pointer to the complete color table and stores the number of valid entries in NumColors. If no colors have been stored yet, NumColors will be set to 0 and the function will return NULL.

Definition at line 67 of file osd.c.

References color, and numColors.

Referenced by cDvbOsd::Flush().

void cPalette::Take ( const cPalette Palette,
tIndexes Indexes = NULL,
tColor  ColorFg = 0,
tColor  ColorBg = 0 
)

Takes the colors from the given Palette and adds them to this palette, using existing entries if possible. If Indexes is given, it will be filled with the index values that each color of Palette has in this palette. If either of ColorFg or ColorBg is not zero, the first color in Palette will be taken as ColorBg, and the second color will become ColorFg.

Definition at line 73 of file osd.c.

References color, Color(), Index(), and numColors.

Referenced by cBitmap::DrawBitmap(), and cOsd::SetPalette().

Here is the call graph for this function:

void cPalette::Replace ( const cPalette Palette  ) 

Replaces the colors of this palette with the colors from the given palette.

Definition at line 89 of file osd.c.

References color, numColors, and SetColor().

Referenced by cBitmap::DrawBitmap().

Here is the call graph for this function:


Member Data Documentation

tColor cPalette::color[MAXNUMCOLORS] [private]

Definition at line 49 of file osd.h.

Referenced by Color(), Colors(), Index(), Replace(), SetColor(), cBitmap::SetXpm(), and Take().

int cPalette::bpp [private]

Definition at line 50 of file osd.h.

Referenced by Bpp(), and SetBpp().

int cPalette::maxColors [private]

Definition at line 51 of file osd.h.

Referenced by Color(), Index(), SetBpp(), and SetColor().

int cPalette::numColors [private]

Definition at line 51 of file osd.h.

Referenced by Colors(), Index(), Replace(), Reset(), SetColor(), and Take().

bool cPalette::modified [private]

Definition at line 52 of file osd.h.

Referenced by Index(), Reset(), and SetColor().


The documentation for this class was generated from the following files:
Generated on Tue Nov 6 20:21:24 2007 for VDR by  doxygen 1.5.3-20071008