# ShadingPattern Class

> A shading pattern consists of a smoothly varying gradient between two colors.

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

```cpp
class ShadingPattern : Pattern
```

**Namespace:** `datalogics_interface`

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

**Derived classes:** [`AxialShadingPattern`](https://docs.datalogics.com/apdfl21/ModernCPP/21.2.0/class/AxialShadingPattern.md)

## Description

A shading pattern consists of a smoothly varying gradient between two colors.

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

## Methods

### get_anti_alias

```cpp
bool datalogics_interface::ShadingPattern::get_anti_alias() const
```

**Returns:** `bool`

true if anti-aliasing is enabled, false otherwise.

When enabled, the shading function is filtered to prevent aliasing artifacts.

### get_bounding_box

```cpp
Rect datalogics_interface::ShadingPattern::get_bounding_box() const
```

**Returns:** [`Rect`](https://docs.datalogics.com/apdfl21/ModernCPP/21.2.0/struct/Rect.md)

The bounding box Rect, or NULL if none is set.

The coordinates are interpreted in the target coordinate space. If present, provides an additional, temporary clipping boundary to the shading.

### get_color_space

```cpp
std::unique_ptr< ColorSpace > datalogics_interface::ShadingPattern::get_color_space() const
```

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

The ColorSpace of the shading pattern.

This space is restricted to be any space except a Pattern space.

### get_pdf_object

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

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

The PDFObject representing this pattern in the PDF document.

Gets the underlying PDF object for this pattern.

### set_anti_alias

```cpp
void datalogics_interface::ShadingPattern::set_anti_alias(bool anti_alias)
```

**Parameters**

- `anti_alias` (`bool`): true to enable anti-aliasing, false to disable it.

**Returns:** `void`

When enabled, the shading function is filtered to prevent aliasing artifacts.

### set_bounding_box

```cpp
void datalogics_interface::ShadingPattern::set_bounding_box(const Rect &bbox)
```

**Parameters**

- `bbox` ([`const Rect &`](https://docs.datalogics.com/apdfl21/ModernCPP/21.2.0/struct/Rect.md)): The bounding box Rect to set, or NULL to remove it.

**Returns:** `void`

The coordinates are interpreted in the target coordinate space. If present, provides an additional, temporary clipping boundary to the shading. Set to NULL to remove the bounding box.

### set_color_space

```cpp
void datalogics_interface::ShadingPattern::set_color_space(ColorSpace &color_space)
```

**Parameters**

- `color_space` ([`ColorSpace &`](https://docs.datalogics.com/apdfl21/ModernCPP/21.2.0/class/ColorSpace.md)): The ColorSpace to set for the shading pattern.

**Returns:** `void`

This space is restricted to be any space except a Pattern space.

### to_string

```cpp
std::string datalogics_interface::ShadingPattern::to_string() const override
```

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

A string describing the shading pattern.

Converts the shading pattern to a string representation.
