Taxonomy Categories:
Member Functions:
Interface Category:
API.
Inherits From:
MCollectible
Inherited By:
TGrayColor
TCMYColor
TCMYKColor
THLSColor
THSVColor
THSVCompactColor
TLabColor
TLuvColor
TRGBColor
TRGBCompactColor
TXYZColor
TYIQColor
TYuvColor
TxyYColor
Purpose:
The color architecture is based on the premise that colors are either device-independent (calibrated) or device-dependent (non-calibrated). TColor is an interface-defining virtual abstract base class as well as a container class for colors. All colors must be constructed with a color profile. If no color profile is specified, a default is used (see TColorProfile). All colors must be type cast into an RGBColor and an XYZColor. Two pure virtual member functions (operator TRGBColor and operator TXYZColor) ensure that all color classes derived from TColor will support this functionality. Similarly, the pure virtual member function operator= ensures that objects derived from TColor are able to set themselves equal to a TColor.
TColor has an opacity field which varies between 0.0 and 1.0, but which is not strictly enforced. An opacity value of 1.0 means the color is purely opaque, and an opacity of 0.0 means the color is transparent.
Instantiation:
Do not allocate; abstract class.
Deriving Classes:
All color model classes are derived from TColor. Any class derived from TColor must override the three pure virtual member functions:
operator TRGBColor() const=0;
operator TXYZColor() const=0;
TColor& operator= (const TColor& source)=0;
In addition, you should probably: (1) provide a constructor that takes a const TColor&, (2) override TColor::FuzzyCompare, and (3) fulfill all of the base requirements of MCollectible.
Concurrency:
Multithread safe.
Resource Use:
No special requirements.
Member Function: TColor::GetOpacity
virtual GIntensity GetOpacity () const
Interface Category:
API.
Purpose:
Returns the opacity of this TColor.
Calling Context:
Call this function directly.
Parameters:
Return Value:
Returns a GIntensity that is the opacity of the color.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Multithread safe.
Other Considerations:
None.
Member Function: TColor::FuzzyCompare
bool FuzzyCompare (const TColor & aColor, float acceptableErrorPerComponentt =0.0001) const
Interface Category:
API.
Purpose:
Compares two TColors with reference to the specified tolerance. It takes the absolute difference between the components of the color and compares them to a known value.
Calling Context:
Call this function directly.
Parameters:
- const TColor & aColor -The color that is compared to this color.
- float acceptableErrorPerComponentt =0.0001 -The tolerance with which the two colors are compared.
Return Value:
Returns true if the component difference is less than the specified value; otherwise, false.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Multithread safe.
Other Considerations:
None.
Member Function: TColor::TemporaryTypeID
virtual TemporaryColorClassID TemporaryTypeID () const
Interface Category:
API.
Purpose:
Determines the type of color that the derived class of TColor represents.
Calling Context:
Call this function directly.
Parameters:
Return Value:
Returns the TemporaryColorClassID kColor.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Multithread safe.
Other Considerations:
None.
- TColor (const TColor & aColor)
- TColor ()
- TColor (TColorProfile * aColorProfile)
Interface Category:
API.
Purpose:
- Copy constructor.
- Default constructor.
- Creates a TColor from the specified profile and opacity.
Calling Context:
- Called to copy an object.
- Called by the stream-in operators and directly.
- Call this function directly.
Parameters:
- const TColor & aColor -The color to be copied.
- Takes no parameters.
- TColorProfile * aColorProfile -The profile of the new color.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Multithread safe.
Other Considerations:
None.
Member Function: TColor::operator<<=
virtual TStream & operator <<= (TStream &)
Interface Category:
API.
Purpose:
Stream-in operator.
Calling Context:
Called to stream in data.
Parameters:
- TStream & -The stream that the object's data is streamed in from.
Return Value:
Returns a reference to the stream the object streams itself in from.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Multithread safe.
Other Considerations:
None.
Member Function: TColor::operator>>=
virtual TStream & operator >>=(TStream &) const
Interface Category:
API.
Purpose:
Stream-out operator.
Calling Context:
Called to stream out data.
Parameters:
- TStream & -The stream that the object's data is streamed out to.
Return Value:
Returns a reference to the stream the object streams itself out to.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Multithread safe.
Other Considerations:
None.
Member Function: TColor::operator=
virtual TColor & operator =(const TColor & source)
Interface Category:
API.
Purpose:
Assignment operator.
Calling Context:
Called when an object is assigned to another compatible object.
Parameters:
- const TColor & source -The object to be copied.
Return Value:
A non-const reference to the left-hand side object.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Multithread safe.
Other Considerations:
None.
Member Function: TColor::operatorTXYZColor
virtual operator TXYZColor () const
Interface Category:
API.
Purpose:
Casts (converts) this TColor to a device-independent (calibrated) TXYZColor.
Calling Context:
Call this operator directly. Note that this applies only to concrete derived classes because this function is pure virtual.
Parameters:
Return Value:
The TXYZColor that corresponds to this color.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Multithread safe.
Other Considerations:
This is a pure virtual function.
Member Function: TColor::operatorTRGBColor
virtual operator TRGBColor () const
Interface Category:
API.
Purpose:
Casts (converts) this TColor to a device-independent (calibrated) TRGBColor.
Calling Context:
Call this operator directly. Note that this applies only to concrete derived classes because this function is pure virtual.
Parameters:
Return Value:
The TRGBColor that corresponds to this color.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Multithread safe.
Other Considerations:
This is a pure virtual function.
Member Function: TColor::SetColorProfile
virtual void SetColorProfile (TColorProfile * aColorProfile)
Interface Category:
API.
Purpose:
Sets the value of this TColor's color profile to the specified parameter.
Calling Context:
Call this function directly.
Parameters:
- TColorProfile * aColorProfile -The new color profile for this color.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Multithread safe.
Other Considerations:
None.
Member Function: TColor::GetColorProfile
virtual TColorProfile * GetColorProfile () const
Interface Category:
API.
Purpose:
Returns the color profile of this TColor.
Calling Context:
Call this function directly.
Parameters:
Return Value:
The color profile of this color.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Multithread safe.
Other Considerations:
None.
Member Function: TColor::GetClampedOpacity
virtual GIntensity GetClampedOpacity () const
Interface Category:
API.
Purpose:
Returns the opacity of this TColor and pins the value to the range 0.0 to 1.0.
Calling Context:
Call this function directly.
Parameters:
Return Value:
The clamped opacity.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Multithread safe.
Other Considerations:
None.
virtual ~ TColor ()
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:
Multithread safe.
Other Considerations:
None.
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.