# LabColorSpace Class

> A Lab color space is a CIE-based ABC color space with two transformation stages.

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

```cpp
class LabColorSpace : ColorSpace
```

**Namespace:** `datalogics_interface`

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

## Description

A Lab color space is a CIE-based ABC color space with two transformation stages.

In this type of space, A, B, and C represent the L*, a*, and b* components of a CIE 1976 L*a*b* space. The range of the first (L*) component is always 0 to 100; the ranges of the second and third (a* and b*) components are defined by the Range.

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

## Constructors

### LabColorSpace

```cpp
datalogics_interface::LabColorSpace::LabColorSpace(const std::vector< double > &white_point)
```

*constructor*

**Parameters**

- `white_point` (`const std::vector< double > &`): An array of three numbers specifying the tristimulus value, in the CIE 1931 XYZ space, of the diffuse white point. The numbers X and Z must be positive, and Y must be equal to 1.0.

Create a Lab color space.

### LabColorSpace

```cpp
datalogics_interface::LabColorSpace::LabColorSpace(const std::vector< double > &white_point, const std::vector< double > &black_point, const std::vector< double > &range)
```

*constructor*

**Parameters**

- `white_point` (`const std::vector< double > &`): An array of three numbers specifying the tristimulus value, in the CIE 1931 XYZ space, of the diffuse white point. The numbers X and Z must be positive, and Y must be equal to 1.0.
- `black_point` (`const std::vector< double > &`): An array of three numbers specifying the tristimulus value, in the CIE 1931 XYZ space, of the diffuse black point. All three of these numbers must be non-negative.
- `range` (`const std::vector< double > &`): An array of four numbers [ amin amax bmin bmax ] specifying the range of valid values for the a* and b* (B and C) components of the color space.

Create a Lab color space.

## Methods

### get_black_point

```cpp
std::vector< double > datalogics_interface::LabColorSpace::get_black_point() const
```

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

An array of three doubles representing the X, Y, and Z tristimulus values of the black point.

The black point tristimulus value for this Lab color space.

An array of three numbers specifying the tristimulus value, in the CIE 1931 XYZ space, of the diffuse black point. All three of these numbers must be non-negative. If no black point was specified during construction, the default value [0.0, 0.0, 0.0] is returned.

### 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::LabColorSpace::get_range() const
```

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

An array of four doubles specifying the minimum and maximum values for a* and b*.

The range of valid values for the a* and b* components.

An array of four numbers [ amin amax bmin bmax ] specifying the range of valid values for the a* and b* (B and C) components of the color space. If no range was specified during construction, the default value [-100, 100, -100, 100] is returned.

### get_white_point

```cpp
std::vector< double > datalogics_interface::LabColorSpace::get_white_point() const
```

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

An array of three doubles representing the X, Y, and Z tristimulus values of the white point.

The white point tristimulus value for this Lab color space.

An array of three numbers specifying the tristimulus value, in the CIE 1931 XYZ space, of the diffuse white point. The numbers X and Z must be positive, and Y must be equal to 1.0.

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

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