Fill.cs 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Drawing;
  4. using System.Drawing.Drawing2D;
  5. using System.Text;
  6. namespace HTEXLib
  7. {
  8. /// <summary>
  9. /// 对元素的边框,填充支撑如何
  10. /// </summary>
  11. public class Fill
  12. {
  13. public Fill() {
  14. }
  15. /// <summary>
  16. /// https://www.cnblogs.com/coco1s/p/8080211.html 图案的前景色 背景色
  17. /// [a:noFill, solidFill, gradFill, blipFill, pattFill, grpFill]
  18. ///-1 则说明需要继承ShapeStyle 的LineColor , 0,无填充 1.纯色填充 2.渐变填充 3.图片或纹理填充 4.图案填充
  19. /// </summary>
  20. public int? type { get; set; }
  21. public string solidFill { get; set; }
  22. public HtexBlipFill blipFill { get; set; }
  23. public HtexGradientFill gradientFill { get; set; }
  24. public HtexPattFill pattFill { get; set; }
  25. //public HtexOutline outline { get; set; }
  26. //public Border border { get; set; }
  27. }
  28. /// <summary>
  29. /// 3.图片或纹理填充
  30. /// </summary>
  31. /// <summary>
  32. /// 3.图片或纹理填充
  33. /// </summary>
  34. public class HtexBlipFill {
  35. public Vector fillRect { get; set; }
  36. public string url { get; set; }
  37. /// <summary>
  38. /// base64,link
  39. /// </summary>
  40. // public string urlType { get; set; }
  41. //public string contentType { get; set; }
  42. public string dip { get; set; }
  43. public bool rotWithShape { get; set; } = true;
  44. public double opacity { get; set; } = 0;
  45. public HtexTile tile { get; set; }
  46. }
  47. public class HtexTile{
  48. public string algn { get; set; } //Alignment 对齐方式
  49. public string flip { get; set; }//Tile Flipping 镜像类型
  50. public double tx { get; set; }//Horizontal Offset 水平偏移量
  51. public double ty { get; set; }//Vertical Offset 垂直偏移量
  52. public double sx { get; set; }//Horizontal Ratio 水平刻度
  53. public double sy { get; set; }//Vertical Ratio 垂直刻度
  54. }
  55. public class HtexPattFill {
  56. /// <summary>
  57. /// https://www.cnblogs.com/jxsoft/archive/2011/04/01/2001942.html
  58. /// System.Drawing.Drawing2D.HatchStyle
  59. /// https://github.com/CXuesong/PrettyReport/blob/1eaf0da8fd419627cfb418a1f7a7e229a543e681/SpreadsheetLightX25/Drawing/SLDrawingTool.cs
  60. /// 类型 前景色 背景色
  61. // HatchBrush myHatchBrush = new HatchBrush(HatchStyle.Vertical, Color.Blue, Color.Green);
  62. /// 图案填充的内置图形 ltDnDiag 等 48种内置图案
  63. /// </summary>
  64. public string prst { get; set; }
  65. /// <summary>
  66. ///前景色
  67. /// </summary>
  68. public string fgClr { get; set; }
  69. /// <summary>
  70. /// 背景色
  71. /// </summary>
  72. public string bgClr { get; set; }
  73. public string base64 { get; set; }
  74. }
  75. public class HtexGradientFill
  76. {
  77. public bool RotateWithShape { get; set; } = true;
  78. public string flip { get; set; }
  79. /// <summary>
  80. /// line 线性 ,path 路径
  81. /// </summary>
  82. public string type { get; set; }
  83. /// <summary>
  84. /// 颜色色带终结
  85. /// </summary>
  86. public List<ColorPosition> colors { get; set; } = new List<ColorPosition>();
  87. /// <summary>
  88. /// tileRect TileRectangle (平铺矩形) 右下角是一个矩形
  89. /// </summary>
  90. public Vector tileRect { get; set; }
  91. public LineFill line { get; set; }
  92. public PathFill path { get; set; }
  93. }
  94. public class LineFill
  95. {
  96. public double? rot { get; set; }
  97. public string scaled { get; set; }
  98. }
  99. public class PathFill
  100. {
  101. /// <summary>
  102. ///circle
  103. ///rect
  104. ///shape
  105. /// </summary>
  106. public string pathType { get; set; }
  107. public Vector fillToRect { get; set; }
  108. }
  109. public class ColorPosition
  110. {
  111. public string Color { get; set; }
  112. public double Position { get; set; }
  113. }
  114. /// <summary>
  115. /// 偏移向量
  116. /// </summary>
  117. public class Vector
  118. {
  119. //四个方向的偏移量,矩形的下边缘。例如50000/1000= 50% ,辐射百分比
  120. public int? b { get; set; }
  121. public int? l { get; set; }
  122. public int? r { get; set; }
  123. public int? t { get; set; }
  124. }
  125. }