LinearGradientBrush Class

A gradient along a line: the color is constant on the perpendiculars of that line.

public sealed class LinearGradientBrush : GradientBrush

Remarks

The parameter of a position is its projection on the line from LinearGradientBrush.Start (0) to LinearGradientBrush.End (1). When both points are the same, the whole canvas has the color of the last stop.

Inheritance
GradientBrush LinearGradientBrush

Constructors

NameDescription
LinearGradientBrush(PointD, PointD, ReadOnlySpan<GradientStop>)Initializes a new instance of the LinearGradientBrush class.

LinearGradientBrush(PointD, PointD, ReadOnlySpan<GradientStop>)

LinearGradientBrush.cs

Initializes a new instance of the LinearGradientBrush class.

public LinearGradientBrush(PointD start, PointD end, ReadOnlySpan<GradientStop> stops)

Parameters

start PointD
The position of offset 0, in canvas coordinates.
end PointD
The position of offset 1, in canvas coordinates.
stops ReadOnlySpan<GradientStop>
The stops, in increasing order of offset. They are copied.

Exceptions

ArgumentException
There is no stop, the offsets decrease, or a coordinate is not a finite number.
ArgumentOutOfRangeException
The magnitude of a coordinate exceeds 16777216.

Properties

NameDescription
EndGets the position of offset 1.
StartGets the position of offset 0.

Gets the position of offset 1.

public PointD End { get; }

Property value

PointD

Gets the position of offset 0.

public PointD Start { get; }

Property value

PointD