LinearGradientBrush.cs 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. // Copyright (c) The Perspex Project. All rights reserved.
  2. // Licensed under the MIT license. See licence.md file in the project root for full license information.
  3. namespace Perspex.Media
  4. {
  5. /// <summary>
  6. /// A brush that draws with a linear gradient.
  7. /// </summary>
  8. public sealed class LinearGradientBrush : GradientBrush
  9. {
  10. /// <summary>
  11. /// Defines the <see cref="StartPoint"/> property.
  12. /// </summary>
  13. public static readonly StyledProperty<RelativePoint> StartPointProperty =
  14. PerspexProperty.Register<LinearGradientBrush, RelativePoint>(
  15. nameof(StartPoint),
  16. RelativePoint.TopLeft);
  17. /// <summary>
  18. /// Defines the <see cref="EndPoint"/> property.
  19. /// </summary>
  20. public static readonly StyledProperty<RelativePoint> EndPointProperty =
  21. PerspexProperty.Register<LinearGradientBrush, RelativePoint>(
  22. nameof(EndPoint),
  23. RelativePoint.BottomRight);
  24. /// <summary>
  25. /// Gets or sets the start point for the gradient.
  26. /// </summary>
  27. public RelativePoint StartPoint
  28. {
  29. get { return GetValue(StartPointProperty); }
  30. set { SetValue(StartPointProperty, value); }
  31. }
  32. /// <summary>
  33. /// Gets or sets the end point for the gradient.
  34. /// </summary>
  35. public RelativePoint EndPoint
  36. {
  37. get { return GetValue(EndPointProperty); }
  38. set { SetValue(EndPointProperty, value); }
  39. }
  40. }
  41. }