# ShadingPattern Class

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

- Product: Adobe PDF Library 18
- Language: Java
- Version: APDFL18.0.5PlusP2e
- HTML page: https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/ShadingPattern
- Version index: https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/llms.txt

```java
class ShadingPattern : Pattern
```

**Namespace:** `com::datalogics::PDFL`

**Inherits from:** [`Pattern`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/Pattern.md)

**Derived classes:** [`AxialShadingPattern`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/AxialShadingPattern.md)

## Description

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

**Uses types:** [`Color`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/Color.md), [`ColorSpace`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/ColorSpace.md), [`PDFObject`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/PDFObject.md), [`Rect`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/Rect.md)

## Methods

### delete

```java
synchronized void com.datalogics.PDFL.ShadingPattern.delete(Boolean disposing)
```

*protected*

**Parameters**

- `disposing` (`Boolean`)

**Returns:** `synchronized void`

### delete

```java
synchronized void com.datalogics.PDFL.ShadingPattern.delete()
```

**Returns:** `synchronized void`

### finalize

```java
void com.datalogics.PDFL.ShadingPattern.finalize()
```

*protected*

**Returns:** `void`

### getAntiAlias

```java
boolean com.datalogics.PDFL.ShadingPattern.getAntiAlias()
```

**Returns:** `boolean`

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.

### getBackgroundColor

```java
Color com.datalogics.PDFL.ShadingPattern.getBackgroundColor()
```

**Returns:** [`Color`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/Color.md)

The background Color, or NULL if none is set.

Gets the background color of the shading pattern. This color must be in the color space of the shading pattern. If present, it is used to fill the areas that are outside the bounds of the shading object. May be NULL.

### getBoundingBox

```java
Rect com.datalogics.PDFL.ShadingPattern.getBoundingBox()
```

**Returns:** [`Rect`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/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.

### getColorSpace

```java
ColorSpace com.datalogics.PDFL.ShadingPattern.getColorSpace()
```

**Returns:** [`ColorSpace`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/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.

### getPDFObject

```java
PDFObject com.datalogics.PDFL.Pattern.getPDFObject()
```

**Returns:** [`PDFObject`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/PDFObject.md)

The PDFObject representing this pattern in the PDF document.

Gets the underlying PDF object for this pattern.

### setAntiAlias

```java
void com.datalogics.PDFL.ShadingPattern.setAntiAlias(boolean antiAlias)
```

**Parameters**

- `antiAlias` (`boolean`): 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.

### setBackgroundColor

```java
void com.datalogics.PDFL.ShadingPattern.setBackgroundColor(Color color)
```

**Parameters**

- `color` ([`Color`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/Color.md)): The background Color to set, or NULL to remove it.

**Returns:** `void`

Sets the background color of the shading pattern. This color must be in the color space of the shading pattern. If present, it is used to fill the areas that are outside the bounds of the shading object. Set to NULL to remove the background color.

### setBoundingBox

```java
void com.datalogics.PDFL.ShadingPattern.setBoundingBox(Rect boundingBox)
```

**Parameters**

- `boundingBox` ([`Rect`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/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.

### setColorSpace

```java
void com.datalogics.PDFL.ShadingPattern.setColorSpace(ColorSpace colorSpace)
```

**Parameters**

- `colorSpace` ([`ColorSpace`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/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.

### toString

```java
String com.datalogics.PDFL.ShadingPattern.toString()
```

**Returns:** `String`

A string describing the shading pattern.

Converts the shading pattern to a string representation.
