SvgHelper.cs 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  1. using DevExpress.Utils;
  2. using DevExpress.Utils.Svg;
  3. using DevExpress.XtraMap.Native;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Data.SqlTypes;
  7. using System.Drawing;
  8. using System.IO;
  9. using System.IO.Ports;
  10. using System.Linq;
  11. using System.Text;
  12. using System.Threading.Tasks;
  13. using System.Xml;
  14. namespace DxHelper
  15. {
  16. public static class SvgHelper
  17. {
  18. static readonly Dictionary<string, SvgImage> cache = new Dictionary<string, SvgImage>();
  19. public static Image ToImage(this SvgImage svg,int w,int h)
  20. {
  21. var img = svg.Render(new Size(w, h), null, DefaultBoolean.False, DefaultBoolean.False);
  22. return img;
  23. }
  24. /// <summary>
  25. /// 判断color是否为HtmlColor(HtmlColor格式如#A1B2C3)
  26. /// </summary>
  27. /// <param name="color"></param>
  28. /// <returns></returns>
  29. public static bool IsHtmlColor(string color)
  30. {
  31. if (!color.StartsWith("#")) return false;
  32. if (color.Length != 7) return false;
  33. string r = color.Substring(1, 2);
  34. string g = color.Substring(3, 2);
  35. string b = color.Substring(5, 2);
  36. bool r1 = byte.TryParse(r, System.Globalization.NumberStyles.HexNumber, null, out _);
  37. bool r2 = byte.TryParse(g, System.Globalization.NumberStyles.HexNumber, null, out _);
  38. bool r3 = byte.TryParse(b, System.Globalization.NumberStyles.HexNumber, null, out _);
  39. return r1 & r2 & r3;
  40. }
  41. /// <summary>
  42. /// 将SvgImage转换为Image对象
  43. /// </summary>
  44. /// <param name="svg"></param>
  45. /// <param name="width"></param>
  46. /// <param name="height"></param>
  47. /// <returns></returns>
  48. public static Image SvgToImage(SvgImage svg, int width, int height)
  49. {
  50. var img = svg.Render(new Size(width, height), null, DefaultBoolean.False, DefaultBoolean.False);
  51. return img;
  52. }
  53. /// <summary>
  54. /// 将文件转换为SvgImage对象
  55. /// </summary>
  56. /// <param name="svg"></param>
  57. /// <param name="width"></param>
  58. /// <param name="height"></param>
  59. /// <returns></returns>
  60. public static SvgImage LoadFromFile(string svgFile)
  61. {
  62. return SvgLoader.LoadFromFile(svgFile);
  63. }
  64. /// <summary>
  65. /// 创建一个Svg圆.该圆的圆心在ViewBox的中心
  66. /// </summary>
  67. /// <param name="colorKey">用于生成颜色的一个key,相同的key具有相同的颜色,当colorKey为html颜色时则使用此颜色(如#A1B2FF)</param>
  68. /// <param name="color">html颜色,默认每次都使用一个随机颜色,格式如#FF2F3C</param>
  69. /// <param name="opacity">透明度,默认不透明</param>
  70. /// <param name="viewBoxWidth">视口宽度,默认32px</param>
  71. /// <param name="viewBoxHeight">视口高度,默认32px</param>
  72. /// <param name="radius">半径,默认16px</param>
  73. /// <param name="offsetX">圆心的X轴偏移量,负向左偏移,正向右偏移,默认为0处于视口中心</param>
  74. /// <returns></returns>
  75. public static SvgImage CreateCycle(string colorKey, double opacity = 1, int viewBoxWidth = 32, int viewBoxHeight = 32, int radius = 16, double offsetX = 0)
  76. {
  77. if (colorKey == null) colorKey = "";
  78. if (cache.ContainsKey(colorKey))
  79. return cache[colorKey];
  80. SvgImage svg = new SvgImage();
  81. SvgRoot root = SvgRoot.Create(new SvgElementProperties(), viewBox: new SvgViewBox(0, 0, viewBoxWidth, viewBoxHeight));
  82. svg.Elements.Add(root);
  83. string colorStr;
  84. if (IsHtmlColor(colorKey))
  85. colorStr = colorKey;
  86. else
  87. colorStr = ColorHelper.GetHtmlColor(colorKey);
  88. SvgElementProperties props = new SvgElementProperties
  89. {
  90. Fill = colorStr,
  91. Opacity = opacity//透明度
  92. };
  93. SvgCircle circle = SvgCircle.Create(props, viewBoxWidth / 2 + offsetX, viewBoxHeight / 2, radius);
  94. root.Elements.Add(circle);
  95. //SvgImage未公开Width和Height属性的公共写入,需要通过以下方式可对width和Size赋值
  96. MemoryStream ms = new MemoryStream();
  97. svg.Save(ms);
  98. svg = ms.ToArray();
  99. cache.Add(colorKey, svg);
  100. ms.Dispose();
  101. return svg;
  102. }
  103. public static SvgImage CreateClose(string colorStr = "#D11C1C", double opacity = 1)
  104. {
  105. if (string.IsNullOrWhiteSpace(colorStr))
  106. colorStr = $"#D11C1C";
  107. string xml = $"<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox='0 0 32 32'>\r\n<g>\r\n<path opacity=\"{opacity}\" fill=\"{colorStr}\" d=\"M18.8,16l6.9-6.9c0.4-0.4,0.4-1,0-1.4l-1.4-1.4c-0.4-0.4-1-0.4-1.4,0L16,13.2L9.1,6.3c-0.4-0.4-1-0.4-1.4,0\r\nL6.3,7.7c-0.4,0.4-0.4,1,0,1.4l6.9,6.9l-6.9,6.9c-0.4,0.4-0.4,1,0,1.4l1.4,1.4c0.4,0.4,1,0.4,1.4,0l6.9-6.9l6.9,6.9\r\nc0.4,0.4,1,0.4,1.4,0l1.4-1.4c0.4-0.4,0.4-1,0-1.4L18.8,16z\"/>\r\n</g>\r\n</svg>";
  108. MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(xml));
  109. var svg = SvgLoader.LoadFromStream(ms);
  110. ms.Dispose();
  111. return svg;
  112. }
  113. public static SvgImage CreateClear()
  114. {
  115. string xml = $"<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox='0 0 32 32'>\r\n<path class=\"Blue\" d=\"M16.1,23.1l-4.4,4.4c-0.7,0.7-1.9,0.7-2.6,0l-6.6-6.6c-0.7-0.7-0.7-1.9,0-2.6L6.9,14L16.1,23.1z\"/><path class=\"Red\" d=\"M27.5,11.8l-10,10l-9.2-9.2l10-10c0.7-0.7,1.9-0.7,2.6,0l6.6,6.6C28.2,9.9,28.2,11,27.5,11.8z\"/></svg>";
  116. MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(xml));
  117. var svg = SvgLoader.LoadFromStream(ms);
  118. ms.Dispose();
  119. return svg;
  120. }
  121. public static SvgImage CreateDistanceLine()
  122. {
  123. string xml = $"<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox='0 0 32 32'>"
  124. + "<path class=\"Blue\" d=\"M27,8c-1.7,0-3,1.3-3,3c0,0.5,0.1,0.9,0.3,1.3l-6,6C17.9,18.1,17.5,18,17,18s-0.9,0.1-1.3,0.3l-2-2\r\n\t\tc0.2-0.4,0.3-0.8,0.3-1.3c0-1.7-1.3-3-3-3s-3,1.3-3,3c0,0.5,0.1,0.9,0.3,1.3l-2,2C5.9,18.1,5.5,18,5,18c-1.7,0-3,1.3-3,3s1.3,3,3,3\r\n\t\ts3-1.3,3-3c0-0.5-0.1-0.9-0.3-1.3l2-2c0.4,0.2,0.8,0.3,1.3,0.3s0.9-0.1,1.3-0.3l2,2C14.1,20.1,14,20.5,14,21c0,1.7,1.3,3,3,3\r\n\t\ts3-1.3,3-3c0-0.5-0.1-0.9-0.3-1.3l6-6c0.4,0.2,0.8,0.3,1.3,0.3c1.7,0,3-1.3,3-3S28.7,8,27,8z M5,22c-0.6,0-1-0.4-1-1s0.4-1,1-1\r\n\t\ts1,0.4,1,1S5.6,22,5,22z M11,16c-0.6,0-1-0.4-1-1s0.4-1,1-1s1,0.4,1,1S11.6,16,11,16z M17,22c-0.6,0-1-0.4-1-1s0.4-1,1-1s1,0.4,1,1\r\n\t\tS17.6,22,17,22z M27,12c-0.6,0-1-0.4-1-1s0.4-1,1-1s1,0.4,1,1S27.6,12,27,12z\"/>"
  125. + "</svg>";
  126. MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(xml));
  127. var svg = SvgLoader.LoadFromStream(ms);
  128. ms.Dispose();
  129. return svg;
  130. }
  131. public static SvgImage CreateMarkDot()
  132. {
  133. string xml = $"<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox='0 0 32 32'>" + "<path class=\"Blue\" d=\"M6,8c0,1.1-0.9,2-2,2c-1.1,0-2-0.9-2-2s0.9-2,2-2C5.1,6,6,6.9,6,8z M10,22c-1.1,0-2,0.9-2,2s0.9,2,2,2\r\n\tc1.1,0,2-0.9,2-2S11.1,22,10,22z M18,16c-1.1,0-2,0.9-2,2s0.9,2,2,2c1.1,0,2-0.9,2-2S19.1,16,18,16z M22,8c-1.1,0-2,0.9-2,2\r\n\tc0,1.1,0.9,2,2,2c1.1,0,2-0.9,2-2C24,8.9,23.1,8,22,8z M28,4c-1.1,0-2,0.9-2,2s0.9,2,2,2c1.1,0,2-0.9,2-2S29.1,4,28,4z\"/>\r\n<path class=\"Yellow\" d=\"M8,18c0,1.1-0.9,2-2,2c-1.1,0-2-0.9-2-2s0.9-2,2-2C7.1,16,8,16.9,8,18z M12,10c-1.1,0-2,0.9-2,2s0.9,2,2,2\r\n\tc1.1,0,2-0.9,2-2S13.1,10,12,10z M4,26c-1.1,0-2,0.9-2,2s0.9,2,2,2c1.1,0,2-0.9,2-2S5.1,26,4,26z M20,2c-1.1,0-2,0.9-2,2s0.9,2,2,2\r\n\tc1.1,0,2-0.9,2-2S21.1,2,20,2z M28,12c-1.1,0-2,0.9-2,2s0.9,2,2,2c1.1,0,2-0.9,2-2S29.1,12,28,12z\"/>"
  134. + "</svg>";
  135. MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(xml));
  136. var svg = SvgLoader.LoadFromStream(ms);
  137. ms.Dispose();
  138. return svg;
  139. }
  140. public static SvgImage CreateGeoDot(string color = "#D11C1C")
  141. {
  142. string xml = $"<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox='0 0 32 32'>" + $"<path fill='{color}' d='M16,2C10.5,2,6,6.5,6,12s10,18,10,18s10-12.5,10-18S21.5,2,16,2z M16,16c-2.2,0-4-1.8-4-4s1.8-4,4-4s4,1.8,4,4S18.2,16,16,16z'/>"
  143. + "</svg>";
  144. MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(xml));
  145. var svg = SvgLoader.LoadFromStream(ms);
  146. ms.Dispose();
  147. return svg;
  148. }
  149. /// <summary>
  150. /// 五角星
  151. /// </summary>
  152. /// <param name="viewBoxWidth"></param>
  153. /// <param name="viewBoxHeight"></param>
  154. /// <param name="offsetX"></param>
  155. /// <returns></returns>
  156. public static SvgImage CreatePentagram(string color = "#1177D7")
  157. {
  158. string xml = $"<svg xmlns='http://www.w3.org/2000/svg\' viewBox='0 0 32 32'>" + $"<polygon fill='{color}' points='16,4 19.9,11.9 28.6,13.2 22.3,19.3 23.8,28 16,23.9 8.2,28 9.7,19.3 3.4,13.2 12.1,11.9'/>"
  159. + "</svg>";
  160. MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(xml));
  161. var svg = SvgLoader.LoadFromStream(ms);
  162. ms.Dispose();
  163. return svg;
  164. }
  165. public static SvgImage CreateSat()
  166. {
  167. string xml = $"<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox='0 0 64 64'>" +
  168. $"<path fill='#d0d0d0' d='M24.4 24.4c3.2-3.2 3.2-8.4 0-11.6L12.8 24.4c3.2 3.2 8.4 3.2 11.6 0'/>" +
  169. $"<path fill='#94989b' d='M27 27c-4.3 4.3-4.3 4.3-6 2.6c-1.7-1.7-1.7-1.7 2.6-6s4.3-4.3 6-2.6c1.7 1.7 1.7 1.7-2.6 6'/>" +
  170. $"<path fill='#7f8285' d='M37.2 37.2c-4.3 4.3-4.3 4.3-6 2.6l-6.9-6.9c-1.7-1.7-1.7-1.7 2.6-6s4.3-4.3 6-2.6l6.9 6.9c1.7 1.7 1.7 1.7-2.6 6'/>" +
  171. $"<path fill='#646669' d='M39.6 39.6c-3.2 3.2-3.2 3.2-4.5 1.9c-1.3-1.3-1.3-1.3 1.9-4.5s3.2-3.2 4.5-1.9c1.3 1.2 1.3 1.2-1.9 4.5'/>" +
  172. $"<path fill='#94989b' d='M22.2 15l-7.1-1.3c0-.3-.1-.5-.3-.7c-.4-.4-1.2-.4-1.6 0c-.4.4-.4 1.2 0 1.6c.2.2.4.3.6.3l1.4 7.2l.8-.8h-.2l-1.2-6.5c.1-.1.2-.1.3-.2c.1-.1.1-.1.1-.2l6.5 1.2v.2l.7-.8'/>" +
  173. $"<path fill='#3e4347' d='M25.756 37.336l1.485-1.484l.919.92l-1.485 1.484z'/>" +
  174. $"<path fill='#3e4347' d='M35.866 27.24l1.485-1.484l.919.919l-1.485 1.485z'/>" +
  175. $"<path fill='#428bc1' d='M31.1 42.6c.2.2.2.5 0 .7L12.5 61.9c-.2.2-.5.2-.7 0l-9.7-9.7c-.1-.2-.1-.5 0-.7l18.6-18.6c.2-.2.5-.2.7 0l9.7 9.7'/>" +
  176. $"<path fill='#428bc1' d='M61.9 11.9c.2.2.2.5 0 .7L43.3 31.1c-.2.2-.5.2-.7 0l-9.7-9.7c-.2-.2-.2-.5 0-.7L51.5 2.1c.2-.1.5-.1.6 0l9.8 9.8'/>" +
  177. $"<path fill='#42ade2' d='M3.3 51.8l.7.7h16.4l5.1-5.1H7.7z'/>" +
  178. $"<path fill='#42ade2' d='M29.2 42.3H12.8l-2.5 2.6H28l1.9-1.9z'/>" +
  179. $"<path fill='#42ade2' d='M34.1 21l.7.7h16.4l5.1-5.1H38.5z'/>" +
  180. $"<path fill='#42ade2' d='M60 11.5H43.6l-2.5 2.6h17.7l1.9-1.9z'/>"
  181. + "</svg>";
  182. MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(xml));
  183. var svg = SvgLoader.LoadFromStream(ms);
  184. ms.Dispose();
  185. return svg;
  186. }
  187. #region exportImg
  188. public static SvgImage CreateExportImg()
  189. {
  190. string xml = $"<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox='0 0 32 32'>" + "<style type=\"text/css\">\r\n\t.Black{fill:#727272;}\r\n\t.Blue{fill:#1177D7;}\r\n\t.Red{fill:#D11C1C;}\r\n\t.st0{opacity:0.2;}\r\n</style>\r\n<path class=\"Black\" d=\"M8,4h18v6h2V3c0-0.5-0.5-1-1-1H7C6.5,2,6,2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.1,2v4.3h-1.4v-7.7h2.2l1.4,4.6c0.1,0.4,0.2,0.7,0.2,1.1l0,0c0.1-0.4,0.2-0.8,0.3-1.1l1.4-4.6H19v7.7H18.9z\r\n\t\t M26,17.3c-0.7,0.4-1.5,0.7-2.5,0.7c-1.1,0-2-0.3-2.6-1S20,15.4,20,14.2s0.3-2.2,1-3s1.6-1.1,2.8-1.1c0.7,0,1.4,0.1,1.9,0.3V12\r\n\t\tc-0.5-0.3-1.2-0.5-1.9-0.5c-0.6,0-1.2,0.2-1.6,0.7s-0.6,1.1-0.6,1.9c0,0.8,0.2,1.4,0.5,1.8c0.4,0.4,0.8,0.6,1.5,0.6\r\n\t\tc0.4,0,0.7-0.1,0.9-0.2v-1.5h-1.4v-1.4H26V17.3z\"/>\r\n</g>"
  191. + "</svg>";
  192. MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(xml));
  193. var svg = SvgLoader.LoadFromStream(ms);
  194. ms.Dispose();
  195. return svg;
  196. }
  197. public static SvgImage CreateExportXlsx()
  198. {
  199. string xml = $"<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox='0 0 32 32'>" + "<style type=\"text/css\">\r\n\t.Green{fill:#039C23;}\r\n\t.Black{fill:#727272;}\r\n\t.Blue{fill:#1177D7;}\r\n\t.st0{opacity:0.3;}\r\n</style>\r\n<path class=\"Black\" d=\"M8,4h18v6h2V3c0-0.5-0.5-1-1-1H7C6.5,2,6,2.5,6,3v7h2V4z\"/>\r\n<path class=\"Black\" d=\"M26,28H8V18H6v11c0,0.5,0.5,1,1,1h20c0.5,0,1-0.5,1-1V18h-2V28z\"/>\r\n<path class=\"Green\" d=\"M31,8H3C2.4,8,2,8.4,2,9v10c0,0.6,0.4,1,1,1h28c0.6,0,1-0.4,1-1V9C32,8.4,31.6,8,31,8z M9.1,18l-1.3-2.5\r\n\tc-0.1-0.1-0.1-0.3-0.2-0.5l0,0c0,0.1-0.1,0.3-0.2,0.5L6.1,18H4l2.5-3.9l-2.2-3.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0,0.6,0.1,0.9,0.2\r\n\t\tv1.6c-0.1-0.1-0.3-0.2-0.4-0.2s-0.3-0.1-0.5-0.2c-0.2,0-0.3-0.1-0.5-0.1s-0.3,0-0.5,0s-0.4,0-0.5,0.1c-0.2,0-0.3,0.1-0.4,0.2\r\n\t\tc-0.1,0.1-0.2,0.1-0.3,0.2c-0.1,0.1-0.1,0.2-0.1,0.3s0,0.2,0.1,0.3s0.2,0.2,0.3,0.3c0.1,0.1,0.3,0.2,0.5,0.3s0.4,0.2,0.6,0.3\r\n\t\tc0.3,0.1,0.6,0.3,0.8,0.4c0.2,0.1,0.5,0.3,0.6,0.5c0.2,0.2,0.3,0.4,0.4,0.6s0.1,0.5,0.1,0.8C22.6,16.3,22.5,16.6,22.4,16.9z\r\n\t\t M28.1,18l-1.3-2.5c-0.1-0.1-0.1-0.3-0.2-0.5l0,0c0,0.1-0.1,0.3-0.2,0.5L25.1,18H23l2.5-3.9l-2.2-3.9h2.1l1.1,2.3\r\n\t\tc0.1,0.2,0.2,0.4,0.2,0.7l0,0c0-0.2,0.1-0.4,0.2-0.7l1.2-2.3H30L27.7,14l2.4,3.9L28.1,18L28.1,18z\"/>\r\n</g>"
  200. + "</svg>";
  201. MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(xml));
  202. var svg = SvgLoader.LoadFromStream(ms);
  203. ms.Dispose();
  204. return svg;
  205. }
  206. public static SvgImage CreateExportCsv()
  207. {
  208. string xml = $"<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox='0 0 32 32'>" + "<style type=\"text/css\">\r\n\t.Black{fill:#727272;}\r\n\t.Blue{fill:#1177D7;}\r\n</style>\r\n<path class=\"Black\" d=\"M8,4h18v6h2V3c0-0.5-0.5-1-1-1H7C6.5,2,6,2.5,6,3v7h2V4z\"/>\r\n<path class=\"Black\" d=\"M26,28H8V18H6v11c0,0.5,0.5,1,1,1h20c0.5,0,1-0.5,1-1V18h-2V28z\"/>\r\n<path class=\"Blue\" d=\"M29,8h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.1c-0.1,0-0.3,0-0.4,0\r\n\tc-0.2,0-0.3,0-0.5,0.1c-0.1,0-0.3,0.1-0.4,0.2c-0.1,0.1-0.2,0.1-0.2,0.2c-0.1,0.1-0.1,0.2-0.1,0.3c0,0.1,0,0.2,0.1,0.3\r\n\tc0.1,0.1,0.2,0.2,0.3,0.3c0.1,0.1,0.3,0.2,0.4,0.3c0.2,0.1,0.4,0.2,0.6,0.3c0.3,0.1,0.5,0.3,0.8,0.4c0.2,0.1,0.4,0.3,0.6,0.5\r\n\tc0.2,0.2,0.3,0.4,0.4,0.6c0.1,0.2,0.1,0.5,0.1,0.8C19.5,16.1,19.4,16.5,19.2,16.8z M26,13.2l-1.5,4.7h-1.8L20.3,10H22l1.5,5.5\r\n\tc0.1,0.3,0.1,0.5,0.1,0.8h0c0-0.2,0.1-0.5,0.2-0.8l1.5-5.5H26h1L26,13.2z\"/>"
  209. + "</svg>";
  210. MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(xml));
  211. var svg = SvgLoader.LoadFromStream(ms);
  212. ms.Dispose();
  213. return svg;
  214. }
  215. #endregion
  216. }
  217. }