IndexedColorSpace Class Documentation

classIndexedColorSpace : ColorSpace

Namespace:datalogics_interface

Inherits from:
ColorSpace

Detailed Description

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.

Constructor & Destructor Documentation

IndexedColorSpace

IndexedColorSpace(const ColorSpace &base, longhival, 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: long

an 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

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

longget_hival()

Returns:

long

an 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::stringget_name()

Returns:

std::string

The 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

intget_num_components()

Returns:

The number of color components.

For example, DeviceGray has 1 component, DeviceRGB has 3, and DeviceCMYK has 4.

get_pdf_object

Returns:

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==

booloperator==(const ColorSpace &other)

Parameters

other: const ColorSpace &

The ColorSpace to compare against.

Returns:

true if the two color spaces are equal, false otherwise.

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::stringto_string()

Returns:

A string describing this ColorSpace.

Convert a ColorSpace to a string representation.