Foxit PDF SDK

Public Types | Public Member Functions | List of all members
foxit::common::ColorSpace Class Reference
Inheritance diagram for foxit::common::ColorSpace:

## Public Types
enum | RenderingIntent { e_RenderIntentPerceptual = 0, e_RenderIntentRelColorimetric = 1, e_RenderIntentSaturation = 2, e_RenderIntentAbsColorimetric = 3 }
| Enumeration for rendering intent. More...

## Public Member Functions
| ColorSpace (const ColorSpace &other)
| Constructor, with another color space object. More...
| ColorSpace (foxit::common::ColorSpaceType type)
| Constructor, with specified color type. More...
| ~ColorSpace ()
| Destructor.
Color | ConvertColor (const Color &color)
| Convert input color to the color in current color space. More...
Color | ConvertColor (int c_value, int m_value, int y_value, int k_value)
| Convert input C/M/Y/K component values to a color object in current color space. More...
Color | ConvertColor (int r_value, int g_value, int b_value)
| Convert input R/G/B component values to a color in current color space. More...
foxit::common::ColorSpaceType | GetColorSpaceType () const
| Get color space type. More...
int | GetComponentCount () const
| Get the count of components. More...
StringArray | GetComponentNames () const
| Get a string array which represents the name of colorant for Separation color space, or names specifying the individual color components for DeviceN color space. More...
bool | IsEmpty () const
| Check whether current object is empty or not. More...
bool | IsSpotColorSpace () const
| Check whether current color space object is a spot color space or not. More...
bool | operator!= (const ColorSpace &other) const
| Not equal operator. More...
ColorSpace & | operator= (const ColorSpace &other)
| Assign operator. More...
bool | operator== (const ColorSpace &other) const
| Equal operator. More...
Public Member Functions inherited from foxit::Base
FS_HANDLE | Handle () const
| Get the handle of current object. More...

## Detailed Description

This class represents color space. User can use this class to covert colors.

## Member Enumeration Documentation

## ◆ RenderingIntent

enum foxit::common::ColorSpace::RenderingIntent

Enumeration for rendering intent.

Values of this enumeration should be used alone.
Rendering intent can be used for color conversion. Please refer to Section 8.6.5.8 "Rendering intents" in the reference doucment for PDF 2.0 for more details.

Enumerator
e_RenderIntentPerceptual | Rendering intent: Perceptual.
e_RenderIntentRelColorimetric | Rendering intent: Relative Colorimetric.
e_RenderIntentSaturation | Rendering intent: Saturation.
e_RenderIntentAbsColorimetric | Rendering intent: Absolute Colorimetric.

## Constructor & Destructor Documentation

## ◆ ColorSpace() [1/2]

foxit::common::ColorSpace::ColorSpace | ( | foxit::common::ColorSpaceType | type | ) |

Constructor, with specified color type.

Parameters

  [in] | type | The color space type. Currently, this value can only be one of following values: common::e_ColorSpaceDeviceGray, common::e_ColorSpaceDeviceRGB, common::e_ColorSpaceDeviceCMYK. For other unsupported color space type, exception foxit::e_ErrUnsupported will be thrown.

## ◆ ColorSpace() [2/2]

foxit::common::ColorSpace::ColorSpace | ( | const ColorSpace & | other | ) |

Constructor, with another color space object.

Parameters

  [in] | other | Another color space object.

## Member Function Documentation

## ◆ ConvertColor() [1/3]

Color foxit::common::ColorSpace::ConvertColor | ( | const Color & | color | ) |

Convert input color to the color in current color space.

Parameters

  [in] | color | Input color, which is to be converted to current color space.

Returns
  Converted color. If the return value of function Color::IsEmpty for the returned color is true, that means the conversion failed.

## ◆ ConvertColor() [2/3]

Color foxit::common::ColorSpace::ConvertColor | ( | int | c_value,
|  | int | m_value,
|  | int | y_value,
|  | int | k_value
| ) |  |

Convert input C/M/Y/K component values to a color object in current color space.

Parameters

  [in] | c_value | C component value. Valid range: from 0 to 255.
  [in] | m_value | M component value. Valid range: from 0 to 255.
  [in] | y_value | Y component value. Valid range: from 0 to 255.
  [in] | k_value | K component value. Valid range: from 0 to 255.

Returns
  Converted color. If the return value of function Color::IsEmpty for the returned color is true, that means the conversion failed.

## ◆ ConvertColor() [3/3]

Color foxit::common::ColorSpace::ConvertColor | ( | int | r_value,
|  | int | g_value,
|  | int | b_value
| ) |  |

Convert input R/G/B component values to a color in current color space.

Parameters

  [in] | r_value | R component value. Valid range: from 0 to 255.
  [in] | g_value | G component value. Valid range: from 0 to 255.
  [in] | b_value | B component value. Valid range: from 0 to 255.

Returns
  Converted color. If the return value of function Color::IsEmpty for the returned color is true, that means the conversion failed.

## ◆ GetColorSpaceType()

foxit::common::ColorSpaceType foxit::common::ColorSpace::GetColorSpaceType | ( |  | ) | const

Get color space type.

Returns
  Color space type. Please refer to values starting from common::e_ColorSpaceInvalid and this would be one of these values.

## ◆ GetComponentCount()

int foxit::common::ColorSpace::GetComponentCount | ( |  | ) | const

Get the count of components.

For different color space type, the count of components are not the same.

Returns
  Count of components.

## ◆ GetComponentNames()

StringArray foxit::common::ColorSpace::GetComponentNames | ( |  | ) | const

Get a string array which represents the name of colorant for Separation color space, or names specifying the individual color components for DeviceN color space.

This function is only available when current color space type is common::e_ColorSpaceSeparation or common::e_ColorSpaceDeviceN. For other color space type, this function will return an empty string array.

Returns
  A string array of name(s).
  - For Separation color space, the count of returned array will be only one and the string specifies the name of colorant.
  - For DeviceN color space, there can be several strings in returned array and they specify the individual color components.

## ◆ IsEmpty()

bool foxit::common::ColorSpace::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.

## ◆ IsSpotColorSpace()

bool foxit::common::ColorSpace::IsSpotColorSpace | ( |  | ) | const

Check whether current color space object is a spot color space or not.

Returns
  true means current object is spot color space, while false means not.

## ◆ operator!=()

bool foxit::common::ColorSpace::operator!= | ( | const ColorSpace & | other | ) | const

Not equal operator.

Parameters

  [in] | other | Another color space object. This function will check if current object is not equal to this one.

Returns
  true means not equal, while false means equal.

## ◆ operator=()

ColorSpace& foxit::common::ColorSpace::operator= | ( | const ColorSpace & | other | ) |

Assign operator.

Parameters

  [in] | other | Another color space object, whose value would be assigned to current object.

Returns
  Reference to current object itself.

## ◆ operator==()

bool foxit::common::ColorSpace::operator== | ( | const ColorSpace & | other | ) | const

Equal operator.

Parameters

  [in] | other | Another color space object. This function will check if current object is equal to this one.

Returns
  true means equal, while false means not equal.