Original Symbian headers
Selected EUSER, Window Server, networking, graphics and device declarations
Loading...
Searching...
No Matches
CPalette Class Reference

Provides user-definable palette support to the GDI. More...

#include <gdi.h>

Inheritance diagram for CPalette:
CBase

Public Member Functions

IMPORT_C ~CPalette ()
 Destructor.
 
IMPORT_C void Clear ()
 Clears all the entries in the palette to TRgb(0).
 
TInt Entries () const
 Gets the number of entries in the palette.
 
IMPORT_C TRgb GetEntry (TInt aPaletteIndex) const
 Gets the RGB value of the palette entry at aPaletteIndex.
 
IMPORT_C TRgb NearestEntry (const TRgb &aColor) const
 Gets the colour in the palette which is closest to the specified colour.
 
IMPORT_C TInt NearestIndex (const TRgb &aColor) const
 Gets the index of the colour in the palette which is closest to the specified colour.
 
IMPORT_C void SetEntry (TInt aPaletteIndex, const TRgb &aPaletteEntry)
 Sets the palette entry at aPaletteIndex to the RGB value aPaletteEntry.
 
IMPORT_C void GetDataPtr (TInt aFirstColor, TInt aNumColors, TPtr8 &aPtr)
 Returns a descriptor over the palette entries for the specifed colors.
 
- Public Member Functions inherited from CBase
 CBase ()
 Default constructor.
 
virtual IMPORT_C ~CBase ()
 Virtual destructor.
 
TAny * operator new (TUint aSize, TAny *aBase) __NO_THROW
 Initialises the object to binary zeroes.
 
TAny * operator new (TUint aSize) __NO_THROW
 Allocates the object from the heap and then initialises its contents to binary zeroes.
 
TAny * operator new (TUint aSize, TLeave)
 Allocates the object from the heap and then initialises its contents to binary zeroes.
 
TAny * operator new (TUint aSize, TUint aExtraSize) __NO_THROW
 Allocates the object from the heap and then initialises its contents to binary zeroes.
 
TAny * operator new (TUint aSize, TLeave, TUint aExtraSize)
 Allocates the object from the heap and then initialises its contents to binary zeroes.
 

Static Public Member Functions

static IMPORT_C CPalette * NewL (TInt aNumberOfEntries)
 Creates a new palette with the specified number of entries.
 
static IMPORT_C CPalette * NewDefaultL (TDisplayMode aDispMode)
 Creates a new default palette for the specified display mode.
 
- Static Public Member Functions inherited from CBase
static IMPORT_C void Delete (CBase *aPtr)
 Deletes the specified object.
 

Protected Member Functions

IMPORT_C CPalette ()
 
void ConstructL (TInt aNumberOfEntries)
 
- Protected Member Functions inherited from CBase
virtual IMPORT_C TInt Extension_ (TUint aExtensionId, TAny *&a0, TAny *a1)
 Extension function.
 

Protected Attributes

TRgb * iArray
 
TInt iNumEntries
 

Detailed Description

Provides user-definable palette support to the GDI.

A palette is a user-defined set of colours, which is a subset of the full range of 24-bit colours. This allows users the advantages of having a low bpp colour mode whilst being able to specify the colours available in that mode. To give an example, the EColor16 mode provides a palette of 16 colours as it provides a mapping between an integer index and a TRgb colour (see the table EGA Low-colour constants). Only a palette of 16 colour enables you to change the palette. Palettes are also used to allow 24-bit bitmaps to be stored in a more compressed form by finding the actual number of different colours used in the bitmap, creating a palette to allow the mapping of these colours to a smaller index space, and encoding the bitmaps pixels using indexes to this new index space.

A palette has a size which is set at its creation and cannot be altered the number of entries in the palette. Each entry in a palette is a mapping between that entrys index and a TRgb value. Palette entries can be got and set at any time between the palettes creation and destruction. The GDIs palette support also provides functions to find the nearest palette colour to a requested TRgb colour.

API status
Published to all clients. Released API.

Definition at line 364 of file gdi.h.

Constructor & Destructor Documentation

◆ ~CPalette()

IMPORT_C CPalette::~CPalette ( )

Destructor.

(generated from Symbian Developer Library)

◆ CPalette()

IMPORT_C CPalette::CPalette ( )
protected

Member Function Documentation

◆ Clear()

IMPORT_C void CPalette::Clear ( )

Clears all the entries in the palette to TRgb(0).

(generated from Symbian Developer Library)

◆ ConstructL()

void CPalette::ConstructL ( TInt  aNumberOfEntries)
protected

◆ Entries()

TInt CPalette::Entries ( ) const
inline

Gets the number of entries in the palette.

(generated from Symbian Developer Library)

◆ GetDataPtr()

IMPORT_C void CPalette::GetDataPtr ( TInt  aFirstColor,
TInt  aNumColors,
TPtr8 &  aPtr 
)

Returns a descriptor over the palette entries for the specifed colors.

It is designed so that the descriptor can be passed to another thread and that thread copy the relevant entries.

Parameters
aFirstColorThe first colour.
aNumColorsNumber of colours.
aPtrDescriptor.

(generated from Symbian Developer Library)

◆ GetEntry()

IMPORT_C TRgb CPalette::GetEntry ( TInt  aPaletteIndex) const

Gets the RGB value of the palette entry at aPaletteIndex.

Parameters
aPaletteIndexThe index of the palette entry to get.

(generated from Symbian Developer Library)

◆ NearestEntry()

IMPORT_C TRgb CPalette::NearestEntry ( const TRgb &  aColor) const

Gets the colour in the palette which is closest to the specified colour.

Parameters
aColorThe colour to find.

(generated from Symbian Developer Library)

◆ NearestIndex()

IMPORT_C TInt CPalette::NearestIndex ( const TRgb &  aColor) const

Gets the index of the colour in the palette which is closest to the specified colour.

Parameters
aColorThe colour to find.

(generated from Symbian Developer Library)

◆ NewDefaultL()

static IMPORT_C CPalette * CPalette::NewDefaultL ( TDisplayMode  aDispMode)
static

Creates a new default palette for the specified display mode.

The default palette for a particular display mode has one entry for each possible colour in that display mode (2 entries for EGray2, 16 entries for EColor16 etc.); the colour of each index p in the default palette is set to its default value according to its display mode (e.g. if the mode is EColor16 then palette[p]==TRgbColor16(p); if the mode is EGray4 then palette[p]==TRgb_Gray4(p)).

Parameters
aDispModeThe display mode for which the palette is to be created.

(generated from Symbian Developer Library)

◆ NewL()

static IMPORT_C CPalette * CPalette::NewL ( TInt  aNumberOfEntries)
static

Creates a new palette with the specified number of entries.

Parameters
aNumberOfEntriesThe number of entries in the palette being created.

(generated from Symbian Developer Library)

◆ SetEntry()

IMPORT_C void CPalette::SetEntry ( TInt  aPaletteIndex,
const TRgb &  aPaletteEntry 
)

Sets the palette entry at aPaletteIndex to the RGB value aPaletteEntry.

Parameters
aPaletteIndexThe index of the palette entry to be set.
aPaletteEntryThe RGB value to set that entry to.

(generated from Symbian Developer Library)

Member Data Documentation

◆ iArray

TRgb* CPalette::iArray
protected

Definition at line 381 of file gdi.h.

◆ iNumEntries

TInt CPalette::iNumEntries
protected

Definition at line 382 of file gdi.h.


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