# PdfAxialShading Class

Type 2 (axial) shadings define a color blend that varies along a linear axis between two endpoints and extends indefinitely perpendicular to that axis. The shading may optionally be extended beyond either or both endpoints by continuing the boundary colors indefinitely.

`public sealed class PdfAxialShading : PdfShading`

```
Public NotInheritable Class PdfAxialShading
Inherits PdfShading
```

- Inheritance:
- PdfAxialShading

### Constructors

#### PdfAxialShading(PdfPoint, PdfPoint, PdfColorSpace)

Initializes a new instance of the PdfAxialShading class that has the specified StartPoint, EndPoint and, optionally, ColorSpace. The Function property should be set subsequently.

`public PdfAxialShading(PdfPoint startPoint, PdfPoint endPoint, PdfColorSpace colorSpace = null)`

`Public Sub New(startPoint As PdfPoint, endPoint As PdfPoint, colorSpace As PdfColorSpace = Nothing)`

##### Parameters

`startPoint`

- PdfPoint

The starting coordinates of the axis, expressed in the shading's target coordinate space.

`endPoint`

- PdfPoint

The ending coordinates of the axis, expressed in the shading's target coordinate space.

`colorSpace`

- PdfColorSpace

The color space in which color values shall be expressed. If omitted, the DeviceRGB is used.

#### PdfAxialShading(PdfPoint, PdfPoint, PdfShadingColor[])

Initializes a new instance of the PdfAxialShading class that has the specified StartPoint, EndPoint and shading colors.

Two `colors`

are converted to a PdfExponentialInterpolationFunction and more than two are converted to a PdfStitchingFunction (stitching two or more PdfExponentialInterpolationFunctions) that is then set to the Function.

The Domain is set from the Offset of the first and the last PdfShadingColor.

`public PdfAxialShading(PdfPoint startPoint, PdfPoint endPoint, params PdfShadingColor[] colors)`

`Public Sub New(startPoint As PdfPoint, endPoint As PdfPoint, ParamArray colors As PdfShadingColor())`

##### Parameters

`startPoint`

- PdfPoint

The starting coordinates of the axis, expressed in the shading's target coordinate space.

`endPoint`

- PdfPoint

The ending coordinates of the axis, expressed in the shading's target coordinate space.

`colors`

- PdfShadingColor[]

The PdfShadingColors to set on this shading.

##### Exceptions

`colors`

is null.

`colors`

count is less than 2 or Color space of any PdfShadingColor is not equal to the ColorSpace or Offset of any PdfShadingColor is not greater than the Offset of all previous PdfShadingColors.

#### PdfAxialShading(PdfPoint, PdfPoint, PdfColor, PdfColor)

Initializes a new instance of the PdfAxialShading class that has the specified StartPoint, EndPoint and two shading colors.

Colors `startColor`

and `endColor`

are converted to a PdfExponentialInterpolationFunction that is then set to the Function.

`public PdfAxialShading(PdfPoint startPoint, PdfPoint endPoint, PdfColor startColor, PdfColor endColor)`

`Public Sub New(startPoint As PdfPoint, endPoint As PdfPoint, startColor As PdfColor, endColor As PdfColor)`

##### Parameters

`startPoint`

- PdfPoint

The starting coordinates of the axis, expressed in the shading's target coordinate space.

`endPoint`

- PdfPoint

The ending coordinates of the axis, expressed in the shading's target coordinate space.

`startColor`

- PdfColor

The shading color at the starting coordinates of the axis.

`endColor`

- PdfColor

The shading color at the ending coordinates of the axis.

##### Exceptions

Color Space of `startColor`

and `endColor`

are not equal.

#### PdfAxialShading(PdfPoint, PdfPoint, IList<PdfShadingColor>)

Initializes a new instance of the PdfAxialShading class that has the specified StartPoint, EndPoint and shading colors.

Two `colors`

are converted to a PdfExponentialInterpolationFunction and more than two are converted to a PdfStitchingFunction (stitching two or more PdfExponentialInterpolationFunctions) that is then set to the Function.

The Domain is set from the Offset of the first and the last PdfShadingColor.

`public PdfAxialShading(PdfPoint startPoint, PdfPoint endPoint, IList<PdfShadingColor> colors)`

`Public Sub New(startPoint As PdfPoint, endPoint As PdfPoint, colors As IList(Of PdfShadingColor))`

##### Parameters

`startPoint`

- PdfPoint

The starting coordinates of the axis, expressed in the shading's target coordinate space.

`endPoint`

- PdfPoint

