Class LinearGradientBrush
Represents the class that defines to paints the node with linear color transitions
Inherited Members
Namespace: Syncfusion.Blazor.Diagram
Assembly: Syncfusion.Blazor.dll
Syntax
public class LinearGradientBrush : GradientBrush, IDiagramObject, ICloneable
Examples
Node Node = new Node()
{
// Position of the node
OffsetX = 250,
OffsetY = 250,
// Size of the node
Width = 100,
Height = 100,
// Add 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}
},
}
},
};
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 start point of the Linear gradient.
Declaration
public double X1 { get; set; }
Property Value
Type |
---|
System.Double |
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 start point of the Linear gradient.
Declaration
public double X2 { get; set; }
Property Value
Type |
---|
System.Double |
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 endpoint of the Linear gradient.
Declaration
public double Y1 { get; set; }
Property Value
Type |
---|
System.Double |
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 endpoint of the Linear gradient.
Declaration
public double Y2 { get; set; }
Property Value
Type |
---|
System.Double |
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 | LinearGradient |
Overrides
Implements
System.ICloneable