SvgMatrix.cs 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. using System.Drawing.Drawing2D;
  5. using System.Globalization;
  6. #pragma warning disable
  7. namespace Svg.Transforms
  8. {
  9. /// <summary>
  10. /// The class which applies custom transform to this Matrix (Required for projects created by the Inkscape).
  11. /// </summary>
  12. public sealed class SvgMatrix : SvgTransform
  13. {
  14. private List<float> points;
  15. public List<float> Points
  16. {
  17. get { return this.points; }
  18. set { this.points = value; }
  19. }
  20. public override System.Drawing.Drawing2D.Matrix Matrix
  21. {
  22. get
  23. {
  24. Matrix matrix = new Matrix(
  25. this.points[0],
  26. this.points[1],
  27. this.points[2],
  28. this.points[3],
  29. this.points[4],
  30. this.points[5]
  31. );
  32. return matrix;
  33. }
  34. }
  35. public override string WriteToString()
  36. {
  37. return string.Format(CultureInfo.InvariantCulture, "matrix({0}, {1}, {2}, {3}, {4}, {5})",
  38. this.points[0], this.points[1], this.points[2], this.points[3], this.points[4], this.points[5]);
  39. }
  40. public SvgMatrix(List<float> m)
  41. {
  42. this.points = m;
  43. }
  44. public override object Clone()
  45. {
  46. return new SvgMatrix(this.Points);
  47. }
  48. }
  49. }
  50. #pragma warning restore