1
0
mirror of https://github.com/DarthAffe/CUE.NET.git synced 2025-12-12 16:58:29 +00:00

Merged RainbowBrush-Alpha from AudioAnalyzer

This commit is contained in:
Darth Affe 2015-09-26 22:44:23 +02:00
parent 5dc839a247
commit 6d61716567

View File

@ -12,23 +12,26 @@ namespace CUE.NET.Devices.Keyboard.Brushes
public PointF EndPoint { get; set; } = new PointF(1f, 0.5f); public PointF EndPoint { get; set; } = new PointF(1f, 0.5f);
public float StartHue { get; set; } public float StartHue { get; set; }
public float EndHue { get; set; } public float EndHue { get; set; }
public int Alpha { get; set; } = 255;
#endregion #endregion
#region Constructors #region Constructors
public RainbowBrush(float startHue = 0f, float endHue = 360f) public RainbowBrush(float startHue = 0f, float endHue = 360f, int alpha = 255)
{ {
this.StartHue = startHue; this.StartHue = startHue;
this.EndHue = endHue; this.EndHue = endHue;
this.Alpha = alpha;
} }
public RainbowBrush(PointF startPoint, PointF endPoint, float startHue = 0f, float endHue = 360f) public RainbowBrush(PointF startPoint, PointF endPoint, float startHue = 0f, float endHue = 360f, int alpha = 255)
{ {
this.StartPoint = startPoint; this.StartPoint = startPoint;
this.EndPoint = endPoint; this.EndPoint = endPoint;
this.StartHue = startHue; this.StartHue = startHue;
this.EndHue = endHue; this.EndHue = endHue;
this.Alpha = alpha;
} }
#endregion #endregion
@ -50,17 +53,17 @@ namespace CUE.NET.Devices.Keyboard.Brushes
switch ((int)div) switch ((int)div)
{ {
case 0: case 0:
return Color.FromArgb(255, 255, value, 0); return Color.FromArgb(Alpha, 255, value, 0);
case 1: case 1:
return Color.FromArgb(255, 255 - value, 255, 0); return Color.FromArgb(Alpha, 255 - value, 255, 0);
case 2: case 2:
return Color.FromArgb(255, 0, 255, value); return Color.FromArgb(Alpha, 0, 255, value);
case 3: case 3:
return Color.FromArgb(255, 0, 255 - value, 255); return Color.FromArgb(Alpha, 0, 255 - value, 255);
case 4: case 4:
return Color.FromArgb(255, value, 0, 255); return Color.FromArgb(Alpha, value, 0, 255);
case 5: case 5:
return Color.FromArgb(255, 255, 0, 255 - value); return Color.FromArgb(Alpha, 255, 0, 255 - value);
default: default:
return Color.Transparent; return Color.Transparent;
} }