Ei kuvausta
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

SVGPathSeg.cs 1.2KB

123456789101112131415161718192021222324252627282930313233343536
  1. using System.Collections.Generic;
  2. using System.Text.RegularExpressions;
  3. using UnityEngine;
  4. using UnityEngine.UI;
  5. namespace XUGL
  6. {
  7. public class SVGPathSeg
  8. {
  9. public SVGPathSegType type;
  10. public bool relative;
  11. public List<float> parameters = new List<float>();
  12. public string raw;
  13. public SVGPathSeg(SVGPathSegType type)
  14. {
  15. this.type = type;
  16. }
  17. public float value
  18. {
  19. get
  20. {
  21. if (type == SVGPathSegType.H)
  22. return SVG.yMirror ? -parameters[0] : parameters[0];
  23. else
  24. return parameters[0];
  25. }
  26. }
  27. public float x { get { return parameters[0]; } }
  28. public float y { get { return SVG.yMirror ? -parameters[1] : parameters[1]; } }
  29. public Vector2 p1 { get { return new Vector2(parameters[0], (SVG.yMirror ? -parameters[1] : parameters[1])); } }
  30. public Vector2 p2 { get { return new Vector2(parameters[2], (SVG.yMirror ? -parameters[3] : parameters[3])); } }
  31. public Vector2 p3 { get { return new Vector2(parameters[4], (SVG.yMirror ? -parameters[5] : parameters[5])); } }
  32. }
  33. }