Class: TColorTable

Declaration: ColorTable.h

Taxonomy Categories:

Member Functions:


Interface Category:

API.

Inherits From:

MCollectible

Inherited By:

None.

Purpose:

TColorTable is an abstract base class for implementing color lookup tables for the various pixel buffers requiring a color lookup table. Color lookup tables contain a finite number of colors which are accessed by an index into the table. Two pixel buffers which make use of color lookup tables that are provided include TClut2PixelBuffer and TGray4PixelBuffer. TColorTable has a TColorTableSearcher that can iterate through the table. You can use the table searcher to find specific colors or to find the closest match to a specific color. TColorTable has several dither matrices that contain information for approximating colors not present in the color table via a spatial mixture of existing colors. This class' interface will change in future releases.

Instantiation:

Abstract base class; do not allocate.

Deriving Classes:

Provided classes include TGrayColorTable and TRGBColorTable. Derived classes should override GetSize, SetSize, GetRGBColor, GetGrayColor, IsAGrayscaleRamp, IsArbitrary, IsFixed, AdoptColorSearcher, all the FindClosestMatch functions, GetColorTableSearcher, and all the GetOrderedDitherMatrix functions.

Concurrency:

Not multithread safe.

Resource Use:

No special requirements.

Member Function: TColorTable::~TColorTable

virtual ~ TColorTable ()

Interface Category:

API.

Purpose:

Destructor.

Calling Context:

Called to destroy an object.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

This class' interface will change in future releases.

Member Function: TColorTable::GetSize

virtual long GetSize () const

Interface Category:

API.

Purpose:

Returns the number of colors contained within the table.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns the number of colors in the color table.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

This class' interface will change in future releases.

Member Function: TColorTable::GetRGBColor

virtual void GetRGBColor (CompactRGBColor & color, short whichcolor) const

Interface Category:

API.

Purpose:

Returns the RGB color at the specified index in the color table.

Calling Context:

Call this function directly.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

This class' interface will change in future releases.

Member Function: TColorTable::GetGrayColor

virtual GrayColor GetGrayColor (short whichcolor) const

Interface Category:

API.

Purpose:

Converts the RGB color at the specified index in the color table to gray and returns it.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns a gray scale value for the color at location whichcolor.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

This class' interface will change in future releases.

Member Function: TColorTable::FindClosestMatchToRGBColor

  1. virtual unsigned short FindClosestMatchToRGBColor (const CompactRGBColor & color)
  2. virtual unsigned short FindClosestMatchToRGBColor (const TRGBColor & color)

Interface Category:

API.

Purpose:

  1. Searches the color table for the color that most closely matches the specified TRGBColor and returns it.
  2. Searches the color table for the color that most closely matches the specified CompactRGBColor and returns it.

Calling Context:

  1. Call this function directly.
  2. Call this function directly.

Parameters:

Return Value:

Returns an unsigned short that contains the index of the closest matching color.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

This class' interface will change in future releases.

Member Function: TColorTable::FindClosestMatchToGrayColor

  1. virtual unsigned short FindClosestMatchToGrayColor (GrayColor agray)
  2. virtual unsigned short FindClosestMatchToGrayColor (const TGrayColor & color)

Interface Category:

API.

Purpose:

  1. Searches the color table for the color that most closely matches the specified TGrayColor and returns it.
  2. Searches the color table for the color that most closely matches the specified GrayColor and returns it.

Calling Context:

  1. Call this function directly.
  2. Call this function directly.

Parameters:

Return Value:

Returns an unsigned short that contains the index of the closest matching color.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

This class' interface will change in future releases.

Member Function: TColorTable::FindClosestMatchToColor

virtual unsigned short FindClosestMatchToColor (const TColor & color)

Interface Category:

API.

Purpose:

Searches the color table for the color that most closely matches the specified TColor and returns it.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns an unsigned short that contains the index of the closest matching color.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

This class' interface will change in future releases.

Member Function: TColorTable::GetUnreachableSeed

static unsigned long GetUnreachableSeed ()

Interface Category:

API.

Purpose:

Returns a number of an invalid seed that does not match any color table.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns a number of an invalid seed that does not match any color table.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

This class' interface will change in future releases.

Member Function: TColorTable::GetSeed

unsigned long GetSeed () const

Interface Category:

API.

Purpose:

Returns the unique number identifying this color table.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns the unique number identifying this color table.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

This class' interface will change in future releases.

Member Function: TColorTable::operator=

const TColorTable & operator =(const TColorTable & source)

Interface Category:

API.

Purpose:

Assignment operator.

Calling Context:

Called when an object is assigned to another compatible object.

Parameters:

Return Value:

A non-const reference to the left-hand side object.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

This class' interface will change in future releases.

Member Function: TColorTable::operator==

bool operator ==(const TColorTable & source) const

Interface Category:

API.

Purpose:

Tests whether this TColorTable differs from the argument.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns true if the objects are equal.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

This class' interface will change in future releases.

Member Function: TColorTable::operator>>=

virtual TStream & operator >>=(TStream &) const

Interface Category:

API.

Purpose:

Stream-out operator.

Calling Context:

Called to stream out data.

Parameters:

Return Value:

Returns a reference to the stream the object streams itself out to.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

This class' interface will change in future releases.

Member Function: TColorTable::operator<<=

virtual TStream & operator <<= (TStream &)

Interface Category:

API.

Purpose:

Stream-in operator.

Calling Context:

Called to stream in data.

Parameters:

Return Value:

Returns a reference to the stream the object streams itself in from.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

This class' interface will change in future releases.

Member Function: TColorTable::TColorTable

  1. TColorTable ()
  2. TColorTable (const TColorTable & src)

Interface Category:

API.

Purpose:

  1. Default constructor.
  2. Copy constructor.

Calling Context:

  1. Called by the stream-in operators .
  2. Called to copy an object.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

This class' interface will change in future releases.

Member Function: TColorTable::UpdateSeed

void UpdateSeed ()

Interface Category:

API.

Purpose:

Bumps the unique number identifying this color table. Used when the color table's attributes change.

Calling Context:

Used internally when internal attributes change.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

This class' interface will change in future releases.

Member Function: TColorTable::GetClosestColorInTable

virtual void GetClosestColorInTable (const TColor & wantedColor, TColor & colorYouGot)

Interface Category:

API.

Purpose:

Searches the color table for the color that most closely matches the specified TColor and returns it.

Calling Context:

Call this function directly.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

This class' interface will change in future releases.
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.