mirror of
https://github.com/DarthAffe/RGB.NET.git
synced 2025-12-13 01:58:30 +00:00
Changed everything related to brushes/gradients to be correctly bindable
This commit is contained in:
parent
84b0c5402d
commit
98331d0241
@ -19,21 +19,36 @@ namespace RGB.NET.Brushes
|
||||
{
|
||||
#region Properties & Fields
|
||||
|
||||
private float _origin = (float)Math.Atan2(-1, 0);
|
||||
/// <summary>
|
||||
/// Gets or sets the origin (radian-angle) this <see cref="ConicalGradientBrush"/> is drawn to. (default: -π/2)
|
||||
/// </summary>
|
||||
public float Origin { get; set; } = (float)Math.Atan2(-1, 0);
|
||||
public float Origin
|
||||
{
|
||||
get => _origin;
|
||||
set => SetProperty(ref _origin, value);
|
||||
}
|
||||
|
||||
private Point _center = new Point(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>
|
||||
public Point Center { get; set; } = new Point(0.5, 0.5);
|
||||
public Point Center
|
||||
{
|
||||
get => _center;
|
||||
set => SetProperty(ref _center, value);
|
||||
}
|
||||
|
||||
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 { get; set; }
|
||||
public IGradient Gradient
|
||||
{
|
||||
get => _gradient;
|
||||
set => SetProperty(ref _gradient, value);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@ -20,18 +20,33 @@ namespace RGB.NET.Brushes
|
||||
{
|
||||
#region Properties & Fields
|
||||
|
||||
private Point _startPoint = new Point(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>
|
||||
public Point StartPoint { get; set; } = new Point(0, 0.5);
|
||||
public Point StartPoint
|
||||
{
|
||||
get => _startPoint;
|
||||
set => SetProperty(ref _startPoint, value);
|
||||
}
|
||||
|
||||
private Point _endPoint = new Point(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>
|
||||
public Point EndPoint { get; set; } = new Point(1, 0.5);
|
||||
public Point EndPoint
|
||||
{
|
||||
get => _endPoint;
|
||||
set => SetProperty(ref _endPoint, value);
|
||||
}
|
||||
|
||||
private IGradient _gradient;
|
||||
/// <inheritdoc />
|
||||
public IGradient Gradient { get; set; }
|
||||
public IGradient Gradient
|
||||
{
|
||||
get => _gradient;
|
||||
set => SetProperty(ref _gradient, value);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@ -18,13 +18,23 @@ namespace RGB.NET.Brushes
|
||||
{
|
||||
#region Properties & Fields
|
||||
|
||||
private Point _center = new Point(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>
|
||||
public Point Center { get; set; } = new Point(0.5, 0.5);
|
||||
public Point Center
|
||||
{
|
||||
get => _center;
|
||||
set => SetProperty(ref _center, value);
|
||||
}
|
||||
|
||||
private IGradient _gradient;
|
||||
/// <inheritdoc />
|
||||
public IGradient Gradient { get; set; }
|
||||
public IGradient Gradient
|
||||
{
|
||||
get => _gradient;
|
||||
set => SetProperty(ref _gradient, value);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@ -13,10 +13,15 @@ namespace RGB.NET.Brushes
|
||||
{
|
||||
#region Properties & Fields
|
||||
|
||||
private Color _color;
|
||||
/// <summary>
|
||||
/// Gets or sets the <see cref="Color"/> drawn by this <see cref="SolidColorBrush"/>.
|
||||
/// </summary>
|
||||
public Color Color { get; set; }
|
||||
public Color Color
|
||||
{
|
||||
get => _color;
|
||||
set => SetProperty(ref _color, value);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// ReSharper disable MemberCanBePrivate.Global
|
||||
// ReSharper disable AutoPropertyCanBeMadeGetOnly.Global
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using RGB.NET.Core;
|
||||
|
||||
@ -20,14 +20,19 @@ namespace RGB.NET.Brushes.Gradients
|
||||
/// <summary>
|
||||
/// Gets a list of the stops used by this <see cref="AbstractGradient"/>.
|
||||
/// </summary>
|
||||
public IList<GradientStop> GradientStops { get; } = new List<GradientStop>();
|
||||
public ObservableCollection<GradientStop> GradientStops { get; } = new ObservableCollection<GradientStop>();
|
||||
|
||||
private bool _wrapGradient;
|
||||
/// <summary>
|
||||
/// Gets or sets if the Gradient wraps around if there isn't a second stop to take.
|
||||
/// Example: There is a stop at offset 0.0, 0.5 and 0.75.
|
||||
/// Without wrapping offset 1.0 will be calculated the same as 0.75; with wrapping it would be the same as 0.0.
|
||||
/// </summary>
|
||||
public bool WrapGradient { get; set; }
|
||||
public bool WrapGradient
|
||||
{
|
||||
get => _wrapGradient;
|
||||
set => SetProperty(ref _wrapGradient, value);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@ -8,19 +8,29 @@ namespace RGB.NET.Brushes.Gradients
|
||||
/// <summary>
|
||||
/// Represents a stop on a gradient.
|
||||
/// </summary>
|
||||
public class GradientStop
|
||||
public class GradientStop : AbstractBindable
|
||||
{
|
||||
#region Properties & Fields
|
||||
|
||||
private double _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 { get; set; }
|
||||
public double Offset
|
||||
{
|
||||
get => _offset;
|
||||
set => SetProperty(ref _offset, value);
|
||||
}
|
||||
|
||||
private Color _color;
|
||||
/// <summary>
|
||||
/// Gets or sets the <see cref="Color"/> of this <see cref="GradientStop"/>.
|
||||
/// </summary>
|
||||
public Color Color { get; set; }
|
||||
public Color Color
|
||||
{
|
||||
get => _color;
|
||||
set => SetProperty(ref _color, value);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@ -15,15 +15,25 @@ namespace RGB.NET.Brushes.Gradients
|
||||
{
|
||||
#region Properties & Fields
|
||||
|
||||
private double _startHue;
|
||||
/// <summary>
|
||||
/// Gets or sets the hue (in degrees) to start from.
|
||||
/// </summary>
|
||||
public double StartHue { get; set; }
|
||||
public double StartHue
|
||||
{
|
||||
get => _startHue;
|
||||
set => SetProperty(ref _startHue, value);
|
||||
}
|
||||
|
||||
private double _endHue;
|
||||
/// <summary>
|
||||
/// Gets or sets the hue (in degrees) to end the with.
|
||||
/// </summary>
|
||||
public double EndHue { get; set; }
|
||||
public double EndHue
|
||||
{
|
||||
get => _endHue;
|
||||
set => SetProperty(ref _endHue, value);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user