The ending coordinates of the axis, expressed in the shading's target coordinate space.

`colors`

- IList<PdfShadingColor>

The PdfShadingColors to set on this shading.

##### Exceptions

`colors`

is null.

`colors`

count is less than 2 or Color space of any PdfShadingColor is not equal to the ColorSpace or Offset of any PdfShadingColor is not greater than the Offset of all previous PdfShadingColors.

### Properties

#### Domain

*(Optional)* A PdfNumberRange specifying the limiting values of a parametric variable *t*. The variable is considered to vary linearly between these two values as the color gradient varies between the starting and ending points of the axis. The variable *t* becomes the input argument to the color function(s).

Default value: [0, 1].

##### Property Value

A PdfNumberRange specifying the limiting values of a parametric variable *t*.

##### See Also

#### EndPoint

*(Required)* The ending coordinates of the axis, expressed in the shading's target coordinate space.

##### Property Value

The ending coordinates of the axis, expressed in the shading's target coordinate space.

##### See Also

#### ExtendEndPoint

*(Optional)* A boolean value specifying whether to extend the shading beyond the ending point of the axis.

Default value: false.

##### Property Value

A boolean value specifying whether to extend the shading beyond the ending point of the axis.

##### See Also

#### ExtendStartPoint

*(Optional)* A boolean value specifying whether to extend the shading beyond the starting point of the axis.

Default value: false.

##### Property Value

A boolean value specifying whether to extend the shading beyond the starting point of the axis.

##### See Also

#### Function

*(Required)* A 1-in, *n*-out function or an array of *n* 1-in, 1-out functions (where *n* is the number of color components in the shading dictionary's color space). The function(s) shall be called with values of the parametric variable *t* in the domain defined by the Domain entry. Each function's domain shall be a superset of that of the shading dictionary. If the value returned by the function for a given color component is out of range, it shall be adjusted to the nearest valid value.

##### tip

Use the static method CreateFunction(IList<PdfShadingColor>) to create an interpolation function from two or more PdfShadingColors.

`public IList<PdfFunction> Function { get; set; }`

`Public Property Function As IList(Of PdfFunction)`

##### Property Value

A 1-in, *n*-out function or an array of *n* 1-in, 1-out functions.

##### Exceptions

Value is null or empty or any of its elements is null.

The number of functions is not 1 and is not equal to the ColorSpace.ColorantCount or the function's input dimensionality is invalid (the Domain's Count should be 1) or the function's output dimensionality is invalid (if the number of functions is 1, then it should be equal to the ColorSpace.ColorantCount; otherwise, it should be 1) for any function contained in the PdfFunction list.

##### See Also

#### ShadingType

Gets the Axial value.

`public override PdfShadingType ShadingType { get; }`

`Public Overrides ReadOnly Property ShadingType As PdfShadingType`

##### Property Value

The Axial value.

##### Overrides

#### StartPoint

*(Required)* The starting coordinates of the axis, expressed in the shading's target coordinate space.

##### Property Value

The starting coordinates of the axis, expressed in the shading's target coordinate space.

##### See Also

### Inherited Properties

Background |
## noteIn the opaque imaging model, the effect is as if the painting operation were performed twice: first with the background color and then with the shading. ## noteThe background color is applied only when the shading is used as part of a PdfShadingPattern, not when it is painted directly with the PdfShadingContent operator. (Inherited from PdfShading) |

BoundingBox |
(Inherited from PdfShading) |

ColorSpace |
(Inherited from PdfShading) |

Document | Gets the PdfDocument associated with this PdfContentResource or null if no PdfDocument is associated with this PdfContentResource. (Inherited from PdfContentResource) |

IsAntiAlias |
## noteThe shading operators sample shading functions at a rate determined by the resolution of the output device. Aliasing can occur if the function is not smooth—that is, if it has a high spatial frequency relative to the sampling rate. Anti-aliasing can be computationally expensive and is usually unnecessary, since most shading functions are smooth enough or are sampled at a high enough frequency to avoid aliasing effects. Anti-aliasing may not be implemented on some output devices, in which case this flag is ignored. Default value: false. (Inherited from PdfShading) |

Metadata |
(Inherited from PdfObject) |

### Inherited Methods

CreateFunction(IList<PdfShadingColor>) | Creates an interpolation function from the specified list of PdfShadingColors. Two The function's Domain is set from the Offset of the first and the last PdfShadingColor. (Inherited from PdfShading) |

SetBoundingBox(Double, Double, Double, Double) | Sets the BoundingBox. (Inherited from PdfShading) |