Class: TxyYColor

Declaration: xyYColor.h

Taxonomy Categories:

Member Functions:


Interface Category:

API.

Inherits From:

TColor

Inherited By:

None.

Purpose:

The xyY color space is derived from TColor. The Y Tristimulus value corresponds to the definition of luminance normalized to equal-energy white E. That is, the color-matching function for Y is proportional to the relative luminous efficiency. It is also possible to completely specify color by using chromatic coordinates (x, y) and the luminance (Y). A TxyYColor with large values of x implies large amounts of red; a large value of y implies colors that are green. Small amounts of both x and y imply a bluish color. The class provides arithmetic operators that operate on two colors.

Instantiation:

Allocate on the heap or the stack.

Deriving Classes:

Derive new color models from TColor.

Concurrency:

Multithread safe.

Resource Use:

No special requirements.

Member Function: TxyYColor::TxyYColor

  1. TxyYColor ()
  2. TxyYColor (const TColor & aColor)
  3. TxyYColor (TColorProfile * theDeviceColorProfile)
  4. TxyYColor (TristimulusCoord ax, TristimulusCoord ay, TristimulusCoord aY, GIntensity opacity =1.0)
  5. TxyYColor (const TxyYColor & axyYColor)
  6. TxyYColor (TColorProfile * theDeviceColorProfile, TristimulusCoord ax, TristimulusCoord ay, TristimulusCoord aY, GIntensity opacity =1.0)

Interface Category:

API.

Purpose:

Default constructor; it has the default color profile, and color components are not initialized.
  1. Creates a TxyYColor from the specified TColor.
  2. Creates a TxyYColor with the specified color profile. The color components are not initialized.
  3. Constructs a TxyYColor with the specified components. It has a default color profile.
  4. Copy constructor.
  5. Construct a TxyYColor with the specified components and color profile.

Calling Context:

  1. Called by the stream-in operators. You can also call this function directly.
  2. Call this function directly.
  3. Call this function directly.
  4. Call this function directly.
  5. Called to copy an object. You can also call this function directly.
  6. Call this function directly.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Member Function: TxyYColor::GetComponents

void GetComponents (TristimulusCoord & ax, TristimulusCoord & ay, TristimulusCoord & aY, GIntensity & opacity) const

Interface Category:

API.

Purpose:

Gets the components of this TxyYColor and returns them in the specified parameters.

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: TxyYColor::GetClampedComponents

void GetClampedComponents (TristimulusCoord & ax, TristimulusCoord & ay, TristimulusCoord & aY, GIntensity & opacity) const

Interface Category:

API.

Purpose:

Gets the components of this TxyYColor clamped between 0.0 <= N <= 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: TxyYColor::Getx

TristimulusCoord Getx () const

Interface Category:

API.

Purpose:

Gets the x component of this TxyYColor.

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: TxyYColor::Gety

TristimulusCoord Gety () const

Interface Category:

API.

Purpose:

Gets the y component of this TxyYColor.

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: TxyYColor::GetY

TristimulusCoord GetY () const

Interface Category:

API.

Purpose:

Gets the Y component of this TxyYColor.

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: TxyYColor::GetColorDifference

GCoordinate GetColorDifference (const TxyYColor & aColor2) const

Interface Category:

API.

Purpose:

Calculates the color difference between this TxyYColor and the specified color. The color difference is defined as the sqrt( (x1-x2)^2+(y1-y2)^2+(Y1-Y2)^2 ).

Calling Context:

Call this function directly.

Parameters:

Return Value:

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: TxyYColor::SetComponents

void SetComponents (TristimulusCoord ax, TristimulusCoord ay, TristimulusCoord aY, GIntensity opacity =1.0)

Interface Category:

API.

Purpose:

Sets the components of this TxyYColor to the specified components.

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: TxyYColor::Sety

void Sety (TristimulusCoord ay)

Interface Category:

API.

Purpose:

Sets the y component of this TxyYColor to the specified value.

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: TxyYColor::SetY

