Added even more xml-comments

This commit is contained in:
DarthAffe committed 2015-10-18 11:41:42 +02:00
1 parent 6de1087c1f
commit 5fc7abc9db
30 files changed
+639 -17

No files matched your search

@@ -6,19 +6,32 @@ using System.Linq;
namespace CUE.NET.Devices.Keyboard.Brushes.Gradient
{
/// <summary>
/// Represents a basic gradient.
/// </summary>
public abstract class AbstractGradient : IGradient
{
#region Properties & Fields
/// <summary>
/// Gets a list of the stops used by this gradient.
/// </summary>
public IList<GradientStop> GradientStops { get; } = new List<GradientStop>();
#endregion
#region Constructors
/// <summary>
/// Initializes a new instance of the <see cref="AbstractGradient"/> class.
/// </summary>
protected AbstractGradient()
{ }
/// <summary>
/// Initializes a new instance of the <see cref="AbstractGradient"/> class.
/// </summary>
/// <param name="gradientStops">The stops with which the gradient should be initialized.</param>
protected AbstractGradient(params GradientStop[] gradientStops)
{
foreach (GradientStop gradientStop in gradientStops)
@@ -29,6 +42,11 @@ namespace CUE.NET.Devices.Keyboard.Brushes.Gradient
#region Methods
/// <summary>
/// Clips the offset and ensures, that it is inside the bounds of the stop list.
/// </summary>
/// <param name="offset"></param>
/// <returns></returns>
protected float ClipOffset(float offset)
{
float max = GradientStops.Max(n => n.Offset);
@@ -42,6 +60,11 @@ namespace CUE.NET.Devices.Keyboard.Brushes.Gradient
return offset;
}
/// <summary>
/// Gets the color of the gradient on the specified offset.
/// </summary>
/// <param name="offset">The percentage offset to take the color from.</param>
/// <returns>The color at the specific offset.</returns>
public abstract Color GetColor(float offset);
#endregion
@@ -5,18 +5,32 @@ using System.Drawing;
namespace CUE.NET.Devices.Keyboard.Brushes.Gradient
{
/// <summary>
/// Represents a stop on a gradient.
/// </summary>
public class GradientStop
{
#region Properties & Fields
/// <summary>
/// Gets or sets the percentage offset to place this stop. This should be inside the range of [0..1] but it's not necessary.
/// </summary>
public float Offset { get; set; }
/// <summary>
/// Gets or sets the color of the stop.
/// </summary>
public Color Color { get; set; }
#endregion
#region Constructors
/// <summary>
/// Initializes a new instance of the <see cref="GradientStop"/> class.
/// </summary>
/// <param name="offset">The percentage offset to place this stop.</param>
/// <param name="color">The color of the stop.</param>
public GradientStop(float offset, Color color)
{
this.Offset = offset;
@@ -2,8 +2,16 @@
namespace CUE.NET.Devices.Keyboard.Brushes.Gradient
{
/// <summary>
/// Represents a basic gradient.
/// </summary>
public interface IGradient
{
/// <summary>
/// Gets the color of the gradient on the specified offset.
/// </summary>
/// <param name="offset">The percentage offset to take the color from.</param>
/// <returns>The color at the specific offset.</returns>
Color GetColor(float offset);
}
}
@@ -3,13 +3,23 @@ using System.Linq;
namespace CUE.NET.Devices.Keyboard.Brushes.Gradient
{
/// <summary>
/// Represents a linear interpolated gradient with n stops.
/// </summary>
public class LinearGradient : AbstractGradient
{
#region Constructors
/// <summary>
/// Initializes a new instance of the <see cref="LinearGradient"/> class.
/// </summary>
public LinearGradient()
{ }
/// <summary>
/// Initializes a new instance of the <see cref="LinearGradient"/> class.
/// </summary>
/// <param name="gradientStops">The stops with which the gradient should be initialized.</param>
public LinearGradient(params GradientStop[] gradientStops)
: base(gradientStops)
{ }
@@ -18,6 +28,11 @@ namespace CUE.NET.Devices.Keyboard.Brushes.Gradient
#region Methods
/// <summary>
/// Gets the linear interpolated color at the given offset.
/// </summary>
/// <param name="offset">The percentage offset to take the color from.</param>
/// <returns>The color at the specific offset.</returns>
public override Color GetColor(float offset)
{
if (!GradientStops.Any()) return Color.Transparent;
@@ -5,17 +5,33 @@ using CUE.NET.Helper;
namespace CUE.NET.Devices.Keyboard.Brushes.Gradient
{
/// <summary>
/// Represents a rainbow gradient which circles through all color colors of the HUE-color-space.<br />
/// See <see cref="http://upload.wikimedia.org/wikipedia/commons/a/ad/HueScale.svg" /> as reference
/// </summary>
public class RainbowGradient : IGradient
{
#region Properties & Fields
/// <summary>
/// Gets or sets the hue (in degrees) to start from.
/// </summary>
public float StartHue { get; set; }
/// <summary>
/// Gets or sets the hue (in degrees) to end the with.
/// </summary>
public float EndHue { get; set; }
#endregion
#region Constructors
/// <summary>
/// Initializes a new instance of the <see cref="RainbowGradient"/> class.
/// </summary>
/// <param name="startHue">The hue (in degrees) to start from (default: 0)</param>
/// <param name="endHue">The hue (in degrees) to end with (default: 360)</param>
public RainbowGradient(float startHue = 0f, float endHue = 360f)
{
this.StartHue = startHue;
@@ -28,6 +44,11 @@ namespace CUE.NET.Devices.Keyboard.Brushes.Gradient
#endregion
/// <summary>
/// Gets the color on the rainbow at the given offset.
/// </summary>
/// <param name="offset">The percentage offset to take the color from.</param>
/// <returns>The color at the specific offset.</returns>
public Color GetColor(float offset)
{
float range = EndHue - StartHue;