IndexedColorSpace Class Documentation
class IndexedColorSpace : ColorSpaceNamespace:datalogics_interface
- Inherits from:
ColorSpace
Detailed Description
Indexed color spaces are used to reduce the amount of memory used for processing images.
Indexed color spaces are used when a limited number of colors are needed.
Commonly, an image with an indexed color space can be one third the size of the same image with a standard color space, because the indexed image uses a smaller palette of colors.
Uses types
Constructor & Destructor Documentation
IndexedColorSpace
IndexedColorSpace(const ColorSpace & base, long hival, const std::vector< long > & lookup)Parameters
base: const ColorSpace &The base color space in which the values in the color table are to be interpreted. It can be any device or CIE-based color space or (in PDF 1.3) a Separation or DeviceN space, but not a Pattern space or another Indexed space.
hival: longan integer that specifies the maximum valid index value. In other words, the color table is to be indexed by integers in the range 0 to hival. hival can be no greater than 255.
lookup: const std::vector< long > &a list of integers in the range 0..255. There must be m * (hival + 1) values, where m is the number of components of the base color space.
Create a Indexed color space.
Member Function Documentation
get_base
std::unique_ptr< ColorSpace > get_base()Returns:
std::unique_ptr< ColorSpace >The base color space in which the values in the color table are to be interpreted. It can be any device or CIE-based color space or (in PDF 1.3) a Separation or DeviceN space, but not a Pattern space or another Indexed space.
get_hival
long get_hival()Returns:
longan integer that specifies the maximum valid index value. In other words, the color table is to be indexed by integers in the range 0 to hival. hival can be no greater than 255.
get_lookup
std::vector< long > get_lookup()Returns:
std::vector< long >A list of integers in the range 0..255. There must be m * (hival + 1) values, where m is the number of components of the base color space.
get_name
std::string get_name()Returns:
std::stringThe name of the color space. A named color space may be named something like DeviceRGB. More complicated color spaces may have a name like Indexed or ICCBased.
get_num_components
int get_num_components()Returns:
intThe number of color components.
The number of components in the color space.
For example, DeviceGray has 1 component, DeviceRGB has 3, and DeviceCMYK has 4.
get_pdf_object
std::unique_ptr< PDFObject > get_pdf_object()Returns:
std::unique_ptr< PDFObject >The PDFObject associated with the color space.
Get the PDFObject associated with the color space. This may be a PDFName, PDFDict, PDFStream, or PDFArray.
operator==
bool operator==(const ColorSpace & other)Parameters
other: const ColorSpace &The ColorSpace to compare against.
Returns:
booltrue if the two color spaces are equal, false otherwise.
Test for equality.
This works best for named color spaces.
More complex color spaces (such as ICCBased) do not support equality testing and will always return false.
to_string
std::string to_string()Returns:
std::stringA string describing this ColorSpace.
Convert a ColorSpace to a string representation.