IChartRenderingEngine.cs 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514
  1. // Licensed to the .NET Foundation under one or more agreements.
  2. // The .NET Foundation licenses this file to you under the MIT license.
  3. // See the LICENSE file in the project root for more information.
  4. //
  5. // Purpose: Defines interfaces which must be implemented by
  6. // every rendering and animation engine class. These
  7. // interfaces are used in GDI+, SVG and Flash rendering.
  8. // Note that animation is only available in SVG and
  9. // Flash rendering engines.
  10. //
  11. using System.Drawing;
  12. using System.Drawing.Drawing2D;
  13. using System.Drawing.Imaging;
  14. using System.Drawing.Text;
  15. namespace FastReport.DataVisualization.Charting
  16. {
  17. /// <summary>
  18. /// IChartRenderingEngine interface defines a set of methods and properties
  19. /// which must be implemented by any chart rendering engine. It contains
  20. /// methods for drawing basic shapes.
  21. /// </summary>
  22. internal interface IChartRenderingEngine
  23. {
  24. #region Drawing Methods
  25. /// <summary>
  26. /// Draws a line connecting two PointF structures.
  27. /// </summary>
  28. /// <param name="pen">Pen object that determines the color, width, and style of the line.</param>
  29. /// <param name="pt1">PointF structure that represents the first point to connect.</param>
  30. /// <param name="pt2">PointF structure that represents the second point to connect.</param>
  31. void DrawLine(
  32. Pen pen,
  33. PointF pt1,
  34. PointF pt2
  35. );
  36. /// <summary>
  37. /// Draws a line connecting the two points specified by coordinate pairs.
  38. /// </summary>
  39. /// <param name="pen">Pen object that determines the color, width, and style of the line.</param>
  40. /// <param name="x1">x-coordinate of the first point.</param>
  41. /// <param name="y1">y-coordinate of the first point.</param>
  42. /// <param name="x2">x-coordinate of the second point.</param>
  43. /// <param name="y2">y-coordinate of the second point.</param>
  44. void DrawLine(
  45. Pen pen,
  46. float x1,
  47. float y1,
  48. float x2,
  49. float y2
  50. );
  51. /// <summary>
  52. /// Draws the specified portion of the specified Image object at the specified location and with the specified size.
  53. /// </summary>
  54. /// <param name="image">Image object to draw.</param>
  55. /// <param name="destRect">Rectangle structure that specifies the location and size of the drawn image. The image is scaled to fit the rectangle.</param>
  56. /// <param name="srcX">x-coordinate of the upper-left corner of the portion of the source image to draw.</param>
  57. /// <param name="srcY">y-coordinate of the upper-left corner of the portion of the source image to draw.</param>
  58. /// <param name="srcWidth">Width of the portion of the source image to draw.</param>
  59. /// <param name="srcHeight">Height of the portion of the source image to draw.</param>
  60. /// <param name="srcUnit">Member of the GraphicsUnit enumeration that specifies the units of measure used to determine the source rectangle.</param>
  61. /// <param name="imageAttr">ImageAttributes object that specifies recoloring and gamma information for the image object.</param>
  62. void DrawImage(
  63. System.Drawing.Image image,
  64. Rectangle destRect,
  65. int srcX,
  66. int srcY,
  67. int srcWidth,
  68. int srcHeight,
  69. GraphicsUnit srcUnit,
  70. ImageAttributes imageAttr
  71. );
  72. /// <summary>
  73. /// Draws an ellipse defined by a bounding rectangle specified by
  74. /// a pair of coordinates, a height, and a width.
  75. /// </summary>
  76. /// <param name="pen">Pen object that determines the color, width, and style of the ellipse.</param>
  77. /// <param name="x">x-coordinate of the upper-left corner of the bounding rectangle that defines the ellipse.</param>
  78. /// <param name="y">y-coordinate of the upper-left corner of the bounding rectangle that defines the ellipse.</param>
  79. /// <param name="width">Width of the bounding rectangle that defines the ellipse.</param>
  80. /// <param name="height">Height of the bounding rectangle that defines the ellipse.</param>
  81. void DrawEllipse(
  82. Pen pen,
  83. float x,
  84. float y,
  85. float width,
  86. float height
  87. );
  88. /// <summary>
  89. /// Draws a cardinal spline through a specified array of PointF structures
  90. /// using a specified tension. The drawing begins offset from
  91. /// the beginning of the array.
  92. /// </summary>
  93. /// <param name="pen">Pen object that determines the color, width, and height of the curve.</param>
  94. /// <param name="points">Array of PointF structures that define the spline.</param>
  95. /// <param name="offset">Offset from the first element in the array of the points parameter to the starting point in the curve.</param>
  96. /// <param name="numberOfSegments">Number of segments after the starting point to include in the curve.</param>
  97. /// <param name="tension">Value greater than or equal to 0.0F that specifies the tension of the curve.</param>
  98. void DrawCurve(
  99. Pen pen,
  100. PointF[] points,
  101. int offset,
  102. int numberOfSegments,
  103. float tension
  104. );
  105. /// <summary>
  106. /// Draws a rectangle specified by a coordinate pair, a width, and a height.
  107. /// </summary>
  108. /// <param name="pen">Pen object that determines the color, width, and style of the rectangle.</param>
  109. /// <param name="x">x-coordinate of the upper-left corner of the rectangle to draw.</param>
  110. /// <param name="y">y-coordinate of the upper-left corner of the rectangle to draw.</param>
  111. /// <param name="width">Width of the rectangle to draw.</param>
  112. /// <param name="height">Height of the rectangle to draw.</param>
  113. void DrawRectangle(
  114. Pen pen,
  115. int x,
  116. int y,
  117. int width,
  118. int height
  119. );
  120. /// <summary>
  121. /// Draws a polygon defined by an array of PointF structures.
  122. /// </summary>
  123. /// <param name="pen">Pen object that determines the color, width, and style of the polygon.</param>
  124. /// <param name="points">Array of PointF structures that represent the vertices of the polygon.</param>
  125. void DrawPolygon(
  126. Pen pen,
  127. PointF[] points
  128. );
  129. /// <summary>
  130. /// Draws the specified text string in the specified rectangle with the specified Brush and Font objects using the formatting properties of the specified StringFormat object.
  131. /// </summary>
  132. /// <param name="s">String to draw.</param>
  133. /// <param name="font">Font object that defines the text format of the string.</param>
  134. /// <param name="brush">Brush object that determines the color and texture of the drawn text.</param>
  135. /// <param name="layoutRectangle">RectangleF structure that specifies the location of the drawn text.</param>
  136. /// <param name="format">StringFormat object that specifies formatting properties, such as line spacing and alignment, that are applied to the drawn text.</param>
  137. void DrawString(
  138. string s,
  139. Font font,
  140. Brush brush,
  141. RectangleF layoutRectangle,
  142. StringFormat format
  143. );
  144. /// <summary>
  145. /// Draws the specified text string at the specified location with the specified Brush and Font objects using the formatting properties of the specified StringFormat object.
  146. /// </summary>
  147. /// <param name="s">String to draw.</param>
  148. /// <param name="font">Font object that defines the text format of the string.</param>
  149. /// <param name="brush">Brush object that determines the color and texture of the drawn text.</param>
  150. /// <param name="point">PointF structure that specifies the upper-left corner of the drawn text.</param>
  151. /// <param name="format">StringFormat object that specifies formatting properties, such as line spacing and alignment, that are applied to the drawn text.</param>
  152. void DrawString(
  153. string s,
  154. Font font,
  155. Brush brush,
  156. PointF point,
  157. StringFormat format
  158. );
  159. /// <summary>
  160. /// Draws the specified portion of the specified Image object at the specified location and with the specified size.
  161. /// </summary>
  162. /// <param name="image">Image object to draw.</param>
  163. /// <param name="destRect">Rectangle structure that specifies the location and size of the drawn image. The image is scaled to fit the rectangle.</param>
  164. /// <param name="srcX">x-coordinate of the upper-left corner of the portion of the source image to draw.</param>
  165. /// <param name="srcY">y-coordinate of the upper-left corner of the portion of the source image to draw.</param>
  166. /// <param name="srcWidth">Width of the portion of the source image to draw.</param>
  167. /// <param name="srcHeight">Height of the portion of the source image to draw.</param>
  168. /// <param name="srcUnit">Member of the GraphicsUnit enumeration that specifies the units of measure used to determine the source rectangle.</param>
  169. /// <param name="imageAttrs">ImageAttributes object that specifies recoloring and gamma information for the image object.</param>
  170. void DrawImage(
  171. System.Drawing.Image image,
  172. Rectangle destRect,
  173. float srcX,
  174. float srcY,
  175. float srcWidth,
  176. float srcHeight,
  177. GraphicsUnit srcUnit,
  178. ImageAttributes imageAttrs
  179. );
  180. /// <summary>
  181. /// Draws a rectangle specified by a coordinate pair, a width, and a height.
  182. /// </summary>
  183. /// <param name="pen">A Pen object that determines the color, width, and style of the rectangle.</param>
  184. /// <param name="x">The x-coordinate of the upper-left corner of the rectangle to draw.</param>
  185. /// <param name="y">The y-coordinate of the upper-left corner of the rectangle to draw.</param>
  186. /// <param name="width">The width of the rectangle to draw.</param>
  187. /// <param name="height">The height of the rectangle to draw.</param>
  188. void DrawRectangle(
  189. Pen pen,
  190. float x,
  191. float y,
  192. float width,
  193. float height
  194. );
  195. /// <summary>
  196. /// Draws a GraphicsPath object.
  197. /// </summary>
  198. /// <param name="pen">Pen object that determines the color, width, and style of the path.</param>
  199. /// <param name="path">GraphicsPath object to draw.</param>
  200. void DrawPath(
  201. Pen pen,
  202. GraphicsPath path
  203. );
  204. /// <summary>
  205. /// Draws a pie shape defined by an ellipse specified by a coordinate pair, a width, and a height and two radial lines.
  206. /// </summary>
  207. /// <param name="pen">Pen object that determines the color, width, and style of the pie shape.</param>
  208. /// <param name="x">x-coordinate of the upper-left corner of the bounding rectangle that defines the ellipse from which the pie shape comes.</param>
  209. /// <param name="y">y-coordinate of the upper-left corner of the bounding rectangle that defines the ellipse from which the pie shape comes.</param>
  210. /// <param name="width">Width of the bounding rectangle that defines the ellipse from which the pie shape comes.</param>
  211. /// <param name="height">Height of the bounding rectangle that defines the ellipse from which the pie shape comes.</param>
  212. /// <param name="startAngle">Angle measured in degrees clockwise from the x-axis to the first side of the pie shape.</param>
  213. /// <param name="sweepAngle">Angle measured in degrees clockwise from the startAngle parameter to the second side of the pie shape.</param>
  214. void DrawPie(
  215. Pen pen,
  216. float x,
  217. float y,
  218. float width,
  219. float height,
  220. float startAngle,
  221. float sweepAngle
  222. );
  223. /// <summary>
  224. /// Draws an arc representing a portion of an ellipse specified by a pair of coordinates, a width, and a height.
  225. /// </summary>
  226. /// <param name="pen">Pen object that determines the color, width, and style of the arc.</param>
  227. /// <param name="x">x-coordinate of the upper-left corner of the rectangle that defines the ellipse.</param>
  228. /// <param name="y">y-coordinate of the upper-left corner of the rectangle that defines the ellipse.</param>
  229. /// <param name="width">Width of the rectangle that defines the ellipse.</param>
  230. /// <param name="height">Height of the rectangle that defines the ellipse.</param>
  231. /// <param name="startAngle">Angle in degrees measured clockwise from the x-axis to the starting point of the arc.</param>
  232. /// <param name="sweepAngle">Angle in degrees measured clockwise from the startAngle parameter to ending point of the arc.</param>
  233. void DrawArc(
  234. Pen pen,
  235. float x,
  236. float y,
  237. float width,
  238. float height,
  239. float startAngle,
  240. float sweepAngle
  241. );
  242. /// <summary>
  243. /// Draws the specified Image object at the specified location and with the specified size.
  244. /// </summary>
  245. /// <param name="image">Image object to draw.</param>
  246. /// <param name="rect">RectangleF structure that specifies the location and size of the drawn image.</param>
  247. void DrawImage(
  248. System.Drawing.Image image,
  249. RectangleF rect
  250. );
  251. /// <summary>
  252. /// Draws an ellipse defined by a bounding RectangleF.
  253. /// </summary>
  254. /// <param name="pen">Pen object that determines the color, width, and style of the ellipse.</param>
  255. /// <param name="rect">RectangleF structure that defines the boundaries of the ellipse.</param>
  256. void DrawEllipse(
  257. Pen pen,
  258. RectangleF rect
  259. );
  260. /// <summary>
  261. /// Draws a series of line segments that connect an array of PointF structures.
  262. /// </summary>
  263. /// <param name="pen">Pen object that determines the color, width, and style of the line segments.</param>
  264. /// <param name="points">Array of PointF structures that represent the points to connect.</param>
  265. void DrawLines(
  266. Pen pen,
  267. PointF[] points
  268. );
  269. #endregion // Drawing Methods
  270. #region Filling Methods
  271. /// <summary>
  272. /// Fills the interior of an ellipse defined by a bounding rectangle
  273. /// specified by a RectangleF structure.
  274. /// </summary>
  275. /// <param name="brush">Brush object that determines the characteristics of the fill.</param>
  276. /// <param name="rect">RectangleF structure that represents the bounding rectangle that defines the ellipse.</param>
  277. void FillEllipse(
  278. Brush brush,
  279. RectangleF rect
  280. );
  281. /// <summary>
  282. /// Fills the interior of a GraphicsPath object.
  283. /// </summary>
  284. /// <param name="brush">Brush object that determines the characteristics of the fill.</param>
  285. /// <param name="path">GraphicsPath object that represents the path to fill.</param>
  286. void FillPath(
  287. Brush brush,
  288. GraphicsPath path
  289. );
  290. /// <summary>
  291. /// Fills the interior of a Region object.
  292. /// </summary>
  293. /// <param name="brush">Brush object that determines the characteristics of the fill.</param>
  294. /// <param name="region">Region object that represents the area to fill.</param>
  295. void FillRegion(
  296. Brush brush,
  297. Region region
  298. );
  299. /// <summary>
  300. /// Fills the interior of a rectangle specified by a RectangleF structure.
  301. /// </summary>
  302. /// <param name="brush">Brush object that determines the characteristics of the fill.</param>
  303. /// <param name="rect">RectangleF structure that represents the rectangle to fill.</param>
  304. void FillRectangle(
  305. Brush brush,
  306. RectangleF rect
  307. );
  308. /// <summary>
  309. /// Fills the interior of a rectangle specified by a pair of coordinates, a width, and a height.
  310. /// </summary>
  311. /// <param name="brush">Brush object that determines the characteristics of the fill.</param>
  312. /// <param name="x">x-coordinate of the upper-left corner of the rectangle to fill.</param>
  313. /// <param name="y">y-coordinate of the upper-left corner of the rectangle to fill.</param>
  314. /// <param name="width">Width of the rectangle to fill.</param>
  315. /// <param name="height">Height of the rectangle to fill.</param>
  316. void FillRectangle(
  317. Brush brush,
  318. float x,
  319. float y,
  320. float width,
  321. float height
  322. );
  323. /// <summary>
  324. /// Fills the interior of a polygon defined by an array of points specified by PointF structures .
  325. /// </summary>
  326. /// <param name="brush">Brush object that determines the characteristics of the fill.</param>
  327. /// <param name="points">Array of PointF structures that represent the vertices of the polygon to fill.</param>
  328. void FillPolygon(
  329. Brush brush,
  330. PointF[] points
  331. );
  332. /// <summary>
  333. /// Fills the interior of a pie section defined by an ellipse
  334. /// specified by a pair of coordinates, a width, and a height
  335. /// and two radial lines.
  336. /// </summary>
  337. /// <param name="brush">Brush object that determines the characteristics of the fill.</param>
  338. /// <param name="x">x-coordinate of the upper-left corner of the bounding rectangle that defines the ellipse from which the pie section comes.</param>
  339. /// <param name="y">y-coordinate of the upper-left corner of the bounding rectangle that defines the ellipse from which the pie section comes.</param>
  340. /// <param name="width">Width of the bounding rectangle that defines the ellipse from which the pie section comes.</param>
  341. /// <param name="height">Height of the bounding rectangle that defines the ellipse from which the pie section comes.</param>
  342. /// <param name="startAngle">Angle in degrees measured clockwise from the x-axis to the first side of the pie section.</param>
  343. /// <param name="sweepAngle">Angle in degrees measured clockwise from the startAngle parameter to the second side of the pie section.</param>
  344. void FillPie(
  345. Brush brush,
  346. float x,
  347. float y,
  348. float width,
  349. float height,
  350. float startAngle,
  351. float sweepAngle
  352. );
  353. #endregion // Filling Methods
  354. #region Other Methods
  355. /// <summary>
  356. /// Measures the specified string when drawn with the specified
  357. /// Font object and formatted with the specified StringFormat object.
  358. /// </summary>
  359. /// <param name="text">String to measure.</param>
  360. /// <param name="font">Font object defines the text format of the string.</param>
  361. /// <param name="layoutArea">SizeF structure that specifies the maximum layout area for the text.</param>
  362. /// <param name="stringFormat">StringFormat object that represents formatting information, such as line spacing, for the string.</param>
  363. /// <returns>This method returns a SizeF structure that represents the size, in pixels, of the string specified in the text parameter as drawn with the font parameter and the stringFormat parameter.</returns>
  364. SizeF MeasureString(
  365. string text,
  366. Font font,
  367. SizeF layoutArea,
  368. StringFormat stringFormat
  369. );
  370. /// <summary>
  371. /// Measures the specified string when drawn with the specified
  372. /// Font object and formatted with the specified StringFormat object.
  373. /// </summary>
  374. /// <param name="text">String to measure.</param>
  375. /// <param name="font">Font object defines the text format of the string.</param>
  376. /// <returns>This method returns a SizeF structure that represents the size, in pixels, of the string specified in the text parameter as drawn with the font parameter and the stringFormat parameter.</returns>
  377. SizeF MeasureString(
  378. string text,
  379. Font font
  380. );
  381. /// <summary>
  382. /// Saves the current state of this Graphics object and identifies the saved state with a GraphicsState object.
  383. /// </summary>
  384. /// <returns>This method returns a GraphicsState object that represents the saved state of this Graphics object.</returns>
  385. IGraphicsState Save();
  386. /// <summary>
  387. /// Restores the saved state of graphics object.
  388. /// </summary>
  389. /// <param name="gstate">State to restore.</param>
  390. void Restore(
  391. IGraphicsState gstate
  392. );
  393. /// <summary>
  394. /// Resets the clip region of this Graphics object to an infinite region.
  395. /// </summary>
  396. void ResetClip();
  397. /// <summary>
  398. /// Sets the clipping region of this Graphics object to the rectangle specified by a RectangleF structure.
  399. /// </summary>
  400. /// <param name="rect">RectangleF structure that represents the new clip region.</param>
  401. void SetClip(
  402. RectangleF rect
  403. );
  404. /// <summary>
  405. /// Sets the clipping region of this Graphics object to the result of the
  406. /// specified operation combining the current clip region and the
  407. /// specified GraphicsPath object.
  408. /// </summary>
  409. /// <param name="path">GraphicsPath object to combine.</param>
  410. /// <param name="combineMode">Member of the CombineMode enumeration that specifies the combining operation to use.</param>
  411. void SetClip(
  412. GraphicsPath path,
  413. CombineMode combineMode
  414. );
  415. /// <summary>
  416. /// Prepends the specified translation to the transformation matrix of this Graphics object.
  417. /// </summary>
  418. /// <param name="dx">x component of the translation.</param>
  419. /// <param name="dy">y component of the translation.</param>
  420. void TranslateTransform(
  421. float dx,
  422. float dy
  423. );
  424. /// <summary>
  425. /// This method starts Selection mode
  426. /// </summary>
  427. /// <param name="hRef">The location of the referenced object, expressed as a URI reference.</param>
  428. /// <param name="title">Title which could be used for tooltips.</param>
  429. void BeginSelection( string hRef, string title );
  430. /// <summary>
  431. /// This method stops Selection mode
  432. /// </summary>
  433. void EndSelection( );
  434. #endregion // Other Methods
  435. #region Properties
  436. /// <summary>
  437. /// Gets or sets the world transformation for this Graphics object.
  438. /// </summary>
  439. Matrix Transform {get; set;}
  440. /// <summary>
  441. /// Gets or sets the rendering quality for this Graphics object.
  442. /// </summary>
  443. SmoothingMode SmoothingMode {get; set;}
  444. /// <summary>
  445. /// Gets or sets the rendering mode for text associated with this Graphics object.
  446. /// </summary>
  447. TextRenderingHint TextRenderingHint {get; set;}
  448. /// <summary>
  449. /// Gets or sets a Region object that limits the drawing region of this Graphics object.
  450. /// </summary>
  451. Region Clip {get; set;}
  452. /// <summary>
  453. /// Reference to the Graphics object
  454. /// </summary>
  455. IGraphics Graphics {get; set;}
  456. /// <summary>
  457. /// Gets a value indicating whether the clipping region of this Graphics object is empty.
  458. /// </summary>
  459. bool IsClipEmpty {get;}
  460. #endregion // Properties
  461. }
  462. }