void SetY (TristimulusCoord aY)

Interface Category:

API.

Purpose:

Sets the Y component of this TxyYColor to the specified value.

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: TxyYColor::operatorTRGBColor

virtual operator TRGBColor () const

Interface Category:

API.

Purpose:

Casts this TxyYColor 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: TxyYColor::operatorTXYZColor

virtual operator TXYZColor () const

Interface Category:

API.

Purpose:

Casts this TxyYColor 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:

None.

Member Function: TxyYColor::operator=

  1. TxyYColor & operator =(const TxyYColor & aSource)
  2. TColor & operator =(const TColor & aSource)

Interface Category:

API.

Purpose:

  1. Assignment operator.
  2. Assignment operator that casts the specified operand to a TxyYColor.

Calling Context:

  1. Called when an object is assigned to another compatible object.
  2. 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:

Multithread safe.

Other Considerations:

None.

Member Function: TxyYColor::operator+

  1. TxyYColor operator + (const TxyYColor & aColor2) const
  2. TxyYColor operator + (const float aScalar) const

Interface Category:

API.

Purpose:

  1. Adds the components of the two TxyYColors together.
  2. Adds a scalar to each component of this TxyYColor.

Calling Context:

  1. Call this operator directly.
  2. Call this operator directly.

Parameters:

Return Value:

  1. Returns a new color with the new components.
  2. 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: TxyYColor::operator-

  1. TxyYColor operator -(const TxyYColor & aColor2) const
  2. TxyYColor operator -(const float aScalar) const

Interface Category:

API.

Purpose:

  1. Subtracts the components of the specified color from the components of this TxyYColor.
  2. Subtracts the specified scalar from each component of this TxyYColor.

Calling Context:

  1. Call this operator directly.
  2. Call this operator directly.

Parameters:

Return Value:

  1. Returns a new color with the new components.
  2. 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: TxyYColor::operator*

  1. TxyYColor operator * (const float aScalar) const
  2. TxyYColor operator * (const TxyYColor & aColor2) const

Interface Category:

API.

Purpose:

  1. Multiplies each component of the TxyYColor by the specified scalar.
  2. Multiplies the components of this TxyYColor by the components of the specified color.

Calling Context:

  1. Call this operator directly.
  2. Call this operator directly.

Parameters:

Return Value:

  1. Returns a new color with the new components.
  2. 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: TxyYColor::operator/=

TxyYColor & operator /= (const float aScalar)

Interface Category:

API.

Purpose:

Divides the components of this TxyYColor by the specified scalar and assigns the new values to the respective components.

Calling Context:

Call this operator directly.

Parameters:

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: TxyYColor::operator+=

  1. TxyYColor & operator += (const float aScalar)
  2. TxyYColor & operator += (const TxyYColor & aColor2)

Interface Category:

API.

Purpose:

  1. Adds the specified scalar to the components of this TxyYColor and assigns the new values to the respective components.
  2. Adds the specified colors to the components of this TxyYColor and assigns the new values to the respective components.

Calling Context:

  1. Call this operator directly.
  2. Call this operator directly.

Parameters:

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: TxyYColor::operator-=

  1. TxyYColor & operator -=(const float aScalar)
  2. TxyYColor & operator -=(const TxyYColor & aColor2)

Interface Category:

API.

Purpose:

  1. Subtracts the specified scalar from the components of this TxyYColor and assigns the new values to the respective components.
  2. Subtracts the specified scalar from the components of this TxyYColor and assigns the new values to the respective components.

Calling Context:

  1. Call this operator directly.
  2. Call this operator directly.

Parameters:

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: TxyYColor::operator*=

TxyYColor & operator *= (const float aScalar)

Interface Category:

API.

Purpose:

Multiplies the components of this TxyYColor by the specified scalar and assigns the new values to the respective components.

Calling Context:

Call this operator directly.

Parameters:

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: TxyYColor::operator/

TxyYColor operator / (const float aScalar) const

