![]() |
#include <ColorSpace.h>
Public Member Functions | |
ColorPt (double x=0, double y=0, double z=0, double w=0) | |
Constructors and destructor. | |
ColorPt (const ColorPt &co) | |
~ColorPt () | |
ColorPt & | operator= (const ColorPt &co) |
bool | operator== (const ColorPt &co) const |
void | Set (double x=0, double y=0, double z=0, double w=0) |
A utility method to set the first 4 tint values. | |
void | Set (int colorant_index, double colorant_value) |
Sets a tint value at a given colorant index. | |
double | Get (int colorant_index) const |
void | SetColorantNum (int num) |
If a color point has more than 4 colorants, SetColorantNum(num_colorants) must be called before getting or setting tint values. |
pdftron::PDF::ColorPt::ColorPt | ( | double | x = 0 , |
|
double | y = 0 , |
|||
double | z = 0 , |
|||
double | w = 0 | |||
) | [explicit] |
Constructors and destructor.
pdftron::PDF::ColorPt::ColorPt | ( | const ColorPt & | co | ) |
pdftron::PDF::ColorPt::~ColorPt | ( | ) |
bool pdftron::PDF::ColorPt::operator== | ( | const ColorPt & | co | ) | const |
void pdftron::PDF::ColorPt::Set | ( | double | x = 0 , |
|
double | y = 0 , |
|||
double | z = 0 , |
|||
double | w = 0 | |||
) |
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.
color.Set(gray) is equivalent to Set(0, gray);
void pdftron::PDF::ColorPt::Set | ( | int | colorant_index, | |
double | colorant_value | |||
) |
Sets a tint value at a given colorant index.
colorant_index | 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 | The new tint value. |
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)
double pdftron::PDF::ColorPt::Get | ( | int | colorant_index | ) | const |
For example, if you have a color point in the RGB color space you can extract its colorants as follows:
void pdftron::PDF::ColorPt::SetColorantNum | ( | int | 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().