mirror of
https://github.com/DarthAffe/RGB.NET.git
synced 2026-11-11 04:57:15 +00:00
Fixed warnings
This commit is contained in:
1 parent
57dc9afb32
commit
a0a1521658
118 files changed
+802
-1181
No files matched your search
@@ -29,7 +29,7 @@ namespace RGB.NET.Brushes
|
||||
set => SetProperty(ref _origin, value);
|
||||
}
|
||||
|
||||
private Point _center = new Point(0.5, 0.5);
|
||||
private Point _center = new(0.5, 0.5);
|
||||
/// <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="ConicalGradientBrush"/>. (default: 0.5, 0.5)
|
||||
/// </summary>
|
||||
@@ -39,12 +39,12 @@ namespace RGB.NET.Brushes
|
||||
set => SetProperty(ref _center, value);
|
||||
}
|
||||
|
||||
private IGradient _gradient;
|
||||
private IGradient? _gradient;
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
/// Gets or sets the gradient drawn by the brush. If null it will default to full transparent.
|
||||
/// </summary>
|
||||
public IGradient Gradient
|
||||
public IGradient? Gradient
|
||||
{
|
||||
get => _gradient;
|
||||
set => SetProperty(ref _gradient, value);
|
||||
@@ -104,6 +104,8 @@ namespace RGB.NET.Brushes
|
||||
/// <inheritdoc />
|
||||
protected override Color GetColorAtPoint(Rectangle rectangle, BrushRenderTarget renderTarget)
|
||||
{
|
||||
if (Gradient == null) return Color.Transparent;
|
||||
|
||||
double centerX = rectangle.Size.Width * Center.X;
|
||||
double centerY = rectangle.Size.Height * Center.Y;
|
||||
|
||||
|
||||
@@ -12,6 +12,6 @@ namespace RGB.NET.Brushes
|
||||
/// <summary>
|
||||
/// Gets the <see cref="IGradient"/> used by this <see cref="IGradientBrush"/>.
|
||||
/// </summary>
|
||||
IGradient Gradient { get; }
|
||||
IGradient? Gradient { get; }
|
||||
}
|
||||
}
|
||||
@@ -20,7 +20,7 @@ namespace RGB.NET.Brushes
|
||||
{
|
||||
#region Properties & Fields
|
||||
|
||||
private Point _startPoint = new Point(0, 0.5);
|
||||
private Point _startPoint = new(0, 0.5);
|
||||
/// <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="LinearGradientBrush"/>. (default: 0.0, 0.5)
|
||||
/// </summary>
|
||||
@@ -30,7 +30,7 @@ namespace RGB.NET.Brushes
|
||||
set => SetProperty(ref _startPoint, value);
|
||||
}
|
||||
|
||||
private Point _endPoint = new Point(1, 0.5);
|
||||
private Point _endPoint = new(1, 0.5);
|
||||
/// <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="LinearGradientBrush"/>. (default: 1.0, 0.5)
|
||||
/// </summary>
|
||||
@@ -40,9 +40,9 @@ namespace RGB.NET.Brushes
|
||||
set => SetProperty(ref _endPoint, value);
|
||||
}
|
||||
|
||||
private IGradient _gradient;
|
||||
private IGradient? _gradient;
|
||||
/// <inheritdoc />
|
||||
public IGradient Gradient
|
||||
public IGradient? Gradient
|
||||
{
|
||||
get => _gradient;
|
||||
set => SetProperty(ref _gradient, value);
|
||||
@@ -97,8 +97,8 @@ namespace RGB.NET.Brushes
|
||||
{
|
||||
if (Gradient == null) return Color.Transparent;
|
||||
|
||||
Point startPoint = new Point(StartPoint.X * rectangle.Size.Width, StartPoint.Y * rectangle.Size.Height);
|
||||
Point endPoint = new Point(EndPoint.X * rectangle.Size.Width, EndPoint.Y * rectangle.Size.Height);
|
||||
Point startPoint = new(StartPoint.X * rectangle.Size.Width, StartPoint.Y * rectangle.Size.Height);
|
||||
Point endPoint = new(EndPoint.X * rectangle.Size.Width, EndPoint.Y * rectangle.Size.Height);
|
||||
|
||||
double offset = GradientHelper.CalculateLinearGradientOffset(startPoint, endPoint, renderTarget.Point);
|
||||
return Gradient.GetColor(offset);
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace RGB.NET.Brushes
|
||||
{
|
||||
#region Properties & Fields
|
||||
|
||||
private Point _center = new Point(0.5, 0.5);
|
||||
private Point _center = new(0.5, 0.5);
|
||||
/// <summary>
|
||||
/// Gets or sets the center <see cref="Point"/> (as percentage in the range [0..1]) around which the <see cref="RadialGradientBrush"/> should be drawn. (default: 0.5, 0.5)
|
||||
/// </summary>
|
||||
@@ -28,9 +28,9 @@ namespace RGB.NET.Brushes
|
||||
set => SetProperty(ref _center, value);
|
||||
}
|
||||
|
||||
private IGradient _gradient;
|
||||
private IGradient? _gradient;
|
||||
/// <inheritdoc />
|
||||
public IGradient Gradient
|
||||
public IGradient? Gradient
|
||||
{
|
||||
get => _gradient;
|
||||
set => SetProperty(ref _gradient, value);
|
||||
@@ -78,7 +78,7 @@ namespace RGB.NET.Brushes
|
||||
{
|
||||
if (Gradient == null) return Color.Transparent;
|
||||
|
||||
Point centerPoint = new Point(rectangle.Location.X + (rectangle.Size.Width * Center.X), rectangle.Location.Y + (rectangle.Size.Height * Center.Y));
|
||||
Point centerPoint = new(rectangle.Location.X + (rectangle.Size.Width * Center.X), rectangle.Location.Y + (rectangle.Size.Height * Center.Y));
|
||||
|
||||
// Calculate the distance to the farthest point from the center as reference (this has to be a corner)
|
||||
// ReSharper disable once RedundantCast - never trust this ...
|
||||
|
||||
@@ -52,7 +52,7 @@ 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) => new SolidColorBrush(color);
|
||||
public static explicit operator SolidColorBrush(Color color) => new(color);
|
||||
|
||||
/// <summary>
|
||||
/// Converts a <see cref="SolidColorBrush" /> to a <see cref="Color" />.
|
||||
|
||||
Reference in new issue
Block a user