mirror of
https://github.com/DarthAffe/RGB.NET.git
synced 2026-11-11 04:57:15 +00:00
Changed color to be an immutable value-type
This commit is contained in:
1 parent
b9e443b3b6
commit
50cfd296be
16 files changed
+1014
-410
No files matched your search
@@ -37,10 +37,7 @@ namespace RGB.NET.Brushes
|
||||
#region Methods
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override Color GetColorAtPoint(Rectangle rectangle, BrushRenderTarget renderTarget)
|
||||
{
|
||||
return Color;
|
||||
}
|
||||
protected override Color GetColorAtPoint(Rectangle rectangle, BrushRenderTarget renderTarget) => Color;
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -50,19 +47,13 @@ namespace RGB.NET.Brushes
|
||||
/// Converts a <see cref="Color" /> to a <see cref="SolidColorBrush" />.
|
||||
/// </summary>
|
||||
/// <param name="color">The <see cref="Color"/> to convert.</param>
|
||||
public static explicit operator SolidColorBrush(Color color)
|
||||
{
|
||||
return new SolidColorBrush(color);
|
||||
}
|
||||
public static explicit operator SolidColorBrush(Color color) => new SolidColorBrush(color);
|
||||
|
||||
/// <summary>
|
||||
/// Converts a <see cref="SolidColorBrush" /> to a <see cref="Color" />.
|
||||
/// </summary>
|
||||
/// <param name="brush">The <see cref="Color"/> to convert.</param>
|
||||
public static implicit operator Color(SolidColorBrush brush)
|
||||
{
|
||||
return brush.Color;
|
||||
}
|
||||
public static implicit operator Color(SolidColorBrush brush) => brush.Color;
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ namespace RGB.NET.Brushes.Gradients
|
||||
public override Color GetColor(double offset)
|
||||
{
|
||||
if (GradientStops.Count == 0) return Color.Transparent;
|
||||
if (GradientStops.Count == 1) return new Color(GradientStops[0].Color);
|
||||
if (GradientStops.Count == 1) return GradientStops[0].Color;
|
||||
|
||||
(GradientStop gsBefore, GradientStop gsAfter) = GetEnclosingGradientStops(offset, GradientStops, WrapGradient);
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ namespace RGB.NET.Brushes.Gradients
|
||||
double hue = (StartHue + (range * offset)) % 360f;
|
||||
if (hue < 0)
|
||||
hue += 360;
|
||||
return new Color(hue, 1f, 1f);
|
||||
return Color.FromHSV(hue, 1, 1);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
||||
Reference in new issue
Block a user