Interface Category:

API.

Purpose:

Divides each component of this TxyYColor by the specified scalar.

Calling Context:

Call this operator directly.

Parameters:

Return Value:

Returns a 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: TxyYColor::FuzzyCompare

  1. bool FuzzyCompare (const TxyYColor & axyYColor, float acceptableErrorPerComponent =0.0001) const
  2. bool FuzzyCompare (const TxyYColor & axyYColor, float errOpacity, float errx, float erry, float errY) const

Interface Category:

API.

Purpose:

  1. Compares this TxyYColor 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 the tolerance.
  2. Compares this TxyYColor and the specified color with reference to the specified tolerance on a component by component level.

Calling Context:

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

Parameters:

Return Value:

  1. Returns true if the two colors are equal with reference to the specified tolerance.
  2. 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: TxyYColor::LinearInterpolate

void LinearInterpolate (const float aWeight, const TxyYColor & aColor2)

Interface Category:

API.

Purpose:

Makes a weighted linear interpolation of each component of this TxyYColor. The interpolation is returned in this color. The interpolation that is done for each component is (using Y as an example) given by Y1 =Y1 + (Y2 -Y1) * Weight.

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: TxyYColor::AddAndPin

void AddAndPin (const TxyYColor & aColor2)

Interface Category:

API.

Purpose:

Adds the specified color to this TxyYColor 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: TxyYColor::SubtractAndPin

void SubtractAndPin (const TxyYColor & aColor2)

Interface Category:

API.

Purpose:

Subtracts the specified color from this TxyYColor 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: TxyYColor::Maximum

void Maximum (const TxyYColor & aColor2)

Interface Category:

API.

Purpose:

Determines the maximum of individual components of this TxyYColor and the specified color. It sets the components of this color to the resulting maximum values.

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: TxyYColor::Minimum

void Minimum (const TxyYColor & aColor2)

Interface Category:

API.

Purpose:

Determines the minimum of individual components of this TxyYColor and the specified color. It sets the components of this color to the resulting minimum values.

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: TxyYColor::Blend

void Blend (const TxyYColor & aColor2)

Interface Category:

API.

Purpose:

Averages the individual components of this TxyYColor and the specified color. It sets the components of this color to the resulting blend.

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: TxyYColor::Invert

void Invert ()

Interface Category:

API.

Purpose:

Inverts this TxyYColor.

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: TxyYColor::Clamp

void Clamp ()

Interface Category:

API.

Purpose:

Clamps the components of this TxyYColor between 0.0 <= N <= 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: TxyYColor::Scale

void Scale ()

Interface Category:

API.

Purpose:

Scales this TxyYColor 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: TxyYColor::TemporaryTypeID

virtual TemporaryColorClassID TemporaryTypeID () const

Interface Category:

API.

Purpose:

Determines the type of color that the derived class of TxyYColor represents.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns TColor::kxyYColor.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TxyYColor::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:

Multithread safe.

Other Considerations:

None.

Member Function: TxyYColor::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:

Multithread safe.

Other Considerations:

None.

Member Function: TxyYColor::Setx

void Setx (TristimulusCoord ax)

Interface Category:

API.

Purpose:

Sets the x component of the TxyYColor to the specified value.

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: TxyYColor::~TxyYColor

virtual ~ TxyYColor ()

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: TxyYColor::ClampOpacity

void ClampOpacity ()

Interface Category:

API.

Purpose:

Pins the opacity of this TxyYColor 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: TxyYColor::SetOpacity

void SetOpacity (GIntensity opacity =1.0)

Interface Category:

API.

Purpose:

Sets the opacity of this TxyYColor to the specified value.

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: TxyYColor::GetClampedOpacity

GIntensity GetClampedOpacity () const

Interface Category:

API.

Purpose:

Returns the opacity of this TxyYColor 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: TxyYColor::GetOpacity

GIntensity GetOpacity () const

Interface Category:

API.

Purpose:

Returns the opacity of this TxyYColor.

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.