Taxonomy Categories:
Member Functions:
Interface Category:
API.
Inherits From:
TColor
Inherited By:
None.
Purpose:
THSVCompactColor is derived from TColor. The HSV (hue, saturation, value) color model, also sometimes called HSB (with B standing for brightness), is defined in relation to the artistic concepts of tint, shade, and tone. The HSV model forms a hexcone in 3-D space. A value for V of 255 corresponds to relatively bright colors. The H-coordinate (hue) is measured by the angle around the V-axis. H =0 is red, 120 degrees is green, and so forth. You can obtain a color's complement by adding 180 degrees to the H value. Because hue ranges from 0 to 255, a hue value of zero corresponds to zero degrees while a hue value of 255 corresponds to 360 degrees. Therefore, hue is defined in units of 360/256 degrees. The saturation value S is defined as a ratio ranging between 0 and 255. Saturation is measured relative to the color gamut. The HSV color model is uncalibrated; therefore, HSV colors must be defined with respect to a particular color device through a color profile.
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.
Other Considerations:
None.
- THSVCompactColor ()
- THSVCompactColor (const TColor & aColor)
- THSVCompactColor (TColorProfile * theDeviceColorProfile)
- THSVCompactColor (CharIntensity aHue, CharIntensity aSaturation, CharIntensity aValue, CharIntensity opacity =255)
- THSVCompactColor (const THSVCompactColor & aHSVCompactColor)
- THSVCompactColor (TColorProfile * theDeviceColorProfile, CharIntensity aHue, CharIntensity aSaturation, CharIntensity aValue, CharIntensity opacity =255)
Interface Category:
API.
Purpose:
- Default constructor; it has the default color profile, and color components are not initialized.
- Creates a THSVCompactColor from a TColor.
- Creates a THSVCompactColor with the specified color profile. The color components are not initialized.
- Creates a THSVCompactColor with the specified components. It has the default color profile.
- Copy constructor.
- Creates a THSVCompactColor with the specified components and color profile.
Calling Context:
- Called by the stream-in operators, and can be called directly.
- Call this function directly.
- Call this function directly.
- Call this function directly.
- Called to copy an object, and directly.
- Call this function directly.
Parameters:
- Takes no parameters.
- const TColor & aColor -The color to be copied.
- TColorProfile * theDeviceColorProfile -The color profile for the new color.
- CharIntensity aHue -The hue component of the new color.
- CharIntensity aSaturation -The saturation component of the new color.
- CharIntensity aValue -The value component of the new color.
- CharIntensity opacity =255 -The opacity of the new color.
- const THSVCompactColor & aHSVCompactColor -The color to be copied.
- TColorProfile * theDeviceColorProfile -The color profile for the new color.
- CharIntensity aHue -The hue component of the new color.
- CharIntensity aSaturation -The saturation component of the new color.
- CharIntensity aValue -The value component of the new color.
- CharIntensity opacity =255 -The opacity of the new color.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Multithread safe.
Other Considerations:
None.
virtual ~ THSVCompactColor ()
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.
void GetComponents (CharIntensity & aHue, CharIntensity & aSaturation, CharIntensity & aValue, CharIntensity & opacity) const
Interface Category:
API.
Purpose:
Gets the components of the THSVCompactColor.
Calling Context:
Call this function directly.
Parameters:
- CharIntensity & aHue -The hue component of this color.
- CharIntensity & aSaturation -The saturation component of this color.
- CharIntensity & aValue -The value component of this color.
- CharIntensity & 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: THSVCompactColor::GetClampedComponents
void GetClampedComponents (CharIntensity & aHue, CharIntensity & aSaturation, CharIntensity & aValue, CharIntensity & opacity) const
Interface Category:
API.
Purpose:
Gets the components of this THSVCompactColor clamped between 0 <= N <= 255.
Calling Context:
Call this function directly.
Parameters:
- CharIntensity & aHue -The clamped hue component of this color.
- CharIntensity & aSaturation -The clamped saturation component of this color.
- CharIntensity & aValue -The clamped value component of this color.
- CharIntensity & opacity -The clamped opacity of this color.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Multithread safe.
Other Considerations:
None.
CharIntensity GetHue () const
Interface Category:
API.
Purpose:
Gets the hue component of this THSVCompactColor.
Calling Context:
Call this function directly.
Parameters:
Return Value:
Returns the hue component of the color.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Multithread safe.
Other Considerations:
None.
CharIntensity GetSaturation () const
Interface Category:
API.
Purpose:
Gets the saturation component of this THSVCompactColor.
Calling Context:
Call this function directly.
Parameters:
Return Value:
Returns the saturation component of the color.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Multithread safe.
Other Considerations:
None.
CharIntensity GetValue () const
Interface Category:
API.
Purpose:
Gets the value component of this THSVCompactColor.
Calling Context:
Call this function directly.
Parameters:
Return Value:
Returns the value component of the color.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Multithread safe.
Other Considerations:
None.
GIntensity GetOpacity () const
Interface Category:
API.
Purpose:
Gets the opacity of this THSVCompactColor.
Calling Context:
Call this function directly.
Parameters:
Return Value:
Returns the opacity of the color.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Multithread safe.
Other Considerations:
None.
Member Function: THSVCompactColor::GetColorDifference
float GetColorDifference (const THSVCompactColor & aColor2) const
Interface Category:
API.
Purpose:
Calculates the color difference between this THSVCompactColor and the specified one. The color difference is defined as the sqrt( (H1-H2)^2+(S1-S2)^2+(V1-V2)^2 ).
Calling Context:
Call this function directly.
Parameters:
- const THSVCompactColor & aColor2 -The color with which the difference is computed.
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.
void SetComponents (CharIntensity aHue, CharIntensity aSaturation, CharIntensity aValue, CharIntensity opacity =255)
Interface Category:
API.
Purpose:
Sets the components of this THSVCompactColor with the specified values.
Calling Context:
Call this function directly.
Parameters:
- CharIntensity aHue -The new value for the hue component.
- CharIntensity aSaturation -The new value for the saturation component.
- CharIntensity aValue -The new value for the value component.
- CharIntensity opacity =255 -The new value for the opacity.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Multithread safe.
Other Considerations:
None.
void SetHue (CharIntensity aHue)
Interface Category:
API.
Purpose:
Sets the hue component of this THSVCompactColor.
Calling Context:
Call this function directly.
Parameters:
- CharIntensity aHue -The new value for the hue component.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Multithread safe.
Other Considerations:
None.
void SetSaturation (CharIntensity aSaturation)
Interface Category:
API.
Purpose:
Sets the saturation component of this THSVCompactColor.
Calling Context:
Call this function directly.
Parameters:
- CharIntensity aSaturation -The new value for the saturation component.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Multithread safe.
Other Considerations:
None.
void SetValue (CharIntensity aValue)
Interface Category:
API.
Purpose:
Sets the value component of this THSVCompactColor.
Calling Context:
Call this function directly.
Parameters:
- CharIntensity aValue -The new value for the value component.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Multithread safe.
Other Considerations:
None.
void SetOpacity (CharIntensity opacity =255)
Interface Category:
API.
Purpose:
Sets the opacity of this THSVCompactColor.
Calling Context:
Call this function directly.
Parameters:
- CharIntensity opacity -The new value for the opacity.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Multithread safe.
Other Considerations:
None.
void ClampOpacity ()
Interface Category:
API.
Purpose:
Pins the opacity of this THSVCompactColor to the range 0 <= N <= 255.
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: THSVCompactColor::GetClampedOpacity
GIntensity GetClampedOpacity () const
Interface Category:
API.
Purpose:
Returns the opacity of this THSVCompactColor and pins the value to the range 0 <= N <= 255.
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: THSVCompactColor::operatorTRGBColor
virtual operator TRGBColor () const
Interface Category:
API.
Purpose:
Casts this THSVCompactColor to a TRGBColor.
Calling Context:
Call this operator directly.
Parameters:
Return Value:
Returns an RGBColor that corresponds with this color.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Multithread safe.
Other Considerations:
None.
Member Function: THSVCompactColor::operatorTXYZColor
virtual operator TXYZColor () const
Interface Category:
API.
Purpose:
Casts this THSVCompactColor to a TXYZColor.
Calling Context:
Call this operator directly.
Parameters:
Return Value:
Returns a XYZColor that corresponds with this color.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Multithread safe.
Other Considerations:
None.
- THSVCompactColor & operator =(const THSVCompactColor & aSource)
- TColor & operator =(const TColor & aSource)
Interface Category:
API.
Purpose:
- Assignment operator.
- Assignment operator that casts the specified operand to a THSVCompactColor.
Calling Context:
- Called when an object is assigned to another compatible object.
- Called when a TColor object is assigned to a THSVCompactColor object.
Parameters:
- const THSVCompactColor & 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.
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 streams itself 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.
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 streams itself 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.
- THSVCompactColor operator + (const THSVCompactColor & aColor2) const
- THSVCompactColor operator + (const float aScalar) const
Interface Category:
API.
Purpose:
- Adds the components of the two THLSColors together.
- Adds the specified scalar to each component of this THSVCompactColor.
Calling Context:
- Call this operator directly.
- Call this operator directly.
Parameters:
- const THSVCompactColor & 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:
None.
- THSVCompactColor operator -(const THSVCompactColor & aColor2) const
- THSVCompactColor operator -(const float aScalar) const
Interface Category:
API.
Purpose:
- Subtracts the components of the specified color from this THSVCompactColor.
- Subtracts the specified scalar from each component of this THSVCompactColor.
Calling Context:
- Call this operator directly.
- Call this operator directly.
Parameters:
- const THSVCompactColor & aColor2 -The subtrahend.
- const float aScalar -The scalar 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:
None.
- THSVCompactColor operator * (const THSVCompactColor & aColor2) const
- THSVCompactColor operator * (const float aScalar) const
Interface Category:
API.
Purpose:
- Multiplies the components of this THSVCompactColor by the components of the specified color.
- Multiplies each component of this THSVCompactColor by the specified scalar.
Calling Context:
- Call this operator directly.
- Call this operator directly.
Parameters:
- const THSVCompactColor & aColor2 -The multiplier.
- const float aScalar -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 <= N <= 255.
THSVCompactColor operator / (const float aScalar) const
Interface Category:
API.
Purpose:
Divides the components of this THSVCompactColor by the specified scalar.
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:
None.
- THSVCompactColor & operator += (const float aScalar)
- THSVCompactColor & operator += (const THSVCompactColor & aColor2)
Interface Category:
API.
Purpose:
- Adds the specified scalar to the components of this THSVCompactColor and assigns the new values to the respective components.
- Adds the specified colors to the components of this THSVCompactColor 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 THSVCompactColor & aColor2 -The color to be added to this color.
Return Value:
Returns this color with the new components.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Multithread safe.
Other Considerations:
None.
- THSVCompactColor & operator -=(const float aScalar)
- THSVCompactColor & operator -=(const THSVCompactColor & aColor2)
Interface Category:
API.
Purpose:
- Subtracts the specified scalar from the components of this THSVCompactColor and assigns the new values to the respective components.
- Subtracts the specified scalar from the components of this THSVCompactColor 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 THSVCompactColor & 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:
None.
THSVCompactColor & operator *= (const float aScalar)
Interface Category:
API.
Purpose:
Multiplies the components of this THSVCompactColor 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:
This function sets the opacity value to 255.
THSVCompactColor & operator /= (const float aScalar)
Interface Category:
API.
Purpose:
Divides the components of this THSVCompactColor 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:
This function sets the opacity value to 255.
- bool FuzzyCompare (const THSVCompactColor & aHSVCompactColor, float acceptableErrorPerComponent =0.0001) const
- bool FuzzyCompare (const THSVCompactColor & aHSVCompactColor, float errOpacity, float errHue, float errSaturation, float errValue) const
Interface Category:
API.
Purpose:
- Compares this THSVCompactColor 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 THSVCompactColor 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 THSVCompactColor & aHSVCompactColor -The color that is compared to this color.
- float acceptableErrorPerComponent =0.0001 -The tolerance with which the two colors are compared.
- const THSVCompactColor & aHSVCompactColor -The color that is compared to this color.
- float errOpacity -The tolerance with which the opacities of the two colors are compared.
- float errHue -The tolerance with which the hue components of the two colors are compared.
- float errSaturation -The tolerance with which the saturation components of the two colors are compared.
- float errValue -The tolerance with which the value components of the two colors are compared.
Return Value:
- Returns true if the two colors are equal within the specified tolerance.
- Returns true if the two colors are equal within the specified tolerance.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Multithread safe.
Other Considerations:
None.
Member Function: THSVCompactColor::LinearInterpolate
void LinearInterpolate (const float aWeight, const THSVCompactColor & aColor2)
Interface Category:
API.
Purpose:
Makes a weighted linear interpolation of each component of this THSVCompactColor. The interpolation is returned in this color.
The interpolation that is done for each component is (using hue as an example) given by hue1 =hue1 + (hue2 -hue1) * aWeight.
Calling Context:
Call this function directly.
Parameters:
- const float aWeight -The weight to use.
- const THSVCompactColor & 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:
None.
void AddAndPin (const THSVCompactColor & aColor2)
Interface Category:
API.
Purpose:
Adds the specified color to this THSVCompactColor 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:
None.
Member Function: THSVCompactColor::SubtractAndPin
void SubtractAndPin (const THSVCompactColor & aColor2)
Interface Category:
API.
Purpose:
Subtracts the specified color from this THSVCompactColor 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:
None.
void Maximum (const THSVCompactColor & aColor2)
Interface Category:
API.
Purpose:
Determines the maximum of individual components of this THSVCompactColor and the specified color. It sets the components of this color to the resulting maximum values.
Calling Context:
Call this function directly.
Parameters:
- const THSVCompactColor & 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:
This function sets the opacity value to 255.
void Minimum (const THSVCompactColor & aColor2)
Interface Category:
API.
Purpose:
Determines the minimum of individual components of this THSVCompactColor and the specified color. It sets the components of this color to the resulting minimum values.
Calling Context:
Call this function directly.
Parameters:
- const THSVCompactColor & 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:
None.
void Blend (const THSVCompactColor & aColor2)
Interface Category:
API.
Purpose:
Averages the individual components of the two colors and returns them in this THSVCompactColor.
Calling Context:
Call this function directly.
Parameters:
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Multithread safe.
Other Considerations:
This function sets the opacity value to 255.
void Invert ()
Interface Category:
API.
Purpose:
Inverts this THSVCompactColor by subtracting the values of the individual components from 255.
Calling Context:
Call this function directly.
Parameters:
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Multithread safe.
Other Considerations:
This function sets the opacity value to 255.
void Clamp ()
Interface Category:
API.
Purpose:
Clamps the components of this THSVCompactColor between 0 <= N <= 255. If any value is less than 0, it is set to 0, and if it is greater than 255, it is set to 255.
Calling Context:
Call this function directly.
Parameters:
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Multithread safe.
Other Considerations:
This function sets the opacity value to 255.
void Scale ()
Interface Category:
API.
Purpose:
Scales this THSVCompactColor to 255. If all of the color's components are between 0 <= N <= 255, the color is untouched. If there are components with values greater than 255, then the largest component is used to renormalize the color.
If any of the color's components are less than 0, they are set to 0.
Calling Context:
Call this function directly.
Parameters:
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Multithread safe.
Other Considerations:
This function sets the opacity value to 255.
Member Function: THSVCompactColor::TemporaryTypeID
virtual TemporaryColorClassID TemporaryTypeID () const
Interface Category:
API.
Purpose:
Returns TColor::kHSVCompactColor, an enumeration tag that identifies this class type.
Calling Context:
Call this function directly.
Parameters:
Return Value:
Returns TColor::kHSVCompactColor.
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.