using System;
using System.Text;
using System.Drawing;
namespace DevComponents.DotNetBar
{
///
/// Represents complex gradient color table.
///
public class GradientColorTable
{
///
/// Creates new instance of the object.
///
public GradientColorTable() { }
///
/// Creates new instance of the object and initializes it with default values.
///
/// Start color
/// End color
public GradientColorTable(Color color)
{
BackgroundColorBlendCollection.InitializeCollection(Colors, color);
}
///
/// Creates new instance of the object and initializes it with default values.
///
/// Start color
/// End color
public GradientColorTable(int color1, int color2)
: this(color1, color2, 90)
{
}
///
/// Creates new instance of the object and initializes it with default values.
///
/// Start color
/// End color
public GradientColorTable(Color color1, Color color2)
: this(color1, color2, 90)
{
}
///
/// Creates new instance of the object and initializes it with default values.
///
/// Start color
/// End color
/// Linear gradient angle
public GradientColorTable(int color1, int color2, int linearGradientAngle)
{
BackgroundColorBlendCollection.InitializeCollection(Colors, color1, color2);
this.LinearGradientAngle = linearGradientAngle;
}
///
/// Creates new instance of the object and initializes it with default values.
///
/// Start color
/// End color
/// Linear gradient angle
public GradientColorTable(Color color1, Color color2, int linearGradientAngle)
{
BackgroundColorBlendCollection.InitializeCollection(Colors, color1, color2);
this.LinearGradientAngle = linearGradientAngle;
}
public bool IsEmpty
{
get
{
return Colors.Count == 0;
}
}
///
/// Gets or sets the color collection blend that describes the gradient.
///
public BackgroundColorBlendCollection Colors = new BackgroundColorBlendCollection();
///
/// Gets or sets the gradient type.
///
public eGradientType GradientType = eGradientType.Linear;
///
/// Gets or sets the linear gradient angle.
///
public int LinearGradientAngle = 90;
///
/// Creates a copy of table.
///
/// A copy.
public GradientColorTable Clone()
{
GradientColorTable table = new GradientColorTable();
foreach (BackgroundColorBlend item in this.Colors)
{
table.Colors.Add(new BackgroundColorBlend(item.Color, item.Position));
}
table.LinearGradientAngle = this.LinearGradientAngle;
return table;
}
}
}