Class LinearGradientBrush
Represents the class that provides functionality to paint nodes with a linear color transition using GradientBrush.
Inherited Members
Namespace: Syncfusion.Blazor.Diagram
Assembly: Syncfusion.Blazor.dll
Syntax
public class LinearGradientBrush : GradientBrush, IDiagramObject, ICloneable
Remarks
This brush allows you to specify the start and end points for linear gradients.
The linear gradients are defined by two points and a collection of GradientStop objects which specify the colors and positions along the gradient.
Examples
Node Node = new Node()
{
OffsetX = 250,
OffsetY = 250,
Width = 100,
Height = 100,
Style = new ShapeStyle()
{
Gradient = new LinearGradientBrush()
{
X1 = 0,
Y1 = 0,
X2 = 50,
Y2 = 50,
GradientStops = new DiagramObjectCollection<GradientStop>()
{
new GradientStop(){ Color = "white", Offset = 0},
new GradientStop(){ Color = "#6BA5D7", Offset = 100}
},
}
},
};
Constructors
LinearGradientBrush()
Initializes a new instance of the LinearGradientBrush.
Declaration
public LinearGradientBrush()
LinearGradientBrush(LinearGradientBrush)
Creates a new LinearGradientBrush from the given LinearGradientBrush.
Declaration
public LinearGradientBrush(LinearGradientBrush src)
Parameters
Type | Name | Description |
---|---|---|
LinearGradientBrush | src | LinearGradient. |
Properties
X1
Gets or sets the x-coordinate of the start point of the linear gradient.
Declaration
public double X1 { get; set; }
Property Value
Type | Description |
---|---|
System.Double | A System.Double representing the x-coordinate. Initialized to |
Remarks
The X1
property defines the horizontal start position of the gradient in the brush space.
Examples
Node Node = new Node()
{
Style = new ShapeStyle()
{
Gradient = new LinearGradientBrush()
{
//Start point of linear gradient
X1 = 0,
Y1 = 0,
//End point of linear gradient
X2 = 50,
Y2 = 50,
//Sets an array of stop objects
GradientStops = new DiagramObjectCollection<GradientStop>()
{
new GradientStop(){ Color = "white", Offset = 0},
new GradientStop(){ Color = "#6BA5D7", Offset = 100}
},
}
},
};
X2
Gets or sets the x-coordinate of the endpoint of the linear gradient.
Declaration
public double X2 { get; set; }
Property Value
Type | Description |
---|---|
System.Double | A System.Double representing the x-coordinate. Initialized to |
Remarks
The X2
property defines the horizontal end position of the gradient in the brush space.
Examples
Node Node = new Node()
{
Style = new ShapeStyle()
{
Gradient = new LinearGradientBrush()
{
//Start point of linear gradient
X1 = 0,
Y1 = 0,
//End point of linear gradient
X2 = 50,
Y2 = 50,
//Sets an array of stop objects
GradientStops = new DiagramObjectCollection<GradientStop>()
{
new GradientStop(){ Color = "white", Offset = 0},
new GradientStop(){ Color = "#6BA5D7", Offset = 100}
},
}
},
};
Y1
Gets or sets the y-coordinate of the start point of the linear gradient.
Declaration
public double Y1 { get; set; }
Property Value
Type | Description |
---|---|
System.Double | A System.Double representing the y-coordinate. Initialized to |
Remarks
The Y1
property defines the vertical start position of the gradient in the brush space.
Examples
Node Node = new Node()
{
Style = new ShapeStyle()
{
Gradient = new LinearGradientBrush()
{
//Start point of linear gradient
X1 = 0,
Y1 = 0,
//End point of linear gradient
X2 = 50,
Y2 = 50,
//Sets an array of stop objects
GradientStops = new DiagramObjectCollection<GradientStop>()
{
new GradientStop(){ Color = "white", Offset = 0},
new GradientStop(){ Color = "#6BA5D7", Offset = 100}
},
}
},
};
Y2
Gets or sets the y-coordinate of the endpoint of the linear gradient.
Declaration
public double Y2 { get; set; }
Property Value
Type | Description |
---|---|
System.Double | A System.Double representing the y-coordinate. Initialized to |
Remarks
The Y2
property defines the vertical end position of the gradient in the brush space.
Examples
Node Node = new Node()
{
Style = new ShapeStyle()
{
Gradient = new LinearGradientBrush()
{
//Start point of linear gradient
X1 = 0,
Y1 = 0,
//End point of linear gradient
X2 = 50,
Y2 = 50,
//Sets an array of stop objects
GradientStops = new DiagramObjectCollection<GradientStop>()
{
new GradientStop(){ Color = "white", Offset = 0},
new GradientStop(){ Color = "#6BA5D7", Offset = 100}
},
}
},
};
Methods
Clone()
Creates a new object that is a copy of the current linear gradient.
Declaration
public override object Clone()
Returns
Type | Description |
---|---|
System.Object | A new LinearGradientBrush object that is a copy of this instance. |