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

Public Member Functions

 Color ()
 Construct an empty color.
 
 Color (ColorSpace color_space)
 Constructor, with a color space object. More...
 
 Color (Color other)
 Constructor, with another color object. More...
 
Color convertToCMYK (int intent) throws com.foxit.sdk.PDFException
 Convert to a CMYK color. More...
 
Color convertToRGB (int intent) throws com.foxit.sdk.PDFException
 Convert to a RGB color. More...
 
synchronized void delete ()
 Clean up related resources immediately. More...
 
ColorSpace getColorSpace ()
 Get the color space that current color belongs to. More...
 
FloatArray getValue ()
 Get component value array. More...
 
boolean isEmpty ()
 Check whether current object is empty or not. More...
 
void setValue (FloatArray component_array) throws com.foxit.sdk.PDFException
 Set component value array. More...
 
- Public Member Functions inherited from com.foxit.sdk.common.Base
synchronized void delete ()
 Clean up related resources immediately. More...
 

Detailed Description

This class represents a color.

Constructor & Destructor Documentation

◆ Color() [1/2]

com.foxit.sdk.common.Color.Color ( ColorSpace  color_space)

Constructor, with a color space object.

Parameters
[in]color_spaceA valid color space object.

◆ Color() [2/2]

com.foxit.sdk.common.Color.Color ( Color  other)

Constructor, with another color object.

Parameters
[in]otherAnother Color object.

Member Function Documentation

◆ convertToCMYK()

Color com.foxit.sdk.common.Color.convertToCMYK ( int  intent) throws com.foxit.sdk.PDFException

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 com.foxit.sdk.common.Color.convertToRGB ( int  intent) throws com.foxit.sdk.PDFException

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.

◆ delete()

synchronized void com.foxit.sdk.common.Color.delete ( )

Clean up related resources immediately.

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

◆ getColorSpace()

ColorSpace com.foxit.sdk.common.Color.getColorSpace ( )

Get the color space that current color belongs to.

Returns
Color space object.

◆ getValue()

FloatArray com.foxit.sdk.common.Color.getValue ( )

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

boolean com.foxit.sdk.common.Color.isEmpty ( )

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.

◆ setValue()

void com.foxit.sdk.common.Color.setValue ( FloatArray  component_array) throws com.foxit.sdk.PDFException

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.