GradientGraph Values Property Delta Engine Documentation

Namespace: DeltaEngine.Rendering2D.Graphs
Assembly: DeltaEngine.Rendering2D.Graphs (in DeltaEngine.Rendering2D.Graphs.dll) Version: 1.1.1.0 (1.1.1)
Syntax

public Color[] Values { get; }

Property Value

Type:  Color 
Remarks

Tests: DeltaEngine.Rendering2D.Graphs.Tests.GradientGraphTests
Examples

2 unit tests call DeltaEngine.Rendering2D.Graphs.GradientGraph.Values
[Test]
public void DrawGraphByAddingNewValues()
{
    var graph = new GradientGraph(new Rectangle(0.1f, 0.4f, 0.8f, 0.2f));
    graph.AddValueBefore(0, Color.Cyan);
    graph.AddValueAfter(0, Color.Purple);
    graph.SetValue(2, Color.Gold);
    Assert.AreEqual(3, graph.Values.Length);
    Assert.AreEqual(Color.Cyan, graph.Values[0]);
    Assert.AreEqual(Color.Purple, graph.Values[1]);
    Assert.AreEqual(Color.Gold, graph.Values[2]);
}
[Test, CloseAfterFirstFrame]
public void SetColors()
{
    var gradient = new GradientGraph(new Rectangle(0.1f, 0.4f, 0.8f, 0.2f));
    gradient.SetValue(0, Color.Red);
    gradient.SetValue(1, Color.Orange);
    Assert.AreEqual(new[]{Color.Red, Color.Orange}, gradient.Values);
}
See Also