# ICCBasedColorSpace Class

> Works with the ICC color space.

- Product: Adobe PDF Library 21
- Language: Modern C++
- Version: 21.4.0
- HTML page: https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/ICCBasedColorSpace
- Version index: https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/llms.txt

```cpp
class ICCBasedColorSpace : ColorSpace
```

**Namespace:** `datalogics_interface`

**Inherits from:** [`ColorSpace`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/ColorSpace.md)

## Description

Works with the ICC color space.

The International Color Consortium (ICC) developed the ICC color space in 1993 to serve as a universal standard for for printing or presenting content with digital devices, and across all operating systems and platforms.

The ICC color standard applies regardless the hardware or software involved, and is used to make sure that color images and text appear properly on a wide variety of platforms.

**Uses types:** [`ColorSpace`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/ColorSpace.md), [`PDFObject`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/PDFObject.md), [`PDFStream`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/PDFStream.md)

## Constructors

### ICCBasedColorSpace

```cpp
datalogics_interface::ICCBasedColorSpace::ICCBasedColorSpace(const PDFStream &icc_stream)
```

*constructor*

**Parameters**

- `icc_stream` ([`const PDFStream &`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/PDFStream.md)): stream containing the ICC profile

Create an ICC-based color stream.

### ICCBasedColorSpace

```cpp
datalogics_interface::ICCBasedColorSpace::ICCBasedColorSpace(const PDFStream &icc_stream, int num_components)
```

*constructor*

**Parameters**

- `icc_stream` ([`const PDFStream &`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/PDFStream.md)): stream containing the ICC profile
- `num_components` (`int`): The number of components (1, 3, or 4)

Create an ICC-based color stream.

## Methods

### get_alternate

```cpp
std::unique_ptr< ColorSpace > datalogics_interface::ICCBasedColorSpace::get_alternate() const
```

**Returns:** [`std::unique_ptr< ColorSpace >`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/ColorSpace.md)

An alternate color space to be used in case the one specified in the stream data is not supported (for example, by applications designed for earlier versions of PDF). The alternate space may be any valid color space (except a Pattern color space) that has the number of components specified by N. If this entry is omitted and the application does not understand the ICC profile data, the color space used is DeviceGray, DeviceRGB, or DeviceCMYK, depending on whether the value of N is 1, 3, or 4, respectively.

### get_name

```cpp
std::string datalogics_interface::ColorSpace::get_name() const
```

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

```cpp
int datalogics_interface::ColorSpace::get_num_components() const
```

**Returns:** `int`

The 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

```cpp
std::unique_ptr< PDFObject > datalogics_interface::ColorSpace::get_pdf_object() const
```

**Returns:** [`std::unique_ptr< PDFObject >`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/PDFObject.md)

The PDFObject associated with the color space.

Get the PDFObject associated with the color space. This may be a PDFName, PDFDict, PDFStream, or PDFArray.

### get_range

```cpp
std::vector< double > datalogics_interface::ICCBasedColorSpace::get_range() const
```

**Returns:** `std::vector< double >`

An array of 2 * NumComponents numbers [ min0 max0 min1 max1 ... ] specifying the minimum and maximum valid values of the corresponding color components. These values must match the information in the ICC profile. Default value: [ 0.0 1.0 0.0 1.0 ... ]

### get_stream

```cpp
std::unique_ptr< PDFStream > datalogics_interface::ICCBasedColorSpace::get_stream() const
```

**Returns:** [`std::unique_ptr< PDFStream >`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/PDFStream.md)

The PDFStream containing the ICC-based data and other attributes.

### operator==

```cpp
virtual bool datalogics_interface::ColorSpace::operator==(const ColorSpace &other) const
```

**Parameters**

- `other` ([`const ColorSpace &`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/ColorSpace.md)): The ColorSpace to compare against.

**Returns:** `bool`

true 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.

### set_alternate

```cpp
void datalogics_interface::ICCBasedColorSpace::set_alternate(ColorSpace &alternate)
```

**Parameters**

- `alternate` ([`ColorSpace &`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/ColorSpace.md)): an alternate color space to be used in case the one specified in the stream data is not supported (for example, by ap... value of N is 1, 3, or 4, respectively.

**Returns:** `void`

An alternate color space to be used in case the one specified in the stream data is not supported (for example, by applications designed for earlier versions of PDF). The alternate space may be any valid color space (except a Pattern color space) that has the number of components specified by N. If this entry is omitted and the application does not understand the ICC profile data, the color space used is DeviceGray, DeviceRGB, or DeviceCMYK, depending on whether the

### set_range

```cpp
void datalogics_interface::ICCBasedColorSpace::set_range(const std::vector< double > &range)
```

**Parameters**

- `range` (`const std::vector< double > &`): an array of 2 * NumComponents numbers [ min0 max0 min1 max1 ... ] specifying the minimum and maximum valid values of...

**Returns:** `void`

An array of 2 * NumComponents numbers [ min0 max0 min1 max1 ... ] specifying the minimum and maximum valid values of the corresponding color components. These values must match the information in the ICC profile. Default value: [ 0.0 1.0 0.0 1.0 ... ]

### to_string

```cpp
std::string datalogics_interface::ColorSpace::to_string() const
```

**Returns:** `std::string`

A string describing this ColorSpace.

Convert a ColorSpace to a string representation.
