using System.ComponentModel;
using System.Drawing;
namespace DevComponents.DotNetBar.Rendering
{
///
/// Represents the color table of linear gradient.
///
public class LinearGradientColorTable
{
public static readonly LinearGradientColorTable Empty = new LinearGradientColorTable();
#region Private variables
private Color _Start = Color.Empty;
private Color _End = Color.Empty;
private int _GradientAngle = 90;
#endregion
#region Constructors
///
/// Creates new instance of the object.
///
public LinearGradientColorTable() { }
///
/// Creates new instance of the object.
///
/// Start color.
public LinearGradientColorTable(Color start)
{
this.Start = start;
}
///
/// Creates new instance of the object.
///
/// Start color.
/// End color.
public LinearGradientColorTable(Color start, Color end)
{
this.Start = start;
this.End = end;
}
///
/// Creates new instance of the object.
///
/// Start color in hexadecimal representation like FFFFFF.
/// End color in hexadecimal representation like FFFFFF.
public LinearGradientColorTable(string start, string end)
{
this.Start = ColorScheme.GetColor(start);
this.End = ColorScheme.GetColor(end);
}
///
/// Creates new instance of the object.
///
/// Start color in 32-bit RGB representation.
public LinearGradientColorTable(int start)
{
this.Start = ColorScheme.GetColor(start);
}
///
/// Creates new instance of the object.
///
/// Start color in 32-bit RGB representation.
/// End color in 32-bit RGB representation.
public LinearGradientColorTable(int start, int end)
{
this.Start = ColorScheme.GetColor(start);
this.End = ColorScheme.GetColor(end);
}
///
/// Creates new instance of the object.
///
/// Start color in 32-bit RGB representation.
/// End color in 32-bit RGB representation.
/// Gradient angle.
public LinearGradientColorTable(int start, int end, int gradientAngle)
{
this.Start = ColorScheme.GetColor(start);
this.End = ColorScheme.GetColor(end);
this.GradientAngle = gradientAngle;
}
///
/// Creates new instance of the object.
///
/// Start color.
/// End color.
/// Gradient angle.
public LinearGradientColorTable(Color start, Color end, int gradientAngle)
{
this.Start = start;
this.End = end;
this.GradientAngle = gradientAngle;
}
#endregion
#region Public properties
#region Start
///
/// Gets or sets the start color.
///
public Color Start
{
get { return (_Start); }
set { _Start = value; }
}
#endregion
#region End
///
/// Gets or sets the end color.
///
public Color End
{
get { return (_End); }
set { _End = value; }
}
#endregion
#region GradientAngle
///
/// Gets or sets the gradient angle. Default value is 90.
///
public int GradientAngle
{
get { return (_GradientAngle); }
set { _GradientAngle = value; }
}
#endregion
#region IsEmpty
///
/// Gets whether both colors assigned are empty.
///
[Browsable(false)]
public virtual bool IsEmpty
{
get { return (Start.IsEmpty && End.IsEmpty && GradientAngle == 90); }
}
#endregion
#endregion
}
}