2024-12-14 17:43:50 +01:00
|
|
|
|
using System;
|
|
|
|
|
using System.Drawing;
|
2024-12-13 19:57:07 +01:00
|
|
|
|
|
|
|
|
|
namespace Dashboard.Drawing
|
|
|
|
|
{
|
|
|
|
|
public class BrushExtension : DrawExtension
|
|
|
|
|
{
|
|
|
|
|
private BrushExtension() : base("DB_Brush") { }
|
|
|
|
|
|
|
|
|
|
public static readonly BrushExtension Instance = new BrushExtension();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public interface IBrush : IDrawResource
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2024-12-24 20:10:31 +01:00
|
|
|
|
public readonly struct SolidBrush(Color Color) : IBrush
|
2024-12-13 19:57:07 +01:00
|
|
|
|
{
|
|
|
|
|
public IDrawExtension Kind { get; } = SolidBrushExtension.Instance;
|
2024-12-24 20:10:31 +01:00
|
|
|
|
public override int GetHashCode()
|
2024-12-13 19:57:07 +01:00
|
|
|
|
{
|
2024-12-24 20:10:31 +01:00
|
|
|
|
return HashCode.Combine(Kind, Color);
|
2024-12-13 19:57:07 +01:00
|
|
|
|
}
|
2024-12-24 20:10:31 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public readonly struct GradientBrush(Gradient Gradient) : IBrush
|
|
|
|
|
{
|
|
|
|
|
public IDrawExtension Kind { get; } = GradientBrushExtension.Instance;
|
2024-12-14 17:43:50 +01:00
|
|
|
|
|
|
|
|
|
public override int GetHashCode()
|
|
|
|
|
{
|
2024-12-24 20:10:31 +01:00
|
|
|
|
return HashCode.Combine(Kind, Gradient);
|
2024-12-14 17:43:50 +01:00
|
|
|
|
}
|
2024-12-13 19:57:07 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class SolidBrushExtension : DrawExtension
|
|
|
|
|
{
|
|
|
|
|
private SolidBrushExtension() : base("DB_Brush_solid", new[] { BrushExtension.Instance }) { }
|
|
|
|
|
|
|
|
|
|
public static readonly SolidBrushExtension Instance = new SolidBrushExtension();
|
|
|
|
|
}
|
2024-12-24 20:10:31 +01:00
|
|
|
|
|
|
|
|
|
public class GradientBrushExtension : DrawExtension
|
|
|
|
|
{
|
|
|
|
|
private GradientBrushExtension() : base("DB_Brush_gradient", new[] { BrushExtension.Instance }) { }
|
|
|
|
|
|
|
|
|
|
public static readonly GradientBrushExtension Instance = new GradientBrushExtension();
|
|
|
|
|
}
|
2024-12-13 19:57:07 +01:00
|
|
|
|
}
|