# AxialShadingPattern Class

> A color blend that varies along an axis.

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

```cpp
class AxialShadingPattern : ShadingPattern
```

**Namespace:** `datalogics_interface`

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

## Description

A color blend that varies along an axis.

An axial shading specifies a color blend that varies along a linear axis between two endpoints, and indefinitely perpendicular to that axis.

**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), [`Point`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/struct/Point.md), [`Rect`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/struct/Rect.md)

## Constructors

### AxialShadingPattern

```cpp
datalogics_interface::AxialShadingPattern::AxialShadingPattern(ColorSpace &color_space, const std::vector< Point > &coords, const std::vector< std::shared_ptr< Function > > &functions)
```

*constructor*

**Parameters**

- `color_space` ([`ColorSpace &`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/ColorSpace.md)): The color space for the pattern.
- `coords` ([`const std::vector< Point > &`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/struct/Point.md)): The coordinates of the two endpoints of the axial shading.
- `functions` ([`const std::vector< std::shared_ptr< Function > > &`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/Function.md)): One 1-in n-out function, or an array of n 1-in 1-out functions that determine the values of the color channels.

Create an AxialShadingPattern.

## Methods

### get_anti_alias

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

**Returns:** `bool`

true if anti-aliasing is enabled, false otherwise.

Gets whether anti-aliasing is enabled for the shading.

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.4.0/struct/Rect.md)

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

Gets the bounding box of the shading.

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.4.0/class/ColorSpace.md)

The ColorSpace of the shading pattern.

Gets the color space of a shading pattern.

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

### get_coords

```cpp
std::vector< Point > datalogics_interface::AxialShadingPattern::get_coords() const
```

**Returns:** [`std::vector< Point >`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/struct/Point.md)

A list of two Point objects defining the start and end of the axis.

The coordinates of the two endpoints of the axial shading.

### get_domain

```cpp
std::vector< double > datalogics_interface::AxialShadingPattern::get_domain() const
```

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

A list of two doubles, or null if not set.

The domain of the parametric variable t for the axial shading.

An array of two numbers that specify the limiting values of the parametric variable t. This variable t varies linearly between these two values as the gradient varies between the starting and ending points of the axis.

Defaults to [0, 1]. May be NULL.

### get_extend

```cpp
std::vector< bool > datalogics_interface::AxialShadingPattern::get_extend() const
```

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

A list of two booleans, or null if not set.

Whether the shading extends beyond the start and end points of the axis.

An array of two boolean values indicating whether to extend the shading beyond the starting and ending points of the axis, respectively.

Default value: [false, false]. May be NULL.

### get_functions

```cpp
std::vector< std::shared_ptr< Function > > datalogics_interface::AxialShadingPattern::get_functions() const
```

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

A list of Function objects used to compute color values.

The function(s) that determine the color channel values for the shading.

One 1-in n-out function, or an array of n 1-in 1-out functions that determine the values of the color channels, where n is the number of color components in the shading's color space. The functions are called with a parametric variable t which varies across the Domain.

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

Sets whether anti-aliasing is enabled for the shading.

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.4.0/struct/Rect.md)): The bounding box Rect to set, or NULL to remove it.

**Returns:** `void`

Sets the bounding box of the shading.

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.4.0/class/ColorSpace.md)): The ColorSpace to set for the shading pattern.

**Returns:** `void`

Sets the color space of a shading pattern.

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

### set_coords

```cpp
void datalogics_interface::AxialShadingPattern::set_coords(const std::vector< Point > &coords)
```

**Parameters**

- `coords` ([`const std::vector< Point > &`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/struct/Point.md)): A list of exactly two Point objects defining the start and end of the axis.

**Returns:** `void`

Set the coordinates of the two endpoints of the axial shading.

### set_domain

```cpp
void datalogics_interface::AxialShadingPattern::set_domain(const std::vector< double > &domain)
```

**Parameters**

- `domain` (`const std::vector< double > &`): A list of exactly two doubles, or null to remove.

**Returns:** `void`

Set the domain of the parametric variable t for the axial shading.

An array of two numbers that specify the limiting values of the parametric variable t. This variable t varies linearly between these two values as the gradient varies between the starting and ending points of the axis.

Default value: [0, 1]. Pass NULL to remove the domain entry.

### set_extend

```cpp
void datalogics_interface::AxialShadingPattern::set_extend(const std::vector< bool > &extend)
```

**Parameters**

- `extend` (`const std::vector< bool > &`): A list of exactly two booleans, or null to remove.

**Returns:** `void`

Set whether the shading extends beyond the start and end points of the axis.

An array of two boolean values indicating whether to extend the shading beyond the starting and ending points of the axis, respectively.

Default value: [false, false]. Pass NULL to remove the extend entry.

### set_functions

```cpp
void datalogics_interface::AxialShadingPattern::set_functions(const std::vector< std::shared_ptr< Function > > &functions)
```

**Parameters**

- `functions` ([`const std::vector< std::shared_ptr< Function > > &`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/Function.md)): A list of one or more Function objects. Must contain at least one function.

**Returns:** `void`

Set the function(s) that determine the color channel values for the shading.

One 1-in n-out function, or an array of n 1-in 1-out functions that determine the values of the color channels, where n is the number of color components in the shading's color space. The functions are called with a parametric variable t which varies across the Domain.

### to_string

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

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

A formatted string describing this AxialShadingPattern.

Return a string representation of the AxialShadingPattern.

The string includes the color space, background color, bounding box, anti-alias flag, coordinates, function, domain, and extend values.
