Table of Contents

Class LinearGradientBrush

Namespace
Aspose.Imaging.Brushes
Assembly
Aspose.Imaging.dll

Encapsulates a Brush with a linear gradient. This class cannot be inherited.

public sealed class LinearGradientBrush : LinearGradientBrushBase, IDisposable
Inheritance
LinearGradientBrush
Implements
Inherited Members

Constructors

LinearGradientBrush()

Initializes a new instance of the LinearGradientBrush class with default parameters. The starting color is black, the ending color is white, the angle is 45 degrees and the rectangle is located in (0,0) with size (1,1).

public LinearGradientBrush()

LinearGradientBrush(Point, Point, Color, Color)

Initializes a new instance of the LinearGradientBrush class.

public LinearGradientBrush(Point point1, Point point2, Color color1, Color color2)

Parameters

point1 Point

The point1.

point2 Point

The point2.

color1 Color

The color1.

color2 Color

The color2.

LinearGradientBrush(PointF, PointF, Color, Color)

Initializes a new instance of the LinearGradientBrush class.

public LinearGradientBrush(PointF point1, PointF point2, Color color1, Color color2)

Parameters

point1 PointF

The point1.

point2 PointF

The point2.

color1 Color

The color1.

color2 Color

The color2.

LinearGradientBrush(Rectangle, Color, Color, float)

Initializes a new instance of the LinearGradientBrush class.

public LinearGradientBrush(Rectangle rect, Color color1, Color color2, float angle)

Parameters

rect Rectangle

The rectangle.

color1 Color

The color1.

color2 Color

The color2.

angle float

The angle.

LinearGradientBrush(Rectangle, Color, Color, float, bool)

Initializes a new instance of the LinearGradientBrush class.

public LinearGradientBrush(Rectangle rect, Color color1, Color color2, float angle, bool isAngleScalable)

Parameters

rect Rectangle

The rectangle.

color1 Color

The color1.

color2 Color

The color2.

angle float

The angle.

isAngleScalable bool

if set to true [is angle scalable].

LinearGradientBrush(RectangleF, Color, Color, float)

Initializes a new instance of the LinearGradientBrush class.

public LinearGradientBrush(RectangleF rect, Color color1, Color color2, float angle)

Parameters

rect RectangleF

The rectangle.

color1 Color

The color1.

color2 Color

The color2.

angle float

The angle.

LinearGradientBrush(RectangleF, Color, Color, float, bool)

Initializes a new instance of the LinearGradientBrush class.

public LinearGradientBrush(RectangleF rect, Color color1, Color color2, float angle, bool isAngleScalable)

Parameters

rect RectangleF

The rectangle.

color1 Color

The color1.

color2 Color

The color2.

angle float

The angle.

isAngleScalable bool

if set to true [is angle scalable].

Properties

Blend

Gets or sets a Blend that specifies positions and factors that define a custom falloff for the gradient.

public Blend Blend { get; set; }

Property Value

Blend

A Blend that represents a custom falloff for the gradient.

EndColor

Gets or sets the ending gradient color.

public Color EndColor { get; set; }

Property Value

Color

The ending gradient color.

InterpolationColors

Gets or sets a ColorBlend that defines a multicolor linear gradient.

[Obsolete("This property is not used anymore in this class. Use instance of the LinearMulticolorGradientBrush class instead.")]
public ColorBlend InterpolationColors { get; set; }

Property Value

ColorBlend

A ColorBlend that defines a multicolor linear gradient.

LinearColors

Gets or sets the starting and ending colors of the gradient.

[Obsolete("Use StartColor and EndColor properties instead.")]
public Color[] LinearColors { get; set; }

Property Value

Color[]

An array of two Color structures that represents the starting and ending colors of the gradient.

StartColor

Gets or sets the starting gradient color.

public Color StartColor { get; set; }

Property Value

Color

The starting gradient color.

Methods

SetBlendTriangularShape(float)

Creates a linear gradient with a center color and a linear falloff to a single color on both ends.

public void SetBlendTriangularShape(float focus)

Parameters

focus float

A value from 0 through 1 that specifies the center of the gradient (the point where the gradient is composed of only the ending color).

SetBlendTriangularShape(float, float)

Creates a linear gradient with a center color and a linear falloff to a single color on both ends.

public void SetBlendTriangularShape(float focus, float scale)

Parameters

focus float

A value from 0 through 1 that specifies the center of the gradient (the point where the gradient is composed of only the ending color).

scale float

A value from 0 through1 that specifies how fast the colors falloff from the starting color to focus (ending color)

SetSigmaBellShape(float)

Creates a gradient falloff based on a bell-shaped curve.

public void SetSigmaBellShape(float focus)

Parameters

focus float

A value from 0 through 1 that specifies the center of the gradient (the point where the starting color and ending color are blended equally).

SetSigmaBellShape(float, float)

Creates a gradient falloff based on a bell-shaped curve.

public void SetSigmaBellShape(float focus, float scale)

Parameters

focus float

A value from 0 through 1 that specifies the center of the gradient (the point where the gradient is composed of only the ending color).

scale float

A value from 0 through 1 that specifies how fast the colors falloff from the focus.