TransformGroup.cs 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. // Copyright (c) The Avalonia Project. All rights reserved.
  2. // Licensed under the MIT license. See licence.md file in the project root for full license information.
  3. using Avalonia.Collections;
  4. using Avalonia.Metadata;
  5. namespace Avalonia.Media
  6. {
  7. public class TransformGroup : Transform
  8. {
  9. /// <summary>
  10. /// Defines the <see cref="Children"/> property.
  11. /// </summary>
  12. public static readonly AvaloniaProperty<Transforms> ChildrenProperty =
  13. AvaloniaProperty.Register<TransformGroup, Transforms>(nameof(Children));
  14. public TransformGroup()
  15. {
  16. Children = new Transforms();
  17. }
  18. /// <summary>
  19. /// Gets or sets the children.
  20. /// </summary>
  21. /// <value>
  22. /// The children.
  23. /// </value>
  24. [Content]
  25. public Transforms Children
  26. {
  27. get { return GetValue(ChildrenProperty); }
  28. set { SetValue(ChildrenProperty, value); }
  29. }
  30. /// <summary>
  31. /// Gets the tranform's <see cref="Matrix" />.
  32. /// </summary>
  33. public override Matrix Value
  34. {
  35. get
  36. {
  37. Matrix result = Matrix.Identity;
  38. foreach (var t in Children)
  39. {
  40. result *= t.Value;
  41. }
  42. return result;
  43. }
  44. }
  45. }
  46. public sealed class Transforms : AvaloniaList<Transform>
  47. {
  48. }
  49. }