Comprehensive Guide for Developers: Features, Integration, and API Reference
Represents a color space in a PDF document. More...
#include <pdfsdk/cxx/color_space.h>
Public Member Functions | |
| Object | GetPdfObject () const |
| Get the PDF object associated with this color space. | |
| PDEColorSpaceFamily | GetFamily () const |
| Gets the color space family. | |
| size_t | GetNumComponents () const |
| Gets the number of components that make up a color space. | |
| PDENumRange | GetComponentRange (size_t index) const |
| Gets the range of values for a specific component in the color space. | |
| bool | HasVisibleOutput () const |
| Checks if the color space produces visible output. | |
| ColorSpace (PDEColorSpace handle, bool adopt=false) noexcept | |
| ColorSpace (const ColorSpace &rhs) noexcept | |
| ColorSpace & | operator= (const ColorSpace &rhs) noexcept |
| ColorSpace (ColorSpace &&rhs) noexcept | |
| ColorSpace & | operator= (ColorSpace &&rhs) noexcept |
Static Public Member Functions | |
| static ColorSpace | GetDeviceGray () |
| Gets the DeviceGray color space. | |
| static ColorSpace | GetDeviceRGB () |
| Gets the DeviceRGB color space. | |
| static ColorSpace | GetDeviceCMYK () |
| Gets the DeviceCMYK color space. | |
| static ColorSpace | GetPattern () |
| Gets the Pattern color space. | |
| static ColorSpace | CreateFromPdfObject (const Object &object) |
| Creates a color space from the specified PDF object. | |
Represents a color space in a PDF document.
Color spaces or color systems describe both how colors are represented by the rendering device and how they are perceived by the human eye. They fall within three families sharing the same general characteristics: Device, CIE-based and Special color spaces. The Device color space family directly specifies colors or shades of gray that the output device shall produce. They provide a variety of color specification methods, including Grayscale, RGB (red-green-blue), and CMYK (cyan-magenta-yellow-black), corresponding to the color space families DeviceGray, DeviceRGB, and DeviceCMYK. The CIE-based color spaces are based on an international standard for color specification and specify colors in a way that is independent of the characteristics of any particular output device. This family includes the CalGray, CalRGB, Lab, and ICCBased spaces. The Special color spaces add features or properties to an underlying color space. They include facilities for patterns, color mapping, separations, high-fidelity and multitone color. The corresponding color space families are Pattern, Indexed, Separation, and DeviceN.
For more information refer to section 8.6 Color spaces, from the ISO 32000-2:2020 (PDF 2.0) Standard.
|
static |
Creates a color space from the specified PDF object.
There are several types of PDF objects that can be used to create color spaces. These can include name, array, dictionary or stream objects (if they are part of dictionaries).
| [in] | object | A reference to the PDF object. |
| PDENumRange PDF::ColorSpace::GetComponentRange | ( | size_t | index | ) | const |
Gets the range of values for a specific component in the color space.
The component range refers to the numerical limits that define how much of each color channel can be present. It determines possible intensity or contribution of a particular component within the overall color representation. This ensures proper scaling of colors when converting between spaces. It can help normalize colors for different devices and can prevent out-of-gamut colors, ensuring they are properly handled in rendering.
| [in] | index | The index of the component. |
|
static |
Gets the DeviceCMYK color space.
The DeviceCMYK color space specifies colors according to the subtractive cyan-magenta-yellow-black model typical of printers and other paper-based output devices. It specifies the intensities of these four colors using values between 0 and 1, where 0 denotes the complete absence and 1 denotes the maximum intensity of a color. See 8.6.4.4 DeviceCMYK color space.
|
static |
Gets the DeviceGray color space.
The DeviceGray color space controls the intensity of achromatic light on a scale between 0 and 1. Black represented by 0, white represented by 1 and intermediate values representing different gray levels. See 8.6.4.2 DeviceGray color space.
|
static |
Gets the DeviceRGB color space.
The DeviceRGB color space specifies colors according to the additive red-green-blue color model. It specifies the intensities of the three primary colors using values between 0 and 1, where 0 denotes the complete absence and 1 denotes the maximum intensity of a color. See 8.6.4.3 DeviceRGB color space.
| PDEColorSpaceFamily PDF::ColorSpace::GetFamily | ( | ) | const |
Gets the color space family.
There are three groups of color space families - Device, CIE-based and Special families, each having three, four and four members respectively. For the Device family these are DeviceGray, DeviceRGB and DeviceCMYK. For the CIE-based family they are CalGrey, CalRGB, Lab and ICCBased. For the Special family they are Indexed, Pattern, Separation and DeviceN spaces. See 8.6.3 color space families
| size_t PDF::ColorSpace::GetNumComponents | ( | ) | const |
Gets the number of components that make up a color space.
Each color space is made up of different components. For the Device color space family, these are the numeric values that represent the color intensities for the individual pixels. Gray, Red-Green-Blue and Cyan-Magenta-Yellow-Black for DeviceGray, DeviceRGB, DeviceCMYK respectively. For the CIE-based family, the CalGrey and CalRGB have Gray and Red-Green-Blue components respectively and each have calibration parameters - Gamma, WhitePoint, BlackPoint and Matrix (for CalRGB). The ICCBased can have components that vary - RGB, CMYK, or custom and also has an ICC profile (metadata) stream. The Lab space has 3 components Lightness, a (green–red), b (blue–yellow). The Indexed Special color space is made up of a Base color space and an Indexed lookup table, the Separation Special color space - Single colorant name and a Tint transform function. The DeviceN Special color space is made up of Multiple named colorants and a Tint transform function.
|
static |
Gets the Pattern color space.
The Pattern color space specifies that an area is to be painted with a pattern rather than a single color. The pattern shall be either a tiling pattern (Type 1) or a shading pattern (Type 2). See 8.6.6.2 Pattern color spaces and 8.7 Patterns.
| Object PDF::ColorSpace::GetPdfObject | ( | ) | const |
Get the PDF object associated with this color space.
There are several types of PDF objects that can be associated with a color space. These can include name, array, dictionary or stream objects (if they are part of dictionaries).
| bool PDF::ColorSpace::HasVisibleOutput | ( | ) | const |
Checks if the color space produces visible output.
true if the color space produces visible output, false otherwise.