- Main Page
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | List of all members
pdftron::PDF::ColorPt Class Reference

`#include <ColorSpace.h>`

## Public Member Functions
| ColorPt (double x=0, double y=0, double z=0, double w=0)
| 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)
void | Set (int colorant_index, double colorant_value)
double | Get (int colorant_index) const
void | SetColorantNum (int num)
void | Destroy ()

## Detailed Description

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

Definition at line 20 of file ColorSpace.h.

## Constructor & Destructor Documentation

pdftron::PDF::ColorPt::ColorPt | ( | double | x = `0`,
|  | double | y = `0`,
|  | double | z = `0`,
|  | double | w = `0`
| ) |  |
| explicit

Constructor

Parameters

  x | initialized value of first color value (eg. red for rgb colorspace);
  y | initialized value of second color value (eg. green for rgb colorspace);
  z | initialized value of third color value (eg. blue for rgb colorspace);
  w | 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.

pdftron::PDF::ColorPt::ColorPt | ( | const ColorPt & | co | ) |

pdftron::PDF::ColorPt::~ColorPt | ( |  | ) |

Destructor

## Member Function Documentation

void pdftron::PDF::ColorPt::Destroy | ( |  | ) |

Frees the native memory of the object.

double pdftron::PDF::ColorPt::Get | ( | int | colorant_index | ) | const

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

  colorant_index | number representing the index of the color space to get the tint from

Returns
  the tint value at a given colorant index.

ColorPt& pdftron::PDF::ColorPt::operator= | ( | const ColorPt & | co | ) |

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.

Parameters

  x | initialized value of first color value (eg. red for rgb colorspace);
  y | initialized value of second color value (eg. green for rgb colorspace);
  z | initialized value of third color value (eg. blue for rgb colorspace);
  w | initialized value of fourth color value (eg. when using CMYK);

Note
  color.Set(gray) is equivalent to Set(0, gray);
  All colorants should be in the range [0..1], so colors in the range [0..255] should be divided by 255.0 first.

void pdftron::PDF::ColorPt::Set | ( | int | colorant_index,
|  | double | colorant_value
| ) |  |

Sets a tint value at a given colorant index.

Parameters

  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.

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.
  All colorants should be in the range [0..1], so colors in the range [0..255] should be divided by 255.0 first.

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

The documentation for this class was generated from the following file:

- PDF/ColorSpace.h