# LinearGradientBrush

## Content

[**DsPdfJS API v9.1.3**](../README)

***

[DsPdfJS API](../globals) / LinearGradientBrush

# Class: LinearGradientBrush

Represents a linear gradient brush.

## Extends

- [`Brush`](Brush)

## Constructors

### Constructor

> **new LinearGradientBrush**(`linearGradientBrushProperties`): `LinearGradientBrush`

Creates a linear gradient brush with specified properties.

#### Parameters

##### linearGradientBrushProperties

[`LinearGradientBrushProperties`](../type-aliases/LinearGradientBrushProperties)

The settings for creating a linear gradient brush.

#### Returns

`LinearGradientBrush`

#### Example

```ts
const brush = new LinearGradientBrush({
    startColor: "ForestGreen",
    startPoint: { x: 0, y: 0 },
    endColor: "Yellow",
    endPoint: { x: 1, y: 0 }
});
```

#### Overrides

`Brush.constructor`

### Constructor

> **new LinearGradientBrush**(`om`, `linearGradientBrushProperties`): `LinearGradientBrush`

Creates a linear gradient brush with specified properties.

#### Parameters

##### om

[`ObjectManager`](ObjectManager)

An object manager that controls the lifetime of the LinearGradientBrush object.

##### linearGradientBrushProperties

[`LinearGradientBrushProperties`](../type-aliases/LinearGradientBrushProperties)

The settings for creating a linear gradient brush.

#### Returns

`LinearGradientBrush`

#### Overrides

`Brush.constructor`

## Accessors

### endColor

#### Get Signature

> **get** **endColor**(): [`Color`](../type-aliases/Color)

Gets the ending gradient color.

##### Returns

[`Color`](../type-aliases/Color)

***

### endPoint

#### Get Signature

> **get** **endPoint**(): [`Point`](../type-aliases/Point)

Gets the end point of the linear gradient brush. (0, 0) is the top-left corner, (1, 1) is the bottom-right corner.

##### Returns

[`Point`](../type-aliases/Point)

***

### gradientStops

#### Get Signature

> **get** **gradientStops**(): [`GradientStop`](../type-aliases/GradientStop)[] \| `null`

Gets the array of gradient stops.

##### Returns

[`GradientStop`](../type-aliases/GradientStop)[] \| `null`

***

### id

#### Get Signature

> **get** **id**(): `number`

Gets the reference to the object.

##### Returns

`number`

#### Inherited from

[`Brush`](Brush).[`id`](Brush#id)

***

### om

#### Get Signature

> **get** **om**(): [`ObjectManager`](ObjectManager)

Gets the owner [ObjectManager](ObjectManager) instance.

##### Returns

[`ObjectManager`](ObjectManager)

#### Inherited from

[`Brush`](Brush).[`om`](Brush#om)

***

### startColor

#### Get Signature

> **get** **startColor**(): [`Color`](../type-aliases/Color)

Gets the starting gradient color.

##### Returns

[`Color`](../type-aliases/Color)

***

### startPoint

#### Get Signature

> **get** **startPoint**(): [`Point`](../type-aliases/Point)

Gets the start point of the linear gradient brush. (0, 0) is the top-left corner, (1, 1) is the bottom-right corner.

##### Returns

[`Point`](../type-aliases/Point)

***

### type

#### Get Signature

> **get** **type**(): [`BrushType`](../enumerations/BrushType)

Gets the type of the brush.

##### Returns

[`BrushType`](../enumerations/BrushType)

#### Overrides

[`Brush`](Brush).[`type`](Brush#type)

## Methods

### free()

> **free**(): `void`

Detaches the object from the [ObjectManager](ObjectManager) and deallocates its memory, if possible.

#### Returns

`void`

#### Inherited from

[`Brush`](Brush).[`free`](Brush#free)

***

### rebind()

> **rebind**(`omTo`): `void`

Rebinds the object from the current [ObjectManager](ObjectManager) to the specified one.

#### Parameters

##### omTo

[`ObjectManager`](ObjectManager)

The new [ObjectManager](ObjectManager) for the object.

#### Returns

`void`

#### Inherited from

[`Brush`](Brush).[`rebind`](Brush#rebind)
