SvgDefinitionDefaults.cs 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. #pragma warning disable
  6. namespace Svg
  7. {
  8. /// <summary>
  9. /// Holds a dictionary of the default values of the SVG specification
  10. /// </summary>
  11. public static class SvgDefaults
  12. {
  13. //internal dictionary for the defaults
  14. private static readonly Dictionary<string, string> _defaults = new Dictionary<string, string>();
  15. static SvgDefaults()
  16. {
  17. _defaults["d"] = "";
  18. _defaults["viewBox"] = "0, 0, 0, 0";
  19. _defaults["visibility"] = "visible";
  20. _defaults["opacity"] = "1";
  21. _defaults["clip-rule"] = "nonzero";
  22. _defaults["transform"] = "";
  23. _defaults["rx"] = "0";
  24. _defaults["ry"] = "0";
  25. _defaults["cx"] = "0";
  26. _defaults["cy"] = "0";
  27. _defaults["fill"] = "";
  28. _defaults["fill-opacity"] = "1";
  29. _defaults["fill-rule"] = "nonzero";
  30. _defaults["stroke"] = "none";
  31. _defaults["stroke-opacity"] = "1";
  32. _defaults["stroke-width"] = "1";
  33. _defaults["stroke-miterlimit"] = "4";
  34. _defaults["stroke-linecap"] = "butt";
  35. _defaults["stroke-linejoin"] = "miter";
  36. _defaults["stroke-dasharray"] = "none";
  37. _defaults["stroke-dashoffset"] = "0";
  38. }
  39. /// <summary>
  40. /// Checks whether the property value is the default value of the svg definition.
  41. /// </summary>
  42. /// <param name="attributeName">Name of the svg attribute</param>
  43. /// <param name="propertyValue">.NET value of the attribute</param>
  44. public static bool IsDefault(string attributeName, string value)
  45. {
  46. if (_defaults.ContainsKey(attributeName))
  47. {
  48. if (_defaults[attributeName] == value) return true;
  49. }
  50. return false;
  51. }
  52. }
  53. }
  54. #pragma warning restore