// ReSharper disable MemberCanBePrivate.Global
// ReSharper disable AutoPropertyCanBeMadeGetOnly.Global
using System.Drawing;
using CUE.NET.Devices.Generic;
namespace CUE.NET.Brushes
{
///
/// Represents a brush drawing only a single color.
///
public class SolidColorBrush : AbstractBrush
{
#region Properties & Fields
///
/// Gets or sets the color drawn by the brush.
///
public CorsairColor Color { get; set; }
#endregion
#region Constructors
///
/// Initializes a new instance of the class.
///
/// The color drawn by the brush.
public SolidColorBrush(CorsairColor color)
{
this.Color = color;
}
#endregion
#region Methods
///
/// Gets the color at an specific point assuming the brush is drawn into the given rectangle.
///
/// The rectangle in which the brush should be drawn.
/// The target (key/point) from which the color should be taken.
/// The color at the specified point.
protected override CorsairColor GetColorAtPoint(RectangleF rectangle, BrushRenderTarget renderTarget)
{
return Color;
}
#endregion
#region Operators
///
/// Converts a to a .
///
/// The to convert.
public static explicit operator SolidColorBrush(Color color)
{
return new SolidColorBrush(color);
}
///
/// Converts a to a .
///
/// The to convert.
public static implicit operator Color(SolidColorBrush brush)
{
return brush.Color;
}
///
/// Converts a to a .
///
/// The to convert.
public static explicit operator SolidColorBrush(CorsairColor color)
{
return new SolidColorBrush(color);
}
///
/// Converts a to a .
///
/// The to convert.
public static implicit operator CorsairColor(SolidColorBrush brush)
{
return brush.Color;
}
#endregion
}
}