Class: ColorPt

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);
Returns:
A promise that resolves to an object of type: "PDFNet.ColorPt"
Type
Promise.<PDFNet.ColorPt>

compare(right)

Comparison function. Determines if parameter object is equal to current object.
Parameters:
Name Type Description
right 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);
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)
Returns:
Type
Promise.<void>

setColorantNum(num)

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