Foxit PDF SDK
foxit::common::Color Class Reference
Inheritance diagram for foxit::common::Color:
foxit::Base

Public Member Functions

 Color ()
 Construct an empty color.
 
 Color (const Color &other)
 Constructor, with another color object. More...
 
 Color (const ColorSpace &color_space)
 Constructor, with a color space object. More...
 
 ~Color ()
 Destructor.
 
Color ConvertToCMYK (ColorSpace::RenderingIntent intent=ColorSpace::e_RenderIntentRelColorimetric) const
 Convert to a CMYK color. More...
 
Color ConvertToRGB (ColorSpace::RenderingIntent intent=ColorSpace::e_RenderIntentRelColorimetric) const
 Convert to a RGB color. More...
 
ColorSpace GetColorSpace ()
 Get the color space that current color belongs to. More...
 
FloatArray GetValue () const
 Get component value array. More...
 
bool IsEmpty () const
 Check whether current object is empty or not. More...
 
bool operator!= (const Color &other) const
 Not equal operator. More...
 
Coloroperator= (const Color &other)
 Assign operator. More...
 
bool operator== (const Color &other) const
 Equal operator. More...
 
void SetValue (const FloatArray &component_array)
 Set component value array. More...
 
- Public Member Functions inherited from foxit::Base
FS_HANDLE Handle () const
 Get the handle of current object. More...
 

Detailed Description

This class represents a color.

Constructor & Destructor Documentation

◆ Color() [1/2]

foxit::common::Color::Color ( const ColorSpace color_space)
explicit

Constructor, with a color space object.

Parameters
[in]color_spaceA valid color space object.

◆ Color() [2/2]

foxit::common::Color::Color ( const Color other)

Constructor, with another color object.

Parameters
[in]otherAnother Color object.

Member Function Documentation

◆ ConvertToCMYK()

Color foxit::common::Color::ConvertToCMYK ( ColorSpace::RenderingIntent  intent = ColorSpace::e_RenderIntentRelColorimetric) const

Convert to a CMYK color.

Parameters
[in]intent(Reserved) Rendering intent used for color conversion.
Returns
Converted color. If the return value of function Color::IsEmpty for the returned color is true, that means the conversion failed.

◆ ConvertToRGB()

Color foxit::common::Color::ConvertToRGB ( ColorSpace::RenderingIntent  intent = ColorSpace::e_RenderIntentRelColorimetric) const

Convert to a RGB color.

Parameters
[in]intent(Reserved) Rendering intent used for color conversion.
Returns
Converted color. If the return value of function Color::IsEmpty for the returned color is true, that means the conversion failed.

◆ GetColorSpace()

ColorSpace foxit::common::Color::GetColorSpace ( )

Get the color space that current color belongs to.

Returns
Color space object.

◆ GetValue()

FloatArray foxit::common::Color::GetValue ( ) const

Get component value array.

The count of components depends on the color space that current color belongs to. User can get the color space object by function Color::GetColorSpace, and then get the count of componets by function ColorSpace::GetComponentCount.

Returns
A component value array. Each component value would be in the range from 0.0 to 1.0.

◆ IsEmpty()

bool foxit::common::Color::IsEmpty ( ) const

Check whether current object is empty or not.

When the current object is empty, that means current object is useless.

Returns
true means current object is empty, while false means not.

◆ operator!=()

bool foxit::common::Color::operator!= ( const Color other) const

Not equal operator.

Parameters
[in]otherAnother color object. This function will check if current object is not equal to this one.
Returns
true means not equal, while false means equal.

◆ operator=()

Color& foxit::common::Color::operator= ( const Color other)

Assign operator.

Parameters
[in]otherAnother color object, whose value would be assigned to current object.
Returns
Reference to current object itself.

◆ operator==()

bool foxit::common::Color::operator== ( const Color other) const

Equal operator.

Parameters
[in]otherAnother color object. This function will check if current object is equal to this one.
Returns
true means equal, while false means not equal.

◆ SetValue()

void foxit::common::Color::SetValue ( const FloatArray component_array)

Set component value array.

The count of components depends on the color space that current color belongs to. User can get the color space object by function Color::GetColorSpace, and then get the count of componets by function ColorSpace::GetComponentCount.

Parameters
[in]component_arrayA component value array. The count of components in this array should match the count of components of the color space that current color belongs to. Valid range of each component value: from 0.0 to 1.0.
Returns
None.