mirror of
https://github.com/DarthAffe/RGB.NET.git
synced 2026-11-10 20:46:24 +00:00
Changed everything to use floats instead of doubles
This commit is contained in:
1 parent
13afc29987
commit
b328032df0
36 files changed
+433
-472
No files matched your search
@@ -20,46 +20,46 @@ namespace RGB.NET.Presets.Decorators
|
||||
/// Gets or sets the attack-time (in seconds) of the decorator. (default: 0.2)<br />
|
||||
/// This is close to a synthesizer envelope. (See <see href="http://en.wikipedia.org/wiki/Synthesizer#ADSR_envelope" /> as reference)
|
||||
/// </summary>
|
||||
public double Attack { get; set; } = 0.2;
|
||||
public float Attack { get; set; } = 0.2f;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the decay-time (in seconds) of the decorator. (default: 0)<br />
|
||||
/// This is close to a synthesizer envelope. (See <see href="http://en.wikipedia.org/wiki/Synthesizer#ADSR_envelope" /> as reference)
|
||||
/// </summary>
|
||||
public double Decay { get; set; } = 0;
|
||||
public float Decay { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the sustain-time (in seconds) of the decorator. (default: 0.3)<br />
|
||||
/// This is close to a synthesizer envelope. (See <see href="http://en.wikipedia.org/wiki/Synthesizer#ADSR_envelope" /> as reference)<br />
|
||||
/// Note that this value for naming reasons represents the time NOT the level.
|
||||
/// </summary>
|
||||
public double Sustain { get; set; } = 0.3;
|
||||
public float Sustain { get; set; } = 0.3f;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the release-time (in seconds) of the decorator. (default: 0.2)<br />
|
||||
/// This is close to a synthesizer envelope. (See <see href="http://en.wikipedia.org/wiki/Synthesizer#ADSR_envelope" /> as reference)
|
||||
/// </summary>
|
||||
public double Release { get; set; } = 0.2;
|
||||
public float Release { get; set; } = 0.2f;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the level to which the oppacity (percentage) should raise in the attack-cycle. (default: 1);
|
||||
/// </summary>
|
||||
public double AttackValue { get; set; } = 1;
|
||||
public float AttackValue { get; set; } = 1;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the level at which the oppacity (percentage) should stay in the sustain-cycle. (default: 1);
|
||||
/// </summary>
|
||||
public double SustainValue { get; set; } = 1;
|
||||
public float SustainValue { get; set; } = 1;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the level at which the oppacity (percentage) should stay in the pause-cycle. (default: 0);
|
||||
/// </summary>
|
||||
public double PauseValue { get; set; } = 0;
|
||||
public float PauseValue { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the interval (in seconds) in which the decorator should repeat (if repetition is enabled). (default: 1)
|
||||
/// </summary>
|
||||
public double Interval { get; set; } = 1;
|
||||
public float Interval { get; set; } = 1;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the amount of repetitions the decorator should do until it's finished. Zero means infinite. (default: 0)
|
||||
@@ -67,10 +67,10 @@ namespace RGB.NET.Presets.Decorators
|
||||
public int Repetitions { get; set; } = 0;
|
||||
|
||||
private ADSRPhase _currentPhase;
|
||||
private double _currentPhaseValue;
|
||||
private float _currentPhaseValue;
|
||||
private int _repetitionCount;
|
||||
|
||||
private double _currentValue;
|
||||
private float _currentValue;
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -90,14 +90,14 @@ namespace RGB.NET.Presets.Decorators
|
||||
/// <inheritdoc />
|
||||
protected override void Update(double deltaTime)
|
||||
{
|
||||
_currentPhaseValue -= deltaTime;
|
||||
_currentPhaseValue -= (float)deltaTime;
|
||||
|
||||
// Using ifs instead of a switch allows to skip phases with time 0.
|
||||
// ReSharper disable InvertIf
|
||||
|
||||
if (_currentPhase == ADSRPhase.Attack)
|
||||
if (_currentPhaseValue > 0)
|
||||
_currentValue = PauseValue + (Math.Min(1, (Attack - _currentPhaseValue) / Attack) * (AttackValue - PauseValue));
|
||||
_currentValue = PauseValue + (MathF.Min(1, (Attack - _currentPhaseValue) / Attack) * (AttackValue - PauseValue));
|
||||
else
|
||||
{
|
||||
_currentPhaseValue = Decay;
|
||||
@@ -106,7 +106,7 @@ namespace RGB.NET.Presets.Decorators
|
||||
|
||||
if (_currentPhase == ADSRPhase.Decay)
|
||||
if (_currentPhaseValue > 0)
|
||||
_currentValue = SustainValue + (Math.Min(1, _currentPhaseValue / Decay) * (AttackValue - SustainValue));
|
||||
_currentValue = SustainValue + (MathF.Min(1, _currentPhaseValue / Decay) * (AttackValue - SustainValue));
|
||||
else
|
||||
{
|
||||
_currentPhaseValue = Sustain;
|
||||
@@ -124,7 +124,7 @@ namespace RGB.NET.Presets.Decorators
|
||||
|
||||
if (_currentPhase == ADSRPhase.Release)
|
||||
if (_currentPhaseValue > 0)
|
||||
_currentValue = PauseValue + (Math.Min(1, _currentPhaseValue / Release) * (SustainValue - PauseValue));
|
||||
_currentValue = PauseValue + (MathF.Min(1, _currentPhaseValue / Release) * (SustainValue - PauseValue));
|
||||
else
|
||||
{
|
||||
_currentPhaseValue = Interval;
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace RGB.NET.Presets.Decorators
|
||||
/// <see cref="LinearGradient"/>: 360 unit = 1 offset.
|
||||
/// <see cref="RainbowGradient"/>: 1 unit = 1 degree.
|
||||
/// </summary>
|
||||
public double Speed { get; set; }
|
||||
public float Speed { get; set; }
|
||||
|
||||
// ReSharper restore MemberCanBePrivate.Global
|
||||
// ReSharper restore AutoPropertyCanBeMadeGetOnly.Global
|
||||
@@ -44,7 +44,7 @@ namespace RGB.NET.Presets.Decorators
|
||||
/// <see cref="T:RGB.NET.Presets.Gradients.RainbowGradient" />: 1 unit = 1 degree.</param>
|
||||
/// <param name="direction">The direction the <see cref="T:RGB.NET.Presets.Gradients.IGradient" /> is moved.
|
||||
/// True leads to an offset-increment (normaly moving to the right), false to an offset-decrement (normaly moving to the left).</param>
|
||||
public MoveGradientDecorator(RGBSurface surface, double speed = 180.0, bool direction = true)
|
||||
public MoveGradientDecorator(RGBSurface surface, float speed = 180.0f, bool direction = true)
|
||||
: base(surface)
|
||||
{
|
||||
this.Speed = speed;
|
||||
@@ -58,7 +58,7 @@ namespace RGB.NET.Presets.Decorators
|
||||
/// <inheritdoc />
|
||||
protected override void Update(double deltaTime)
|
||||
{
|
||||
double movement = Speed * deltaTime;
|
||||
float movement = Speed * (float)deltaTime;
|
||||
|
||||
if (!Direction)
|
||||
movement = -movement;
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace RGB.NET.Presets.Helper
|
||||
/// <param name="endPoint">The end <see cref="Point"/> of the gradient.</param>
|
||||
/// <param name="point">The <see cref="Point"/> on the gradient to which the offset is calculated.</param>
|
||||
/// <returns>The offset of the <see cref="Point"/> on the gradient.</returns>
|
||||
public static double CalculateLinearGradientOffset(in Point startPoint, in Point endPoint, in Point point)
|
||||
public static float CalculateLinearGradientOffset(in Point startPoint, in Point endPoint, in Point point)
|
||||
{
|
||||
Point intersectingPoint;
|
||||
if (startPoint.Y.EqualsInTolerance(endPoint.Y)) // Horizontal case
|
||||
@@ -31,20 +31,20 @@ namespace RGB.NET.Presets.Helper
|
||||
|
||||
else // Diagonal case
|
||||
{
|
||||
double slope = (endPoint.Y - startPoint.Y) / (endPoint.X - startPoint.X);
|
||||
double orthogonalSlope = -1 / slope;
|
||||
float slope = (endPoint.Y - startPoint.Y) / (endPoint.X - startPoint.X);
|
||||
float orthogonalSlope = -1 / slope;
|
||||
|
||||
double startYIntercept = startPoint.Y - (slope * startPoint.X);
|
||||
double pointYIntercept = point.Y - (orthogonalSlope * point.X);
|
||||
float startYIntercept = startPoint.Y - (slope * startPoint.X);
|
||||
float pointYIntercept = point.Y - (orthogonalSlope * point.X);
|
||||
|
||||
double intersectingPointX = (pointYIntercept - startYIntercept) / (slope - orthogonalSlope);
|
||||
double intersectingPointY = (slope * intersectingPointX) + startYIntercept;
|
||||
float intersectingPointX = (pointYIntercept - startYIntercept) / (slope - orthogonalSlope);
|
||||
float intersectingPointY = (slope * intersectingPointX) + startYIntercept;
|
||||
intersectingPoint = new Point(intersectingPointX, intersectingPointY);
|
||||
}
|
||||
|
||||
// Calculate distances relative to the vector start
|
||||
double intersectDistance = CalculateDistance(intersectingPoint, startPoint, endPoint);
|
||||
double gradientLength = CalculateDistance(endPoint, startPoint, endPoint);
|
||||
float intersectDistance = CalculateDistance(intersectingPoint, startPoint, endPoint);
|
||||
float gradientLength = CalculateDistance(endPoint, startPoint, endPoint);
|
||||
|
||||
return intersectDistance / gradientLength;
|
||||
}
|
||||
@@ -57,9 +57,9 @@ namespace RGB.NET.Presets.Helper
|
||||
/// <param name="origin">The origin of the vector.</param>
|
||||
/// <param name="direction">The direction of the vector.</param>
|
||||
/// <returns>The signed magnitude of a <see cref="Point"/> on a vector.</returns>
|
||||
public static double CalculateDistance(in Point point, in Point origin, in Point direction)
|
||||
public static float CalculateDistance(in Point point, in Point origin, in Point direction)
|
||||
{
|
||||
double distance = CalculateDistance(point, origin);
|
||||
float distance = CalculateDistance(point, origin);
|
||||
|
||||
return (((point.Y < origin.Y) && (direction.Y > origin.Y))
|
||||
|| ((point.Y > origin.Y) && (direction.Y < origin.Y))
|
||||
@@ -74,11 +74,11 @@ namespace RGB.NET.Presets.Helper
|
||||
/// <param name="point1">The first <see cref="Point"/>.</param>
|
||||
/// <param name="point2">The second <see cref="Point"/>.</param>
|
||||
/// <returns>The distance between the two <see cref="Point"/>.</returns>
|
||||
public static double CalculateDistance(in Point point1, in Point point2)
|
||||
public static float CalculateDistance(in Point point1, in Point point2)
|
||||
{
|
||||
double x = point1.X - point2.X;
|
||||
double y = point1.Y - point2.Y;
|
||||
return Math.Sqrt((y * y) + (x * x));
|
||||
float x = point1.X - point2.X;
|
||||
float y = point1.Y - point2.Y;
|
||||
return MathF.Sqrt((y * y) + (x * x));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -18,23 +18,23 @@ namespace RGB.NET.Presets.Textures
|
||||
{
|
||||
#region Constants
|
||||
|
||||
private const double PI2 = Math.PI * 2;
|
||||
private const float PI2 = MathF.PI * 2.0f;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Properties & Fields
|
||||
|
||||
private double _origin = Math.Atan2(-1, 0);
|
||||
private float _origin = MathF.Atan2(-1, 0);
|
||||
/// <summary>
|
||||
/// Gets or sets the origin (radian-angle) this <see cref="ConicalGradientTexture"/> is drawn to. (default: -π/2)
|
||||
/// </summary>
|
||||
public double Origin
|
||||
public float Origin
|
||||
{
|
||||
get => _origin;
|
||||
set => SetProperty(ref _origin, value);
|
||||
}
|
||||
|
||||
private Point _center = new(0.5, 0.5);
|
||||
private Point _center = new(0.5f, 0.5f);
|
||||
/// <summary>
|
||||
/// Gets or sets the center <see cref="Point"/> (as percentage in the range [0..1]) of the <see cref="IGradient"/> drawn by this <see cref="ConicalGradientTexture"/>. (default: 0.5, 0.5)
|
||||
/// </summary>
|
||||
@@ -86,9 +86,9 @@ namespace RGB.NET.Presets.Textures
|
||||
|
||||
protected override Color GetColor(in Point point)
|
||||
{
|
||||
double angle = Math.Atan2(point.Y - Center.Y, point.X - Center.X) - Origin;
|
||||
float angle = MathF.Atan2(point.Y - Center.Y, point.X - Center.X) - Origin;
|
||||
if (angle < 0) angle += PI2;
|
||||
double offset = angle / PI2;
|
||||
float offset = angle / PI2;
|
||||
|
||||
return Gradient.GetColor(offset);
|
||||
}
|
||||
|
||||
@@ -96,23 +96,23 @@ namespace RGB.NET.Presets.Textures.Gradients
|
||||
/// </summary>
|
||||
/// <param name="offset"></param>
|
||||
/// <returns></returns>
|
||||
protected double ClipOffset(double offset)
|
||||
protected float ClipOffset(float offset)
|
||||
{
|
||||
double max = GradientStops.Max(stop => stop.Offset);
|
||||
float max = GradientStops.Max(stop => stop.Offset);
|
||||
if (offset > max)
|
||||
return max;
|
||||
|
||||
double min = GradientStops.Min(stop => stop.Offset);
|
||||
float min = GradientStops.Min(stop => stop.Offset);
|
||||
return offset < min ? min : offset;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public abstract Color GetColor(double offset);
|
||||
public abstract Color GetColor(float offset);
|
||||
|
||||
/// <inheritdoc />
|
||||
public virtual void Move(double offset)
|
||||
public virtual void Move(float offset)
|
||||
{
|
||||
offset /= 360.0;
|
||||
offset /= 360.0f;
|
||||
|
||||
foreach (GradientStop gradientStop in GradientStops)
|
||||
gradientStop.Offset += offset;
|
||||
|
||||
@@ -12,11 +12,11 @@ namespace RGB.NET.Presets.Textures.Gradients
|
||||
{
|
||||
#region Properties & Fields
|
||||
|
||||
private double _offset;
|
||||
private float _offset;
|
||||
/// <summary>
|
||||
/// Gets or sets the percentage offset to place this <see cref="GradientStop"/>. This should be inside the range of [0..1] but it's not necessary.
|
||||
/// </summary>
|
||||
public double Offset
|
||||
public float Offset
|
||||
{
|
||||
get => _offset;
|
||||
set => SetProperty(ref _offset, value);
|
||||
@@ -41,7 +41,7 @@ namespace RGB.NET.Presets.Textures.Gradients
|
||||
/// </summary>
|
||||
/// <param name="offset">The percentage offset to place this <see cref="GradientStop"/>.</param>
|
||||
/// <param name="color">The <see cref="Color"/> of the <see cref="GradientStop"/>.</param>
|
||||
public GradientStop(double offset, Color color)
|
||||
public GradientStop(float offset, Color color)
|
||||
{
|
||||
this.Offset = offset;
|
||||
this.Color = color;
|
||||
|
||||
@@ -19,12 +19,12 @@ namespace RGB.NET.Presets.Textures.Gradients
|
||||
/// </summary>
|
||||
/// <param name="offset">The percentage offset to take the <see cref="Color"/> from.</param>
|
||||
/// <returns>The <see cref="Color"/> at the specific offset.</returns>
|
||||
Color GetColor(double offset);
|
||||
Color GetColor(float offset);
|
||||
|
||||
/// <summary>
|
||||
/// Moves the <see cref="IGradient"/> by the provided offset.
|
||||
/// </summary>
|
||||
/// <param name="offset">The offset the <see cref="IGradient"/> should be moved.</param>
|
||||
void Move(double offset);
|
||||
void Move(float offset);
|
||||
}
|
||||
}
|
||||
@@ -83,7 +83,7 @@ namespace RGB.NET.Presets.Textures.Gradients
|
||||
/// </summary>
|
||||
/// <param name="offset">The percentage offset to take the color from.</param>
|
||||
/// <returns>The <see cref="T:RGB.NET.Core.Color" /> at the specific offset.</returns>
|
||||
public override Color GetColor(double offset)
|
||||
public override Color GetColor(float offset)
|
||||
{
|
||||
if (GradientStops.Count == 0) return Color.Transparent;
|
||||
if (GradientStops.Count == 1) return GradientStops[0].Color;
|
||||
@@ -93,14 +93,14 @@ namespace RGB.NET.Presets.Textures.Gradients
|
||||
|
||||
(GradientStop gsBefore, GradientStop gsAfter) = GetEnclosingGradientStops(offset, _orderedGradientStops, WrapGradient);
|
||||
|
||||
double blendFactor = 0;
|
||||
float blendFactor = 0;
|
||||
if (!gsBefore.Offset.Equals(gsAfter.Offset))
|
||||
blendFactor = ((offset - gsBefore.Offset) / (gsAfter.Offset - gsBefore.Offset));
|
||||
|
||||
double colA = ((gsAfter.Color.A - gsBefore.Color.A) * blendFactor) + gsBefore.Color.A;
|
||||
double colR = ((gsAfter.Color.R - gsBefore.Color.R) * blendFactor) + gsBefore.Color.R;
|
||||
double colG = ((gsAfter.Color.G - gsBefore.Color.G) * blendFactor) + gsBefore.Color.G;
|
||||
double colB = ((gsAfter.Color.B - gsBefore.Color.B) * blendFactor) + gsBefore.Color.B;
|
||||
float colA = ((gsAfter.Color.A - gsBefore.Color.A) * blendFactor) + gsBefore.Color.A;
|
||||
float colR = ((gsAfter.Color.R - gsBefore.Color.R) * blendFactor) + gsBefore.Color.R;
|
||||
float colG = ((gsAfter.Color.G - gsBefore.Color.G) * blendFactor) + gsBefore.Color.G;
|
||||
float colB = ((gsAfter.Color.B - gsBefore.Color.B) * blendFactor) + gsBefore.Color.B;
|
||||
|
||||
return new Color(colA, colR, colG, colB);
|
||||
}
|
||||
@@ -112,7 +112,7 @@ namespace RGB.NET.Presets.Textures.Gradients
|
||||
/// <param name="orderedStops">The ordered list of <see cref="GradientStop"/> to choose from.</param>
|
||||
/// <param name="wrap">Bool indicating if the gradient should be wrapped or not.</param>
|
||||
/// <returns></returns>
|
||||
protected virtual (GradientStop gsBefore, GradientStop gsAfter) GetEnclosingGradientStops(double offset, LinkedList<GradientStop> orderedStops, bool wrap)
|
||||
protected virtual (GradientStop gsBefore, GradientStop gsAfter) GetEnclosingGradientStops(float offset, LinkedList<GradientStop> orderedStops, bool wrap)
|
||||
{
|
||||
LinkedList<GradientStop> gradientStops = new(orderedStops);
|
||||
|
||||
|
||||
@@ -17,21 +17,21 @@ namespace RGB.NET.Presets.Textures.Gradients
|
||||
{
|
||||
#region Properties & Fields
|
||||
|
||||
private double _startHue;
|
||||
private float _startHue;
|
||||
/// <summary>
|
||||
/// Gets or sets the hue (in degrees) to start from.
|
||||
/// </summary>
|
||||
public double StartHue
|
||||
public float StartHue
|
||||
{
|
||||
get => _startHue;
|
||||
set => SetProperty(ref _startHue, value);
|
||||
}
|
||||
|
||||
private double _endHue;
|
||||
private float _endHue;
|
||||
/// <summary>
|
||||
/// Gets or sets the hue (in degrees) to end the with.
|
||||
/// </summary>
|
||||
public double EndHue
|
||||
public float EndHue
|
||||
{
|
||||
get => _endHue;
|
||||
set => SetProperty(ref _endHue, value);
|
||||
@@ -53,7 +53,7 @@ namespace RGB.NET.Presets.Textures.Gradients
|
||||
/// </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(double startHue = 0, double endHue = 360)
|
||||
public RainbowGradient(float startHue = 0, float endHue = 360)
|
||||
{
|
||||
this.StartHue = startHue;
|
||||
this.EndHue = endHue;
|
||||
@@ -71,15 +71,15 @@ namespace RGB.NET.Presets.Textures.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(double offset)
|
||||
public Color GetColor(float offset)
|
||||
{
|
||||
double range = EndHue - StartHue;
|
||||
double hue = StartHue + (range * offset);
|
||||
float range = EndHue - StartHue;
|
||||
float hue = StartHue + (range * offset);
|
||||
return HSVColor.Create(hue, 1, 1);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void Move(double offset)
|
||||
public void Move(float offset)
|
||||
{
|
||||
// RainbowGradient is calculated inverse
|
||||
offset *= -1;
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace RGB.NET.Presets.Textures
|
||||
{
|
||||
#region Properties & Fields
|
||||
|
||||
private Point _startPoint = new(0, 0.5);
|
||||
private Point _startPoint = new(0, 0.5f);
|
||||
/// <summary>
|
||||
/// Gets or sets the start <see cref="Point"/> (as percentage in the range [0..1]) of the <see cref="IGradient"/> drawn by this <see cref="LinearGradientTexture"/>. (default: 0.0, 0.5)
|
||||
/// </summary>
|
||||
@@ -29,7 +29,7 @@ namespace RGB.NET.Presets.Textures
|
||||
set => SetProperty(ref _startPoint, value);
|
||||
}
|
||||
|
||||
private Point _endPoint = new(1, 0.5);
|
||||
private Point _endPoint = new(1, 0.5f);
|
||||
/// <summary>
|
||||
/// Gets or sets the end <see cref="Point"/> (as percentage in the range [0..1]) of the <see cref="IGradient"/> drawn by this <see cref="LinearGradientTexture"/>. (default: 1.0, 0.5)
|
||||
/// </summary>
|
||||
@@ -70,7 +70,7 @@ namespace RGB.NET.Presets.Textures
|
||||
|
||||
protected override Color GetColor(in Point point)
|
||||
{
|
||||
double offset = GradientHelper.CalculateLinearGradientOffset(StartPoint, EndPoint, point);
|
||||
float offset = GradientHelper.CalculateLinearGradientOffset(StartPoint, EndPoint, point);
|
||||
return Gradient.GetColor(offset);
|
||||
}
|
||||
|
||||
|
||||
@@ -16,9 +16,9 @@ namespace RGB.NET.Presets.Textures
|
||||
{
|
||||
#region Properties & Fields
|
||||
|
||||
private double _referenceDistance = GradientHelper.CalculateDistance(new Point(0.5, 0.5), new Point(0, 0));
|
||||
private float _referenceDistance = GradientHelper.CalculateDistance(new Point(0.5f, 0.5f), new Point(0, 0));
|
||||
|
||||
private Point _center = new(0.5, 0.5);
|
||||
private Point _center = new(0.5f, 0.5f);
|
||||
/// <summary>
|
||||
/// Gets or sets the center <see cref="Point"/> (as percentage in the range [0..1]) around which the <see cref="RadialGradientTexture"/> should be drawn. (default: 0.5, 0.5)
|
||||
/// </summary>
|
||||
@@ -61,15 +61,15 @@ namespace RGB.NET.Presets.Textures
|
||||
|
||||
private void CalculateReferenceDistance()
|
||||
{
|
||||
double referenceX = Center.X < 0.5 ? 1 : 0;
|
||||
double referenceY = Center.Y < 0.5 ? 1 : 0;
|
||||
float referenceX = Center.X < 0.5f ? 1 : 0;
|
||||
float referenceY = Center.Y < 0.5f ? 1 : 0;
|
||||
_referenceDistance = GradientHelper.CalculateDistance(new Point(referenceX, referenceY), Center);
|
||||
}
|
||||
|
||||
protected override Color GetColor(in Point point)
|
||||
{
|
||||
double distance = GradientHelper.CalculateDistance(point, Center);
|
||||
double offset = distance / _referenceDistance;
|
||||
float distance = GradientHelper.CalculateDistance(point, Center);
|
||||
float offset = distance / _referenceDistance;
|
||||
return Gradient.GetColor(offset);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user