Class GradientStop
Represents a gradient stop, which defines a color at a specific position within a gradient.
Inherited Members
Namespace: Syncfusion.Blazor.Diagram
Assembly: Syncfusion.Blazor.dll
Syntax
public class GradientStop : DiagramObject, IDiagramObject, ICloneable
Remarks
A gradient stop is used to define where the colors appear along the gradient. Each stop has a color, an offset, and an optional opacity level.
Use multiple GradientStop objects to create complex gradient effects.
Constructors
GradientStop()
Initializes a new instance of the GradientStop.
Declaration
public GradientStop()
GradientStop(GradientStop)
Creates a new instance of the GradientStop from the given GradientStop.
Declaration
public GradientStop(GradientStop src)
Parameters
Type | Name | Description |
---|---|---|
GradientStop | src | The GradientStop instance to copy from. |
Properties
Color
Gets or sets the color to be filled over the specified region.
Declaration
public string Color { get; set; }
Property Value
Type | Description |
---|---|
System.String | A System.String representing the color code. The default value is an empty string. |
Examples
Node Node = new Node()
{
Style = new ShapeStyle()
{
Gradient = new RadialGradientBrush()
{
CX = 50,
CY = 50,
GradientStops = new DiagramObjectCollection<GradientStop>()
{
new GradientStop(){ Color = "white", Offset = 0},
new GradientStop(){ Color = "#6BA5D7", Offset = 100}
},
}
},
};
Offset
Gets or sets the position at which the previous color transition ends, and a new color transition starts.
Declaration
public Nullable<double> Offset { get; set; }
Property Value
Type | Description |
---|---|
System.Nullable<System.Double> | A System.Double representing the offset. Default is |
Examples
Node Node = new Node()
{
Style = new ShapeStyle()
{
Gradient = new RadialGradientBrush()
{
//Center point of the inner circle
FX = 20,
FY = 20,
//Center point of the outer circle
CX = 50,
CY = 50,
//Radius of a radial gradient
R = 50,
//Set an array of stop objects
GradientStops = new DiagramObjectCollection<GradientStop>()
{
new GradientStop(){ Color = "white", Offset = 0},
new GradientStop(){ Color = "#6BA5D7", Offset = 100}
},
}
},
};
Opacity
Gets or sets the transparency level of the region.
Declaration
public double Opacity { get; set; }
Property Value
Type | Description |
---|---|
System.Double | A System.Double representing the opacity. Default is |
Examples
Node Node = new Node()
{
Style = new ShapeStyle()
{
Gradient = new RadialGradientBrush()
{
//Center point of the inner circle
FX = 20,
FY = 20,
//Center point of the outer circle
CX = 50,
CY = 50,
//Radius of a radial gradient
R = 50,
//Set an array of stop objects
GradientStops = new DiagramObjectCollection<GradientStop>()
{
new GradientStop(){ Color = "#6BA5D7", Offset = 100,Opacity=0.5}
},
}
},
};
Methods
Clone()
Creates a new object that is a copy of the current gradient stop.
Declaration
public override object Clone()
Returns
Type | Description |
---|---|
System.Object | A new GradientStop instance with copied properties. |