Class: ColorPt

Core.PDFNet. ColorPt


new ColorPt()

ColorPt is an array of colorants (or tint values) representing a color point in an associated color space.

Extends

Methods


<static> init( [x] [, y] [, z] [, w])

Constructor
Parameters:
Name Type Argument Description
x number <optional>
initialized value of first color value (eg. red for rgb colorspace);
y number <optional>
initialized value of second color value (eg. green for rgb colorspace);
z number <optional>
initialized value of third color value (eg. blue for rgb colorspace);
w number <optional>
initialized value of fourth color value (eg. when using CMYK); Note: All colorants should be in the range [0..1], so colors in the range [0..255] should be divided by 255.0 first.
Returns:
A promise that resolves to an object of type: "PDFNet.ColorPt"
Type
Promise.<Core.PDFNet.ColorPt>

compare(right)

Comparison function. Determines if parameter object is equal to current object.
Parameters:
Name Type Description
right Core.PDFNet.ColorPt
Returns:
A promise that resolves to True if the two objects are equivalent, False otherwise
Type
Promise.<boolean>

destroy()

Destructor
Inherited From:
Returns:
Type
Promise.<void>

get(colorant_index)

The number of colorants depends on the associated color space. To find how many colorant are associated with a given color space use color_space.GetComponentNum(). For example, if you have a color point in the RGB color space you can extract its colorants as follows:
UInt8 rgb[3] = { UInt8(c.Get(0)*255), UInt8(c.Get(1)*255), UInt8(c.Get(2)*255) };
Parameters:
Name Type Description
colorant_index number number representing the index of the color space to get the tint from
Returns:
A promise that resolves to the tint value at a given colorant index.
Type
Promise.<number>

set( [x] [, y] [, z] [, w])

A utility method to set the first 4 tint values. For example, color.Set(red, green, blue) will initialize the ColorPt to given tint values.
Parameters:
Name Type Argument Description
x number <optional>
initialized value of first color value (eg. red for rgb colorspace);
y number <optional>
initialized value of second color value (eg. green for rgb colorspace);
z number <optional>
initialized value of third color value (eg. blue for rgb colorspace);
w number <optional>
initialized value of fourth color value (eg. when using CMYK); Note: color.Set(gray) is equivalent to Set(0, gray); Note: All colorants should be in the range [0..1], so colors in the range [0..255] should be divided by 255.0 first.
Returns:
Type
Promise.<void>

setByIndex(colorant_index, colorant_value)

Sets a tint value at a given colorant index.
Parameters:
Name Type Description
colorant_index number the color index. For example, for a color point associated with a Gray color space the only allowed value for index is 0. For a color point associated with a CMYK color space, the color_index can range from 0 (cyan) to 4 (black).
colorant_value number The new tint value. For example, the following snippet will initialize the color point to [red, green, blue]:
color.SetColorantNum(3);
color.Set(0, red);
color.Set(1, green);
color.Set(2, blue);
The above code snippet is equivalent to the following line: color.Set(red, green, blue) Note: If a color point has more than 4 colorants, SetColorantNum(num_colorants) must be called before getting or setting tint values. Note: All colorants should be in the range [0..1], so colors in the range [0..255] should be divided by 255.0 first.
Returns:
Type
Promise.<void>

setColorantNum(num)

If a color point has more than 4 colorants, SetColorantNum(num_colorants) must be called before getting or setting tint values. The number of colorants depends on the associated color space. To find how many colorant are associated with a given color space use color_space.GetComponentNum().
Parameters:
Name Type Description
num number
Returns:
Type
Promise.<void>

takeOwnership()

Take the ownership of this object, so that PDFNet.runWithCleanup won't destroy this object.
Inherited From:
Returns:
Type
void