mirror of
https://github.com/DarthAffe/CUE.NET.git
synced 2026-11-11 13:06:24 +00:00
Added own color-type to have more control over and easier manipulation of collors
This commit is contained in:
1 parent
5c6dba769b
commit
381ec55349
29 files changed
+271
-93
No files matched your search
@@ -3,6 +3,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using CUE.NET.Devices.Generic;
|
||||
|
||||
namespace CUE.NET.Gradients
|
||||
{
|
||||
@@ -65,7 +66,7 @@ namespace CUE.NET.Gradients
|
||||
/// </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);
|
||||
public abstract CorsairColor GetColor(float offset);
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
// ReSharper disable MemberCanBePrivate.Global
|
||||
|
||||
using System.Drawing;
|
||||
using CUE.NET.Devices.Generic;
|
||||
|
||||
namespace CUE.NET.Gradients
|
||||
{
|
||||
@@ -20,7 +21,7 @@ namespace CUE.NET.Gradients
|
||||
/// <summary>
|
||||
/// Gets or sets the color of the stop.
|
||||
/// </summary>
|
||||
public Color Color { get; set; }
|
||||
public CorsairColor Color { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -31,7 +32,7 @@ namespace CUE.NET.Gradients
|
||||
/// </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)
|
||||
public GradientStop(float offset, CorsairColor color)
|
||||
{
|
||||
this.Offset = offset;
|
||||
this.Color = color;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System.Drawing;
|
||||
using CUE.NET.Devices.Generic;
|
||||
|
||||
namespace CUE.NET.Gradients
|
||||
{
|
||||
@@ -12,6 +12,6 @@ namespace CUE.NET.Gradients
|
||||
/// </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);
|
||||
CorsairColor GetColor(float offset);
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using CUE.NET.Devices.Generic;
|
||||
|
||||
namespace CUE.NET.Gradients
|
||||
{
|
||||
@@ -35,9 +36,9 @@ namespace CUE.NET.Gradients
|
||||
/// </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)
|
||||
public override CorsairColor GetColor(float offset)
|
||||
{
|
||||
if (!GradientStops.Any()) return Color.Transparent;
|
||||
if (!GradientStops.Any()) return CorsairColor.Transparent;
|
||||
if (GradientStops.Count == 1) return GradientStops.First().Color;
|
||||
|
||||
offset = ClipOffset(offset);
|
||||
@@ -54,7 +55,7 @@ namespace CUE.NET.Gradients
|
||||
byte colG = (byte)((gsAfter.Color.G - gsBefore.Color.G) * blendFactor + gsBefore.Color.G);
|
||||
byte colB = (byte)((gsAfter.Color.B - gsBefore.Color.B) * blendFactor + gsBefore.Color.B);
|
||||
|
||||
return Color.FromArgb(colA, colR, colG, colB);
|
||||
return new CorsairColor(colA, colR, colG, colB);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// ReSharper disable MemberCanBePrivate.Global
|
||||
// ReSharper disable AutoPropertyCanBeMadeGetOnly.Global
|
||||
|
||||
using System.Drawing;
|
||||
using CUE.NET.Devices.Generic;
|
||||
using CUE.NET.Helper;
|
||||
|
||||
namespace CUE.NET.Gradients
|
||||
@@ -50,7 +50,7 @@ namespace CUE.NET.Gradients
|
||||
/// </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)
|
||||
public CorsairColor GetColor(float offset)
|
||||
{
|
||||
float range = EndHue - StartHue;
|
||||
float hue = (StartHue + (range * offset)) % 360f;
|
||||
|
||||
Reference in new issue
Block a user