Foxit PDF SDK

Public Member Functions | Static Public Attributes | List of all members
com.foxit.sdk.common.ColorSpace Class Reference
Inheritance diagram for com.foxit.sdk.common.ColorSpace:

## Public Member Functions
| ColorSpace (int type) throws com.foxit.sdk.PDFException
| Constructor, with specified color type. More...
| ColorSpace (ColorSpace other) throws com.foxit.sdk.PDFException
| Constructor, with another color space object. More...
Color | convertColor (Color color) throws com.foxit.sdk.PDFException
| Convert input color to the color in current color space. More...
Color | convertColor (int r_value, int g_value, int b_value) throws com.foxit.sdk.PDFException
| Convert input R/G/B component values to a color in current color space. More...
Color | convertColor (int c_value, int m_value, int y_value, int k_value) throws com.foxit.sdk.PDFException
| Convert input C/M/Y/K component values to a color object in current color space. More...
synchronized void | delete ()
| Clean up related C++ resources immediately. More...
int | getColorSpaceType () throws com.foxit.sdk.PDFException
| Get color space type. More...
int | getComponentCount () throws com.foxit.sdk.PDFException
| Get the count of components. More...
java.util.ArrayList< java.lang.String > | getComponentNames () throws com.foxit.sdk.PDFException
| 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...
boolean | isEmpty () throws com.foxit.sdk.PDFException
| Check whether current object is empty or not. More...
boolean | isSpotColorSpace () throws com.foxit.sdk.PDFException
| Check whether current color space object is a spot color space or not. More...
Public Member Functions inherited from com.foxit.sdk.common.Base
synchronized void | delete ()
| Clean up related C++ resources immediately. More...

## Static Public Attributes
static final int | e_RenderIntentAbsColorimetric = 3
| Rendering intent: Absolute Colorimetric.
static final int | e_RenderIntentPerceptual = 0
| Rendering intent: Perceptual.
static final int | e_RenderIntentRelColorimetric = 1
| Rendering intent: Relative Colorimetric.
static final int | e_RenderIntentSaturation = 2
| Rendering intent: Saturation.

## Detailed Description

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

## Constructor & Destructor Documentation

## ◆ ColorSpace() [1/2]

com.foxit.sdk.common.ColorSpace.ColorSpace | ( | int | type | ) | throws com.foxit.sdk.PDFException

Constructor, with specified color type.

Parameters

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

## ◆ ColorSpace() [2/2]

com.foxit.sdk.common.ColorSpace.ColorSpace | ( | ColorSpace | other | ) | throws com.foxit.sdk.PDFException

Constructor, with another color space object.

Parameters

  [in] | other | Another color space object.

## Member Function Documentation

## ◆ convertColor() [1/3]

Color com.foxit.sdk.common.ColorSpace.convertColor | ( | Color | color | ) | throws com.foxit.sdk.PDFException

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 com.foxit.sdk.common.ColorSpace.convertColor | ( | int | r_value,
|  | int | g_value,
|  | int | b_value
| ) |  | throws com.foxit.sdk.PDFException

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.

## ◆ convertColor() [3/3]

Color com.foxit.sdk.common.ColorSpace.convertColor | ( | int | c_value,
|  | int | m_value,
|  | int | y_value,
|  | int | k_value
| ) |  | throws com.foxit.sdk.PDFException

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.

## ◆ delete()

synchronized void com.foxit.sdk.common.ColorSpace.delete | ( |  | ) |

Clean up related C++ resources immediately.

Returns
  None.

Note
  Once this function is called, current object cannot be used anymore.

## ◆ getColorSpaceType()

int com.foxit.sdk.common.ColorSpace.getColorSpaceType | ( |  | ) | throws com.foxit.sdk.PDFException

Get color space type.

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

## ◆ getComponentCount()

int com.foxit.sdk.common.ColorSpace.getComponentCount | ( |  | ) | throws com.foxit.sdk.PDFException

Get the count of components.

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

Returns
  Count of components.

## ◆ getComponentNames()

java.util.ArrayList< java.lang.String > com.foxit.sdk.common.ColorSpace.getComponentNames | ( |  | ) | throws com.foxit.sdk.PDFException

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 com.foxit.sdk.common.Constants.e_ColorSpaceSeparation or com.foxit.sdk.common.Constants.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()

boolean com.foxit.sdk.common.ColorSpace.isEmpty | ( |  | ) | throws com.foxit.sdk.PDFException

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()

boolean com.foxit.sdk.common.ColorSpace.isSpotColorSpace | ( |  | ) | throws com.foxit.sdk.PDFException

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.