Comprehensive Guide for Developers: Features, Integration, and API Reference
Represents a color in a PDF document. More...
#include <pdfsdk/cxx/color.h>
Public Member Functions | |
| ColorSpace | GetColorSpace () const |
| Gets the color space of the color. | |
| size_t | GetNumComponents () const |
| Gets the number of components in a color. | |
| float | GetComponent (size_t index) const |
| Gets the color component at the specified index. | |
| Pattern | GetPattern () const |
| Gets the type of pattern associated with a color. Either tilling or shading. | |
| PDColorValue | ToRGB (PDERenderingIntent intent) const |
| Converts a color to its RGB color value, by providing the color's rendering intent. | |
| PDColorValue | ToARGB (float opacity, PDERenderingIntent intent) const |
| Converts a color to its ARGB color value, by providing the color's opacity and rendering intent. | |
| Color (PDEColor handle, bool adopt=false) noexcept | |
| Color (const Color &rhs) noexcept | |
| Color & | operator= (const Color &rhs) noexcept |
| Color (Color &&rhs) noexcept | |
| Color & | operator= (Color &&rhs) noexcept |
Static Public Member Functions | |
| static Color | Create (const ColorSpace &colorSpace, const std::vector< float > &components, const Pattern &pattern) |
| Creates a color by specifying a color space and the color components. | |
| static Color | CreateGray (float gray) |
| Creates a grayscale color with the specified gray value. | |
| static Color | CreateRGB (float red, float green, float blue) |
| Creates an RGB color by specifying the individual red, green, and blue values. | |
| static Color | CreateFromValue (PDColorValue value) |
| Creates a color from the RGB color value. | |
Represents a color in a PDF document.
Color values are made up of color components, which are usually represented by numbers. A grey level will be represented by a single number ranging from 0.0 (black) to 1.0 (white). Full color values can be specified in a number of ways, with the most common method using three numeric values one for each of the main colors - red, blue, green. Color values are interpreted according to the color space they belong to. Color spaces are parameters of the internal data structure called the graphics state. The rendering intent specifies how colors should be mapped from source to output device. First the color space is set, then the color values are specified and finally the rendering intent modifies how the colors are interpreted by the output device.
For more information refer to ISO 32000-2:2020 - 8.6.2 Color values
|
static |
Creates a color by specifying a color space and the color components.
If the color space happens to be the one of the special color spaces called 'Pattern', then the optional pattern parameter should be used to specify the pattern type - tilling or shading.
| colorSpace | The color space of the color. |
| components | The components of the color. A color value consists of one or more components. A grey level is specified by a single number ranging from 0.0 (black) to 1.0 (white). Full color values may be specified in one of several ways. One common way is by specifying red-green-blue components in that order. |
| pattern | If colorSpace is Pattern, the pattern should be specifed as either tilling or shading. |
|
static |
Creates a color from the RGB color value.
| value | The RGB bit-packed color value in 0xRRGGBB hex format. |
|
static |
Creates a grayscale color with the specified gray value.
| gray | The gray value of the color ranging from 0.0 (black) to 1.0 (white). |
|
static |
Creates an RGB color by specifying the individual red, green, and blue values.
| red | The red value of the color. With a range between 0.0 (absence of) to 1.0 (full color). |
| green | The green value of the color. With a range between 0.0 (absence of) to 1.0 (full color). |
| blue | The blue value of the color. With a range between 0.0 (absence of) to 1.0 (full color). |
| ColorSpace PDF::Color::GetColorSpace | ( | ) | const |
Gets the color space of the color.
| float PDF::Color::GetComponent | ( | size_t | index | ) | const |
Gets the color component at the specified index.
| index | The index of the color component. |
| size_t PDF::Color::GetNumComponents | ( | ) | const |
Gets the number of components in a color.
| Pattern PDF::Color::GetPattern | ( | ) | const |
Gets the type of pattern associated with a color. Either tilling or shading.
Only applicable if the color space family this color belongs to is of the special 'Pattern' type.
| PDColorValue PDF::Color::ToARGB | ( | float | opacity, |
| PDERenderingIntent | intent ) const |
Converts a color to its ARGB color value, by providing the color's opacity and rendering intent.
| opacity | The opacity value ranging from 0.0 (fully transparent) to 1.0 (opaque) |
| intent | The rendering intent. |
| PDColorValue PDF::Color::ToRGB | ( | PDERenderingIntent | intent | ) | const |
Converts a color to its RGB color value, by providing the color's rendering intent.
| intent | The rendering intent. |