![](../../Home/Icons/Home.gif)
![](../icons/UpCNM.gif)
![](../icons/CNMContext.gif)
![](../../Home/Icons/Search.gif)
Taxonomy Categories:
Member Functions:
Interface Category:
API.
Inherits From:
TColor
Inherited By:
None.
Purpose:
TXYZColor, derived from TColor, defines a tristimulus device-independent color space (in other words, a calibrated color space) whose values are standardized internationally by the CIE (Commission Internationale de l'Eclairage). A TXYZColor is absolute in the sense that its tristimulus coordinates (X, Y, and Z) uniquely define a color. The X, Y, and Z primaries can be used to represent all visible colors. TXYZColors is one of the cornerstones for the color architecture, because every color that is derived from TColor must be able to convert itself to a TXYZColor. Note that although TXYZColors are useful for color reproduction, they are not very good for evaluating relative change in color. The TXYZColor space is perceptually nonlinear.
The class provides arithmetic operators that operate on two colors.
Instantiation:
Allocate on the heap or the stack.
Deriving Classes:
TSpectralColor is provided. Derive new color models from TColor.
Concurrency:
Multithread safe.
Resource Use:
No special requirements.
- TXYZColor ()
- TXYZColor (TColorProfile * theDeviceColorProfile)
- TXYZColor (TristimulusCoord aX, TristimulusCoord aY, TristimulusCoord aZ, GIntensity opacity =1.0)
- TXYZColor (const TXYZColor & aXYZColor)
- TXYZColor (TColorProfile * theDeviceColorProfile, TristimulusCoord aX, TristimulusCoord aY, TristimulusCoord aZ, GIntensity opacity =1.0)
Interface Category:
API.
Purpose:
- Default constructor; it has the default color profile, and color components are not initialized.
- Creates a XYZColor with the specified color profile. The color components are not initialized.
- Creates a XYZColor with the specified components. It has the default color profile.
- Copy constructor.
- Creates a XYZColor with the specified components and color profile.
Calling Context:
- Called by the stream-in operators. You can also call this function directly.
- Call this function directly.
- Call this function directly.
- Called to copy an object. You can also call this function directly.
- Call this function directly.
Parameters:
- Takes no parameters.
- TColorProfile * theDeviceColorProfile -The color profile for the new color.
- TristimulusCoord aX -The X component of the new color.
- TristimulusCoord aY -The Y component of the new color.
- TristimulusCoord aZ -The Z component of the new color.
- GIntensity opacity =1.0 -The opacity of the new color.
- const TXYZColor & aXYZColor -The color to be copied.
- TColorProfile * theDeviceColorProfile -The color profile for the new color.
- TristimulusCoord aX -The X component of the new color.
- TristimulusCoord aY -The Y component of the new color.
- TristimulusCoord aZ -The Z component of the new color.
- GIntensity opacity =1.0 -The opacity of the new color.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Multithread safe.
Other Considerations:
None.
Member Function: TXYZColor::GetComponents
void GetComponents (TristimulusCoord & aX, TristimulusCoord & aY, TristimulusCoord & aZ, GIntensity & opacity) const
Interface Category:
API.
Purpose:
Gets the X, Y, and Z components of this TXYZColor and returns them in the specified parameters.
Calling Context:
Call this function directly.
Parameters:
- TristimulusCoord & aX -The X component of this color.
- TristimulusCoord & aY -The Y component of this color.
- TristimulusCoord & aZ -The Z component of this color.
- GIntensity & opacity -The opacity of this color.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Multithread safe.
Other Considerations:
None.
Member Function: TXYZColor::GetClampedComponents
void GetClampedComponents (TristimulusCoord & aX, TristimulusCoord & aY, TristimulusCoord & aZ, GIntensity & opacity) const
Interface Category:
API.
Purpose:
Gets the components of this TXYZColor clamped between 0.0 <= N <= 1.0.
Calling Context:
Call this function directly.
Parameters:
- TristimulusCoord & aX -The clamped X component of this color.
- TristimulusCoord & aY -The clamped Y component of this color.
- TristimulusCoord & aZ -The clamped Z component of this color.
- GIntensity & opacity -The clamped opacity of this color.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Multithread safe.
Other Considerations:
None.
Member Function: TXYZColor::GetX
TristimulusCoord GetX () const
Interface Category:
API.
Purpose:
Gets the X component of this TXYZColor.
Calling Context:
Call this function directly.
Parameters:
Return Value:
Returns the X component of the color.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Multithread safe.
Other Considerations:
None.
Member Function: TXYZColor::GetY
TristimulusCoord GetY () const
Interface Category:
API.
Purpose:
Returns the Y component of this TXYZColor.
Calling Context:
Call this function directly.
Parameters:
Return Value:
Returns the Y component of the color.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Multithread safe.
Other Considerations:
None.
Member Function: TXYZColor::GetZ
TristimulusCoord GetZ () const
Interface Category:
API.
Purpose:
Returns the Z component of this TXYZColor.
Calling Context:
Call this function directly.
Parameters:
Return Value:
Returns the Z component of the color.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Multithread safe.
Other Considerations:
None.
Member Function: TXYZColor::GetColorDifference
GCoordinate GetColorDifference (const TXYZColor & aColor2) const
Interface Category:
API.
Purpose:
Calculates the color difference between this TXYZColor and the specified one. The color difference is defined as the sqrt( (X1-X2)^2+(Y1-Y2)^2+(Z1-Z2)^2 ).
Calling Context:
Call this function directly.
Parameters:
- const TXYZColor & aColor2 -The color with which the difference is computed.
Return Value:
Returns the value of the color difference between the two colors.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Multithread safe.
Other Considerations:
None.
Member Function: TXYZColor::SetComponents
void SetComponents (TristimulusCoord aX, TristimulusCoord aY, TristimulusCoord aZ, GIntensity opacity =1.0)
Interface Category:
API.
Purpose:
Sets the components of this TXYZColor to the specified parameters.
Calling Context:
Call this function directly.
Parameters:
- TristimulusCoord aX -The new value for the X component.
- TristimulusCoord aY -The new value for the Y component.
- TristimulusCoord aZ -The new value for the Z component.
- GIntensity opacity =1.0 -The new value for the opacity.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Multithread safe.
Other Considerations:
None.
Member Function: TXYZColor::SetY
void SetY (TristimulusCoord aY)
Interface Category:
API.
Purpose:
Sets the Y component of this TXYZColor.
Calling Context:
Call this function directly.
Parameters:
- TristimulusCoord aY -The new value for the Y component.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Multithread safe.
Other Considerations:
None.
Member Function: TXYZColor::SetZ
void SetZ (TristimulusCoord aZ)
Interface Category:
API.
Purpose:
Sets the Z component of this TXYZColor.
Calling Context:
Call this function directly.
Parameters:
- TristimulusCoord aZ -The new value for the Z component.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Multithread safe.
Other Considerations:
None.
Member Function: TXYZColor::operatorTRGBColor
virtual operator TRGBColor () const
Interface Category:
API.
Purpose:
Casts this TXYZColor to a TRGBColor.
Calling Context:
Call this function directly.
Parameters:
Return Value:
Returns a TRGBColor that corresponds to this color.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Multithread safe.
Other Considerations:
None.
Member Function: TXYZColor::operatorTXYZColor
virtual operator TXYZColor () const
Interface Category:
API.
Purpose:
Casts this TXYZColor to a TXYZColor.
Calling Context:
Call this function directly.
Parameters:
Return Value:
Returns a TXYZColor that corresponds to this color.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Multithread safe.
Other Considerations:
Not strictly useful, but necessary for orthogonality.
Member Function: TXYZColor::operator=
- TXYZColor & operator =(const TXYZColor & aSource)
- TColor & operator =(const TColor & aSource)
Interface Category:
API.
Purpose:
- Assignment operator.
- Assignment operator that casts the specified operand to a TXYZColor.
Calling Context:
- Called when an object is assigned to another compatible object.
- Called when an object is assigned to another compatible object.
Parameters:
- const TXYZColor & aSource -The object to be copied.
- const TColor & aSource -The object to be converted and 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: TXYZColor::operator+
- TXYZColor operator + (const TXYZColor & aColor2) const
- TXYZColor operator + (const float aScalar) const
Interface Category:
API.
Purpose:
- Adds the components of the two TXYZColors together.
- Adds the specified scalar to each component of this TXYZColor.
Calling Context:
- Call this operator directly.
- Call this operator directly.
Parameters:
- const TXYZColor & aColor2 -The color to be added to this one.
- const float aScalar -The scalar to be added to each component of this color.
Return Value:
- Returns a new color with the new components.
- Returns a new color with the new components.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Multithread safe.
Other Considerations:
The values of the components are not clamped to the range 0.0 <= N <= 1.0.
Member Function: TXYZColor::operator-
- TXYZColor operator -(const TXYZColor & aColor2) const
- TXYZColor operator -(const float aScalar) const
Interface Category:
API.
Purpose:
- Subtracts the components of the specified color from this TXYZColor.
- Subtracts the specified scalar from each component of this TXYZColor.
Calling Context:
- Call this operator directly.
- Call this operator directly.
Parameters:
- const TXYZColor & aColor2 -The subtrahend.
- const float aScalar -The subtrahend.
Return Value:
- Returns a new color with the new components.
- Returns a new color with the new components.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Multithread safe.
Other Considerations:
The values of the components are not clamped to the range 0.0 <= N <= 1.0.
Member Function: TXYZColor::operator*
- TXYZColor operator * (const float aScalar) const
- TXYZColor operator * (const TXYZColor & aColor2) const
Interface Category:
API.
Purpose:
- Multiplies each component of this TXYZColor by the specified scalar.
- Multiplies the components of this TXYZColor by the components of the specified color.
Calling Context:
- Call this operator directly.
- Call this operator directly.
Parameters:
- const float aScalar -The multiplier.
- const TXYZColor & aColor2 -The multiplier.
Return Value:
- Returns a new color with the new components.
- Returns a new color with the new components.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Multithread safe.
Other Considerations:
The values of the components are not clamped to the range 0.0 <= N <= 1.0.
Member Function: TXYZColor::operator/=
TXYZColor & operator /= (const float aScalar)
Interface Category:
API.
Purpose:
Divides the components of this TXYZColor by the specified scalar and assigns the new values to the respective components.
Calling Context:
Call this operator directly.
Parameters:
- const float aScalar -The divisor.
Return Value:
Returns this color with the new components.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Multithread safe.
Other Considerations:
The color's opacity is set to 1.0.
Member Function: TXYZColor::operator+=
- TXYZColor & operator += (const float aScalar)
- TXYZColor & operator += (const TXYZColor & aColor2)
Interface Category:
API.
Purpose:
- Adds the specified scalar to the components of this TXYZColor and assigns the new values to the respective components.
- Adds the specified colors to the components of this TXYZColor and assigns the new values to the respective components.
Calling Context:
- Call this operator directly.
- Call this operator directly.
Parameters:
- const float aScalar -The number to be added to this color.
- const TXYZColor & aColor2 -The color to be added to this one.
Return Value:
- Returns this color with the new components.
- Returns this color with the new components.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Multithread safe.
Other Considerations:
The color's opacity is set to 1.0.
Member Function: TXYZColor::operator-=
- TXYZColor & operator -=(const float aScalar)
- TXYZColor & operator -=(const TXYZColor & aColor2)
Interface Category:
API.
Purpose:
- Subtracts the specified scalar from the components of this TXYZColor and assigns the new values to the respective components.
- Subtracts the specified scalar from the components of this TXYZColor and assigns the new values to the respective components.
Calling Context:
- Call this operator directly.
- Call this operator directly.
Parameters:
- const float aScalar -The subtrahend.
- const TXYZColor & aColor2 -The subtrahend.
Return Value:
- Returns this color with the new components.
- Returns this color with the new components.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Multithread safe.
Other Considerations:
The color's opacity is set to 1.0.
Member Function: TXYZColor::operator*=
TXYZColor & operator *= (const float aScalar)
Interface Category:
API.
Purpose:
Multiplies the components of this TXYZColor by the specified scalar and assigns the new values to the respective components.
Calling Context:
Call this operator directly.
Parameters:
- const float aScalar -The multiplier.
Return Value:
Returns this color with the new components.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Multithread safe.
Other Considerations:
The color's opacity is set to 1.0.
Member Function: TXYZColor::operator/
TXYZColor operator / (const float aScalar) const
Interface Category:
API.
Purpose:
Divides each component of this TXYZColor by the specified scalar.
Calling Context:
Call this operator directly.
Parameters:
- const float aScalar -The divisor.
Return Value:
Returns a color with the new components.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Multithread safe.
Other Considerations:
None.
Member Function: TXYZColor::FuzzyCompare
- bool FuzzyCompare (const TXYZColor & aXYZColor, float acceptableErrorPerComponent =0.0001) const
- bool FuzzyCompare (const TXYZColor & aXYZColor, float errOpacity, float errX, float errY, float errZ) const
Interface Category:
API.
Purpose:
- Compares this TXYZColor and the specified color with reference to the specified tolerance. It takes the absolute difference between the components of the color and compares them to a known value.
- Compares this TXYZColor and the specified color to a given accuracy on a component by component level.
Calling Context:
- Call this function directly.
- Call this function directly.
Parameters:
- const TXYZColor & aXYZColor -The color that is compared to this color.
- float acceptableErrorPerComponent =0.0001 -The tolerance with which the two colors are compared.
- const TXYZColor & aXYZColor -The that is compared to this color.
- float errOpacity -The tolerance with which the opacities of the two colors are compared.
- float errX -The tolerance with which the X components of the two colors are compared.
- float errY -The tolerance with which the Y components of the two colors are compared.
- float errZ -The tolerance with which the Z components of the two colors are compared.
Return Value:
- Returns true if the two colors are equal with reference to the specified tolerance.
- Returns true if the two colors are equal with reference to the specified tolerance.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Multithread safe.
Other Considerations:
None.
Member Function: TXYZColor::LinearInterpolate
void LinearInterpolate (const float aWeight, const TXYZColor & aColor2)
Interface Category:
API.
Purpose:
Makes a weighted linear interpolation of each component of this TXYZColor. The interpolation is returned in this color.
The interpolation that is done for each component is (using X as an example) given by X1 =X1 + (X2 -X1) * Weight.
Calling Context:
Call this function directly.
Parameters:
- const float aWeight -The weight to use.
- const TXYZColor & aColor2 -The color to be interpolated with this one.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Multithread safe.
Other Considerations:
The color's opacity is set to 1.0.
Member Function: TXYZColor::AddAndPin
void AddAndPin (const TXYZColor & aColor2)
Interface Category:
API.
Purpose:
Adds the specified color to this TXYZColor and then clamps the resulting values of the components.
Calling Context:
Call this function directly.
Parameters:
- const TXYZColor & aColor2 -The color to be added to this one.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Multithread safe.
Other Considerations:
The color's opacity is set to 1.0.
Member Function: TXYZColor::SubtractAndPin
void SubtractAndPin (const TXYZColor & aColor2)
Interface Category:
API.
Purpose:
Subtracts the specified color from this TXYZColor and then clamps the resulting values of the components.
Calling Context:
Call this function directly.
Parameters:
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Multithread safe.
Other Considerations:
The color's opacity is set to 1.0.
Member Function: TXYZColor::Maximum
void Maximum (const TXYZColor & aColor2)
Interface Category:
API.
Purpose:
Determines the maximum of individual components of this TXYZColor and the specified color. It sets the components of this color to the resulting maximum values.
Calling Context:
Call this function directly.
Parameters:
- const TXYZColor & aColor2 -The color whose components are compared with this one.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Multithread safe.
Other Considerations:
The color's opacity is set to 1.0.
Member Function: TXYZColor::Minimum
void Minimum (const TXYZColor & aColor2)
Interface Category:
API.
Purpose:
Determines the minimum of individual components of this TXYZColor and the specified color. It sets the components of this color to the resulting minimum values.
Calling Context:
Call this function directly.
Parameters:
- const TXYZColor & aColor2 -The color whose components are compared with this one.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Multithread safe.
Other Considerations:
The color's opacity is set to 1.0.
Member Function: TXYZColor::Blend
void Blend (const TXYZColor & aColor2)
Interface Category:
API.
Purpose:
Averages the individual components of the two colors and returns them in this TXYZColor.
Calling Context:
Call this function directly.
Parameters:
- const TXYZColor & aColor2 -The color whose components are blended with this one.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Multithread safe.
Other Considerations:
The color's opacity is set to 1.0.
Member Function: TXYZColor::Invert
void Invert ()
Interface Category:
API.
Purpose:
Inverts this TXYZColor.
Calling Context:
Call this function directly.
Parameters:
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Multithread safe.
Other Considerations:
The color's opacity is set to 1.0.
Member Function: TXYZColor::Clamp
void Clamp ()
Interface Category:
API.
Purpose:
Clamps the components of this TXYZColor between 0.0 <= N <= 1.0. If a value is less than 0.0, it is set to 0.0, and if it is greater than 1.0, it is set to 1.0.
Calling Context:
Call this function directly.
Parameters:
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Multithread safe.
Other Considerations:
The color's opacity is set to 1.0.
Member Function: TXYZColor::Scale
void Scale ()
Interface Category:
API.
Purpose:
Scales this TXYZColor to 1.0. If all of the color's components are between 0.0 <= N <= 1.0, the color is untouched. If there are components with values greater than 1.0, then the largest component is used to renormalize the color.
If any of the color's components are less than 0.0, they set to 0.0.
Calling Context:
Call this function directly.
Parameters:
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Multithread safe.
Other Considerations:
The color's opacity is set to 1.0.
Member Function: TXYZColor::TemporaryTypeID
virtual TemporaryColorClassID TemporaryTypeID () const
Interface Category:
API.
Purpose:
Determines the type of color that the derived class of TXYZColor represents.
Calling Context:
Call this function directly.
Parameters:
Return Value:
Returns TColor::kXYZColor.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Multithread safe.
Other Considerations:
None.
Member Function: TXYZColor::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: TXYZColor::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: TXYZColor::SetX
void SetX (TristimulusCoord aX)
Interface Category:
API.
Purpose:
Sets the X component of this TXYZColor to the specified value.
Calling Context:
Call this function directly.
Parameters:
- TristimulusCoord aX -The new value for the X component.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Multithread safe.
Other Considerations:
None.
virtual ~ TXYZColor ()
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.
Member Function: TXYZColor::ClampOpacity
void ClampOpacity ()
Interface Category:
API.
Purpose:
Pins the opacity of this TXYZColor to the range 0.0 to 1.0.
Calling Context:
Call this function directly.
Parameters:
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Multithread safe.
Other Considerations:
None.
Member Function: TXYZColor::SetOpacity
void SetOpacity (GIntensity opacity =1.0)
Interface Category:
API.
Purpose:
Sets the opacity of this TXYZColor to the specified value.
Calling Context:
Call this function directly.
Parameters:
- GIntensity opacity =1.0 -The new value for the opacity.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Multithread safe.
Other Considerations:
None.
Member Function: TXYZColor::GetClampedOpacity
GIntensity GetClampedOpacity () const
Interface Category:
API.
Purpose:
Returns the opacity of this TXYZColor 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.
Member Function: TXYZColor::GetOpacity
GIntensity GetOpacity () const
Interface Category:
API.
Purpose:
Returns the opacity of this TXYZColor.
Calling Context:
Call this function directly.
Parameters:
Return Value:
The opacity that can be outside the range 0.0 to 1.0.
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.