Updates referencesource to .NET 4.7
[mono.git] / mcs / class / referencesource / System.Web.DataVisualization / Common / General / ChartRenderingEngine.cs
1 //-------------------------------------------------------------
2 // <copyright company=\92Microsoft Corporation\92>
3 //   Copyright © Microsoft Corporation. All Rights Reserved.
4 // </copyright>
5 //-------------------------------------------------------------
6 // @owner=alexgor, deliant
7 //=================================================================
8 //  File:               ChartRenderingEngine.cs
9 //
10 //  Namespace:  System.Web.UI.WebControls[Windows.Forms].Charting
11 //
12 //      Classes:        ChartRenderingEngine, ValueA, PointA, RectangleA, 
13 //                              ColorA
14 //
15 //  Purpose:    ChartRenderingEngine class provides a common interface 
16 //              to the graphics rendering and animation engines. 
17 //              Internally it uses SvgChartGraphics, FlashGraphics or 
18 //              GdiGraphics classes depending on the ActiveRenderingType 
19 //              property settings.
20 //
21 //              ValueA, PointA, RectangleA and ColorA classes are
22 //              used to store data about animated values like colors
23 //              position or rectangles. They store starting value/time, 
24 //              end value/time, repeat flags and other settings. These 
25 //              clases are used with animation engines.
26 //
27 //      Reviwed:        AG - Jul 15, 2003
28 //              AG - Microsoft 16, 2007
29 //
30 //===================================================================
31
32
33 #region Used namespaces
34
35 using System;
36 using System.Drawing;
37 using System.Drawing.Drawing2D;
38 using System.Drawing.Text;
39 using System.Drawing.Imaging;
40 using System.ComponentModel;
41 using System.Collections;
42 using System.Xml;
43 using System.IO;
44 using System.Diagnostics.CodeAnalysis;
45
46 #if Microsoft_CONTROL
47
48 using System.Windows.Forms.DataVisualization.Charting.Utilities;
49 using System.Windows.Forms.DataVisualization.Charting.Borders3D;
50 #else
51 using System.Web.UI.DataVisualization.Charting.Utilities;
52 using System.Web.UI.DataVisualization.Charting.Borders3D;
53 #endif
54
55
56 #endregion
57
58 #if Microsoft_CONTROL
59     namespace System.Windows.Forms.DataVisualization.Charting
60 #else
61 namespace System.Web.UI.DataVisualization.Charting
62
63 #endif
64 {
65         #region Enumerations
66
67         /// <summary>
68         /// Specify Rendering AxisName
69         /// </summary>
70         internal enum RenderingType
71         {
72                 /// <summary>
73                 /// GDI+ AxisName
74                 /// </summary>
75         [SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Gdi")]
76         Gdi,
77
78                 /// <summary>
79                 /// SVG AxisName
80                 /// </summary>
81         [SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Svg")]
82         Svg,
83         }
84
85         #endregion // Enumerations
86
87         /// <summary>
88     /// The ChartGraphics class provides a common interface to the 
89     /// graphics rendering.
90         /// </summary>
91 #if ASPPERM_35
92         [AspNetHostingPermission(System.Security.Permissions.SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
93     [AspNetHostingPermission(System.Security.Permissions.SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
94 #endif
95     public partial class ChartGraphics
96         {
97                 #region Fields
98
99         // Current rendering type
100         private RenderingType _activeRenderingType = RenderingType.Gdi;
101
102         // GDI+ rendering engine
103         private GdiGraphics _gdiGraphics = new GdiGraphics();
104
105         // Document title used for SVG rendering
106         //private string documentTitle = string.Empty;
107
108         // True if text should be clipped
109         internal bool IsTextClipped = false;
110
111                 #endregion // Fields
112
113                 #region Drawing Methods
114
115                 /// <summary>
116                 /// Draws a line connecting two PointF structures.
117                 /// </summary>
118                 /// <param name="pen">Pen object that determines the color, width, and style of the line.</param>
119                 /// <param name="pt1">PointF structure that represents the first point to connect.</param>
120                 /// <param name="pt2">PointF structure that represents the second point to connect.</param>
121                 internal void DrawLine(
122                         Pen pen,
123                         PointF pt1,
124                         PointF pt2
125                         )
126                 {
127                 RenderingObject.DrawLine( pen, pt1, pt2 );
128                 }
129
130                 /// <summary>
131                 /// Draws a line connecting the two points specified by coordinate pairs.
132                 /// </summary>
133                 /// <param name="pen">Pen object that determines the color, width, and style of the line.</param>
134                 /// <param name="x1">x-coordinate of the first point.</param>
135                 /// <param name="y1">y-coordinate of the first point.</param>
136                 /// <param name="x2">x-coordinate of the second point.</param>
137                 /// <param name="y2">y-coordinate of the second point.</param>
138                 internal void DrawLine(
139                         Pen pen,
140                         float x1,
141                         float y1,
142                         float x2,
143                         float y2
144                         )
145                 {
146                         RenderingObject.DrawLine( pen, x1, y1, x2, y2 );
147                 }
148
149                 /// <summary>
150                 /// Draws the specified portion of the specified Image object at the specified location and with the specified size.
151                 /// </summary>
152                 /// <param name="image">Image object to draw.</param>
153                 /// <param name="destRect">Rectangle structure that specifies the location and size of the drawn image. The image is scaled to fit the rectangle.</param>
154                 /// <param name="srcX">x-coordinate of the upper-left corner of the portion of the source image to draw.</param>
155                 /// <param name="srcY">y-coordinate of the upper-left corner of the portion of the source image to draw.</param>
156                 /// <param name="srcWidth">Width of the portion of the source image to draw.</param>
157                 /// <param name="srcHeight">Height of the portion of the source image to draw.</param>
158                 /// <param name="srcUnit">Member of the GraphicsUnit enumeration that specifies the units of measure used to determine the source rectangle.</param>
159                 /// <param name="imageAttr">ImageAttributes object that specifies recoloring and gamma information for the image object.</param>
160                 internal void DrawImage(
161             System.Drawing.Image image,
162                         Rectangle destRect,
163                         int srcX,
164                         int srcY,
165                         int srcWidth,
166                         int srcHeight,
167                         GraphicsUnit srcUnit,
168                         ImageAttributes imageAttr
169                         )
170                 {
171                         RenderingObject.DrawImage( 
172                                 image,
173                                 destRect,
174                                 srcX,
175                                 srcY,
176                                 srcWidth,
177                                 srcHeight,
178                                 srcUnit,
179                                 imageAttr
180                                 );
181                 }
182
183                 /// <summary>
184                 /// Draws an ellipse defined by a bounding rectangle specified by 
185                 /// a pair of coordinates, a height, and a width.
186                 /// </summary>
187                 /// <param name="pen">Pen object that determines the color, width, and style of the ellipse.</param>
188                 /// <param name="x">x-coordinate of the upper-left corner of the bounding rectangle that defines the ellipse.</param>
189                 /// <param name="y">y-coordinate of the upper-left corner of the bounding rectangle that defines the ellipse.</param>
190                 /// <param name="width">Width of the bounding rectangle that defines the ellipse.</param>
191                 /// <param name="height">Height of the bounding rectangle that defines the ellipse.</param>
192                 internal void DrawEllipse(
193                         Pen pen,
194                         float x,
195                         float y,
196                         float width,
197                         float height
198                         )
199                 {
200                         RenderingObject.DrawEllipse( pen, x, y, width, height );
201                 }
202
203                 /// <summary>
204                 /// Draws a cardinal spline through a specified array of PointF structures 
205                 /// using a specified tension. The drawing begins offset from 
206                 /// the beginning of the array.
207                 /// </summary>
208                 /// <param name="pen">Pen object that determines the color, width, and height of the curve.</param>
209                 /// <param name="points">Array of PointF structures that define the spline.</param>
210                 /// <param name="offset">Offset from the first element in the array of the points parameter to the starting point in the curve.</param>
211                 /// <param name="numberOfSegments">Number of segments after the starting point to include in the curve.</param>
212                 /// <param name="tension">Value greater than or equal to 0.0F that specifies the tension of the curve.</param>
213                 internal void DrawCurve(
214                         Pen pen,
215                         PointF[] points,
216                         int offset,
217                         int numberOfSegments,
218                         float tension
219                         )
220                 {
221             ChartGraphics chartGraphics = this as ChartGraphics;
222             if (chartGraphics == null || !chartGraphics.IsMetafile)
223             {
224                 RenderingObject.DrawCurve(pen, points, offset, numberOfSegments, tension);
225             }
226             else
227             {
228                 // Special handling required for the metafiles. We cannot pass large array of
229                 // points because they will be persisted inside EMF file and cause exponential 
230                 // increase in emf file size. Draw curve method uses additional 2, 3 or 4 points
231                 // depending on which segement is drawn.
232                 PointF[] pointsExact = null;
233                 if (offset == 0 && numberOfSegments == points.Length - 1)
234                 {
235                     // In case the array contains the minimum required number of points
236                     // to draw segments - just call the curve drawing method
237                     RenderingObject.DrawCurve(pen, points, offset, numberOfSegments, tension);
238                 }
239                 else
240                 {
241                     if (offset == 0 && numberOfSegments < points.Length - 1)
242                     {
243                         // Segment is at the beginning of the array with more points following
244                         pointsExact = new PointF[numberOfSegments + 2];
245                         for (int index = 0; index < numberOfSegments + 2; index++)
246                         {
247                             pointsExact[index] = points[index];
248                         }
249                     }
250                     else if (offset > 0 && (offset + numberOfSegments) == points.Length - 1)
251                     {
252                         // Segment is at the end of the array with more points prior to it
253                         pointsExact = new PointF[numberOfSegments + 2];
254                         for (int index = 0; index < numberOfSegments + 2; index++)
255                         {
256                             pointsExact[index] = points[offset + index - 1];
257                         }
258                         offset = 1;
259                     }
260                     else if (offset > 0 && (offset + numberOfSegments) < points.Length - 1)
261                     {
262                         // Segment in the middle of the array with points prior and following it
263                         pointsExact = new PointF[numberOfSegments + 3];
264                         for (int index = 0; index < numberOfSegments + 3; index++)
265                         {
266                             pointsExact[index] = points[offset + index - 1];
267                         }
268                         offset = 1;
269                     }
270
271                     // Render the curve using minimum number of required points in the array 
272                     RenderingObject.DrawCurve(pen, pointsExact, offset, numberOfSegments, tension);
273                 }
274             }
275                 }
276
277                 /// <summary>
278                 /// Draws a rectangle specified by a coordinate pair, a width, and a height.
279                 /// </summary>
280                 /// <param name="pen">Pen object that determines the color, width, and style of the rectangle.</param>
281                 /// <param name="x">x-coordinate of the upper-left corner of the rectangle to draw.</param>
282                 /// <param name="y">y-coordinate of the upper-left corner of the rectangle to draw.</param>
283                 /// <param name="width">Width of the rectangle to draw.</param>
284                 /// <param name="height">Height of the rectangle to draw.</param>
285                 internal void DrawRectangle(
286                         Pen pen,
287                         int x,
288                         int y,
289                         int width,
290                         int height
291                         )
292                 {
293                         RenderingObject.DrawRectangle( pen, x, y, width, height );
294                 }
295
296                 /// <summary>
297                 /// Draws a polygon defined by an array of PointF structures.
298                 /// </summary>
299                 /// <param name="pen">Pen object that determines the color, width, and style of the polygon.</param>
300                 /// <param name="points">Array of PointF structures that represent the vertices of the polygon.</param>
301                 internal void DrawPolygon(
302                         Pen pen,
303                         PointF[] points
304                         )
305                 {
306                         RenderingObject.DrawPolygon( pen, points );
307                 }
308
309                 /// <summary>
310                 /// 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.
311                 /// </summary>
312                 /// <param name="s">String to draw.</param>
313                 /// <param name="font">Font object that defines the text format of the string.</param>
314                 /// <param name="brush">Brush object that determines the color and texture of the drawn text.</param>
315                 /// <param name="layoutRectangle">RectangleF structure that specifies the location of the drawn text.</param>
316                 /// <param name="format">StringFormat object that specifies formatting properties, such as line spacing and alignment, that are applied to the drawn text.</param>
317                 internal void DrawString(
318                         string s,
319                         Font font,
320                         Brush brush,
321                         RectangleF layoutRectangle,
322                         StringFormat format
323                         )
324                 {
325             using (StringFormat fmt = (StringFormat)format.Clone())
326             {
327                 if ( IsRightToLeft )
328                     fmt.FormatFlags |= StringFormatFlags.DirectionRightToLeft;
329                 if (!IsTextClipped && (fmt.FormatFlags & StringFormatFlags.NoClip) != StringFormatFlags.NoClip)
330                     fmt.FormatFlags |= StringFormatFlags.NoClip;
331                 RenderingObject.DrawString(s, font, brush, layoutRectangle, fmt);
332             }
333                 }
334
335                 /// <summary>
336                 /// 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.
337                 /// </summary>
338                 /// <param name="s">String to draw.</param>
339                 /// <param name="font">Font object that defines the text format of the string.</param>
340                 /// <param name="brush">Brush object that determines the color and texture of the drawn text.</param>
341                 /// <param name="point">PointF structure that specifies the upper-left corner of the drawn text.</param>
342                 /// <param name="format">StringFormat object that specifies formatting properties, such as line spacing and alignment, that are applied to the drawn text.</param>
343                 internal void DrawString(
344                         string s,
345                         Font font,
346                         Brush brush,
347                         PointF point,
348                         StringFormat format
349                         )
350                 {
351             if (IsRightToLeft)
352             {
353                 using (StringFormat fmt = (StringFormat)format.Clone())
354                 {
355                     fmt.FormatFlags |= StringFormatFlags.DirectionRightToLeft;
356                     if (fmt.Alignment == StringAlignment.Far)
357                     {
358                         fmt.Alignment = StringAlignment.Near;
359                     }
360                     else if (fmt.Alignment == StringAlignment.Near)
361                     {
362                         fmt.Alignment = StringAlignment.Far;
363                     }
364                     RenderingObject.DrawString(s, font, brush, point, fmt);
365                 }
366             }
367             else 
368                 RenderingObject.DrawString(s, font, brush, point, format);
369                 }
370
371                 /// <summary>
372                 /// Draws the specified portion of the specified Image object at the specified location and with the specified size.
373                 /// </summary>
374                 /// <param name="image">Image object to draw.</param>
375                 /// <param name="destRect">Rectangle structure that specifies the location and size of the drawn image. The image is scaled to fit the rectangle.</param>
376                 /// <param name="srcX">x-coordinate of the upper-left corner of the portion of the source image to draw.</param>
377                 /// <param name="srcY">y-coordinate of the upper-left corner of the portion of the source image to draw.</param>
378                 /// <param name="srcWidth">Width of the portion of the source image to draw.</param>
379                 /// <param name="srcHeight">Height of the portion of the source image to draw.</param>
380                 /// <param name="srcUnit">Member of the GraphicsUnit enumeration that specifies the units of measure used to determine the source rectangle.</param>
381                 /// <param name="imageAttrs">ImageAttributes object that specifies recoloring and gamma information for the image object.</param>
382                 internal void DrawImage(
383             System.Drawing.Image image,
384                         Rectangle destRect,
385                         float srcX,
386                         float srcY,
387                         float srcWidth,
388                         float srcHeight,
389                         GraphicsUnit srcUnit,
390                         ImageAttributes imageAttrs
391                         )
392                 {
393                         RenderingObject.DrawImage( image, destRect, srcX, srcY, srcWidth, srcHeight, srcUnit, imageAttrs );
394                 }
395
396                 /// <summary>
397                 /// Draws a rectangle specified by a coordinate pair, a width, and a height.
398                 /// </summary>
399                 /// <param name="pen">A Pen object that determines the color, width, and style of the rectangle.</param>
400                 /// <param name="x">The x-coordinate of the upper-left corner of the rectangle to draw.</param>
401                 /// <param name="y">The y-coordinate of the upper-left corner of the rectangle to draw.</param>
402                 /// <param name="width">The width of the rectangle to draw.</param>
403                 /// <param name="height">The height of the rectangle to draw.</param>
404                 internal void DrawRectangle(
405                         Pen pen,
406                         float x,
407                         float y,
408                         float width,
409                         float height
410                         )
411                 {
412                         RenderingObject.DrawRectangle( pen, x, y, width, height );
413                 }
414
415                 /// <summary>
416                 /// Draws a GraphicsPath object.
417                 /// </summary>
418                 /// <param name="pen">Pen object that determines the color, width, and style of the path.</param>
419                 /// <param name="path">GraphicsPath object to draw.</param>
420                 internal void DrawPath(
421                         Pen pen,
422                         GraphicsPath path
423                         )
424                 {
425                         // Check if path is empty
426                         if(path == null || 
427                                 path.PointCount == 0)
428                         {
429                                 return;
430                         }
431
432                         RenderingObject.DrawPath( pen, path );
433                 }
434
435                 /// <summary>
436                 /// Draws a pie shape defined by an ellipse specified by a coordinate pair, a width, and a height and two radial lines.
437                 /// </summary>
438                 /// <param name="pen">Pen object that determines the color, width, and style of the pie shape.</param>
439                 /// <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>
440                 /// <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>
441                 /// <param name="width">Width of the bounding rectangle that defines the ellipse from which the pie shape comes.</param>
442                 /// <param name="height">Height of the bounding rectangle that defines the ellipse from which the pie shape comes.</param>
443                 /// <param name="startAngle">Angle measured in degrees clockwise from the x-axis to the first side of the pie shape.</param>
444                 /// <param name="sweepAngle">Angle measured in degrees clockwise from the startAngle parameter to the second side of the pie shape.</param>
445                 internal void DrawPie(
446                         Pen pen,
447                         float x,
448                         float y,
449                         float width,
450                         float height,
451                         float startAngle,
452                         float sweepAngle
453                         )
454                 {
455                         RenderingObject.DrawPie( pen, x, y, width, height, startAngle, sweepAngle );
456                 }
457
458                 /// <summary>
459                 /// Draws an ellipse defined by a bounding RectangleF.
460                 /// </summary>
461                 /// <param name="pen">Pen object that determines the color, width, and style of the ellipse.</param>
462                 /// <param name="rect">RectangleF structure that defines the boundaries of the ellipse.</param>
463                 internal void DrawEllipse(
464                         Pen pen,
465                         RectangleF rect
466                         )
467                 {
468                         RenderingObject.DrawEllipse( pen, rect );
469                 }
470
471                 /// <summary>
472                 /// Draws a series of line segments that connect an array of PointF structures.
473                 /// </summary>
474                 /// <param name="pen">Pen object that determines the color, width, and style of the line segments.</param>
475                 /// <param name="points">Array of PointF structures that represent the points to connect.</param>
476                 internal void DrawLines(
477                         Pen pen,
478                         PointF[] points
479                         )
480                 {
481                         RenderingObject.DrawLines( pen, points );
482                 }
483
484                 #endregion // Drawing Methods
485
486                 #region Filling Methods
487
488                 /// <summary>
489                 /// Fills the interior of an ellipse defined by a bounding rectangle 
490                 /// specified by a RectangleF structure.
491                 /// </summary>
492                 /// <param name="brush">Brush object that determines the characteristics of the fill.</param>
493                 /// <param name="rect">RectangleF structure that represents the bounding rectangle that defines the ellipse.</param>
494                 internal void FillEllipse(
495                         Brush brush,
496                         RectangleF rect
497                         )
498                 {
499                         RenderingObject.FillEllipse( brush, rect );
500                 }
501
502                 /// <summary>
503                 /// Fills the interior of a GraphicsPath object.
504                 /// </summary>
505                 /// <param name="brush">Brush object that determines the characteristics of the fill.</param>
506                 /// <param name="path">GraphicsPath object that represents the path to fill.</param>
507                 internal void FillPath(
508                         Brush brush,
509                         GraphicsPath path
510                         )
511                 {
512                         // Check if path is empty
513                         if(path == null || 
514                                 path.PointCount == 0)
515                         {
516                                 return;
517                         }
518
519                         RenderingObject.FillPath( brush, path );
520                 }
521
522                 /// <summary>
523                 /// Fills the interior of a Region object.
524                 /// </summary>
525                 /// <param name="brush">Brush object that determines the characteristics of the fill.</param>
526                 /// <param name="region">Region object that represents the area to fill.</param>
527                 internal void FillRegion(
528                         Brush brush,
529                         Region region
530                         )
531                 {
532                         RenderingObject.FillRegion( brush, region );
533                 }
534
535                 /// <summary>
536                 /// Fills the interior of a rectangle specified by a RectangleF structure.
537                 /// </summary>
538                 /// <param name="brush">Brush object that determines the characteristics of the fill.</param>
539                 /// <param name="rect">RectangleF structure that represents the rectangle to fill.</param>
540                 internal void FillRectangle(
541                         Brush brush,
542                         RectangleF rect
543                         )
544                 {
545                         RenderingObject.FillRectangle( brush, rect );
546                 }
547
548                 /// <summary>
549                 /// Fills the interior of a rectangle specified by a pair of coordinates, a width, and a height.
550                 /// </summary>
551                 /// <param name="brush">Brush object that determines the characteristics of the fill.</param>
552                 /// <param name="x">x-coordinate of the upper-left corner of the rectangle to fill.</param>
553                 /// <param name="y">y-coordinate of the upper-left corner of the rectangle to fill.</param>
554                 /// <param name="width">Width of the rectangle to fill.</param>
555                 /// <param name="height">Height of the rectangle to fill.</param>
556                 internal void FillRectangle(
557                         Brush brush,
558                         float x,
559                         float y,
560                         float width,
561                         float height
562                         )
563                 {
564                         RenderingObject.FillRectangle( brush, x, y, width, height );
565                 }
566
567                 /// <summary>
568                 /// Fills the interior of a polygon defined by an array of points specified by PointF structures .
569                 /// </summary>
570                 /// <param name="brush">Brush object that determines the characteristics of the fill.</param>
571                 /// <param name="points">Array of PointF structures that represent the vertices of the polygon to fill.</param>
572                 internal void FillPolygon(
573                         Brush brush,
574                         PointF[] points
575                         )
576                 {
577                         RenderingObject.FillPolygon( brush, points );
578                 }
579
580                 /// <summary>
581                 /// Fills the interior of a pie section defined by an ellipse 
582                 /// specified by a pair of coordinates, a width, and a height 
583                 /// and two radial lines.
584                 /// </summary>
585                 /// <param name="brush">Brush object that determines the characteristics of the fill.</param>
586                 /// <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>
587                 /// <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>
588                 /// <param name="width">Width of the bounding rectangle that defines the ellipse from which the pie section comes.</param>
589                 /// <param name="height">Height of the bounding rectangle that defines the ellipse from which the pie section comes.</param>
590                 /// <param name="startAngle">Angle in degrees measured clockwise from the x-axis to the first side of the pie section.</param>
591                 /// <param name="sweepAngle">Angle in degrees measured clockwise from the startAngle parameter to the second side of the pie section.</param>
592                 internal void FillPie(
593                         Brush brush,
594                         float x,
595                         float y,
596                         float width,
597                         float height,
598                         float startAngle,
599                         float sweepAngle
600                         )
601                 {
602                         RenderingObject.FillPie( brush, x, y, width, height, startAngle, sweepAngle );
603                 }
604         
605                 #endregion // Filling Methods
606
607                 #region Other Methods
608
609                 /// <summary>
610                 /// This method starts SVG Selection mode
611                 /// </summary>
612         /// <param name="url">The location of the referenced object, expressed as a URI reference.</param>
613                 /// <param name="title">Title which could be used for tooltips.</param>
614         internal void StartHotRegion( string url, string title )
615                 {
616                         RenderingObject.BeginSelection( url, title );
617                 }
618
619                 /// <summary>
620                 /// This method starts SVG Selection mode
621                 /// </summary>
622                 /// <param name="point">Data Point which properties are used for SVG selection</param>
623         internal void StartHotRegion(DataPoint point)
624                 {
625                         StartHotRegion( point, false );
626                 }
627
628                 /// <summary>
629                 /// This method starts SVG Selection mode
630                 /// </summary>
631                 /// <param name="point">Data Point which properties are used for SVG selection</param>
632                 /// <param name="labelRegion">Indicates if point label region is processed.</param>
633                 internal void StartHotRegion(DataPoint point, bool labelRegion)
634                 {
635                         string hRef = string.Empty;
636                         string tooltip = (labelRegion) ? point.LabelToolTip : point.ToolTip;
637 #if !Microsoft_CONTROL
638                         hRef = (labelRegion) ? point.LabelUrl : point.Url;
639 #endif
640                         if(hRef.Length > 0 || tooltip.Length > 0)
641                         {
642                                 RenderingObject.BeginSelection( 
643                                         point.ReplaceKeywords( hRef ), 
644                                         point.ReplaceKeywords( tooltip ) );
645                         }
646                 }
647
648                 /// <summary>
649                 /// This method stops SVG Selection mode
650                 /// </summary>
651                 internal void EndHotRegion()
652                 {
653                         RenderingObject.EndSelection();
654                 }
655
656                 /// <summary>
657                 /// Measures the specified string when drawn with the specified 
658                 /// Font object and formatted with the specified StringFormat object.
659                 /// </summary>
660                 /// <param name="text">String to measure.</param>
661                 /// <param name="font">Font object defines the text format of the string.</param>
662                 /// <param name="layoutArea">SizeF structure that specifies the maximum layout area for the text.</param>
663                 /// <param name="stringFormat">StringFormat object that represents formatting information, such as line spacing, for the string.</param>
664                 /// <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>
665                 internal SizeF MeasureString(
666                         string text,
667                         Font font,
668                         SizeF layoutArea,
669                         StringFormat stringFormat
670                         )
671                 {
672                         return RenderingObject.MeasureString( text, font, layoutArea, stringFormat );
673                 }
674
675                 /// <summary>
676                 /// Measures the specified string when drawn with the specified 
677                 /// Font object and formatted with the specified StringFormat object.
678                 /// </summary>
679                 /// <param name="text">String to measure.</param>
680                 /// <param name="font">Font object defines the text format of the string.</param>
681                 /// <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>
682                 internal SizeF MeasureString(
683                         string text,
684                         Font font
685                         )
686                 {
687                         return RenderingObject.MeasureString( text, font );
688                 }
689
690                 /// <summary>
691                 /// Saves the current state of this Graphics object and identifies the saved state with a GraphicsState object.
692                 /// </summary>
693                 /// <returns>This method returns a GraphicsState object that represents the saved state of this Graphics object.</returns>
694                 internal GraphicsState Save()
695                 {
696                         return RenderingObject.Save();
697                 }
698
699                 /// <summary>
700                 /// Restores the state of this Graphics object to the state represented by a GraphicsState object.
701                 /// </summary>
702                 /// <param name="gstate">GraphicsState object that represents the state to which to restore this Graphics object.</param>
703                 internal void Restore(
704                         GraphicsState gstate
705                         )
706                 {
707                         RenderingObject.Restore( gstate );
708                 }
709
710         /// <summary>
711                 /// Resets the clip region of this Graphics object to an infinite region.
712                 /// </summary>
713                 internal void ResetClip()
714                 {
715             RenderingObject.ResetClip();
716                 }
717
718                 /// <summary>
719                 /// Sets the clipping region of this Graphics object to the rectangle specified by a RectangleF structure.
720                 /// </summary>
721                 /// <param name="rect">RectangleF structure that represents the new clip region.</param>
722                 internal void SetClipAbs(RectangleF rect)
723                 {
724                         RenderingObject.SetClip( rect );
725                 }
726
727                 /// <summary>
728                 /// Prepends the specified translation to the transformation matrix of this Graphics object.
729                 /// </summary>
730                 /// <param name="dx">x component of the translation.</param>
731                 /// <param name="dy">y component of the translation.</param>
732                 internal void TranslateTransform(
733                         float dx,
734                         float dy
735                         )
736                 {
737                         RenderingObject.TranslateTransform( dx, dy );
738                 }
739
740                 #endregion // Other Methods
741
742                 #region Properties
743
744                 /// <summary>
745                 /// Gets current rendering object.
746                 /// </summary>
747                 internal IChartRenderingEngine RenderingObject
748                 {
749                         get
750                         {
751                 return _gdiGraphics;
752             }
753                 }
754
755                 /// <summary>
756                 /// Gets the active rendering type.
757                 /// </summary>
758                 internal RenderingType ActiveRenderingType
759                 {
760                         get
761                         {
762                                 return _activeRenderingType;
763                         }
764                 }
765
766                 /// <summary>
767                 /// Gets or sets the rendering mode for text associated with this Graphics object.
768                 /// </summary>
769                 internal TextRenderingHint TextRenderingHint 
770                 {
771                         get
772                         {
773                                 return RenderingObject.TextRenderingHint;
774                         }
775                         set
776                         {
777                                 RenderingObject.TextRenderingHint = value;
778                         }
779                 }
780
781                 /// <summary>
782                 /// Gets or sets the world transformation for this Graphics object.
783                 /// </summary>
784                 internal Matrix Transform
785                 {
786                         get
787                         {
788                                 return RenderingObject.Transform;
789                         }
790                         set
791                         {
792                                 RenderingObject.Transform = value;
793                         }
794                 }
795
796                 /// <summary>
797                 /// Gets or sets the rendering quality for this Graphics object.
798                 /// </summary>
799                 internal SmoothingMode SmoothingMode 
800                 {
801                         get
802                         {
803                                 return RenderingObject.SmoothingMode;
804                         }
805                         set
806                         {
807                                 RenderingObject.SmoothingMode = value;
808                         }
809                 }
810
811                 /// <summary>
812                 /// Gets or sets a Region object that limits the drawing region of this Graphics object.
813                 /// </summary>
814                 internal Region Clip 
815                 {
816                         get
817                         {
818                                 return RenderingObject.Clip;
819                         }
820                         set
821                         {
822                                 RenderingObject.Clip = value;
823                         }
824                 }
825
826                 /// <summary>
827                 /// Gets a value indicating whether the clipping region of this Graphics object is empty.
828                 /// </summary>
829                 internal bool IsClipEmpty {
830                         get
831                         {
832                                 return RenderingObject.IsClipEmpty;
833                         }
834                 }
835
836                 /// <summary>
837                 /// Gets or sets the reference to the Graphics object.
838                 /// </summary>
839                 public Graphics Graphics
840                 {
841                         get
842                         {
843                                 return RenderingObject.Graphics;
844                         }
845                         set
846                         {
847                                 RenderingObject.Graphics = value;
848                         }
849                 }
850
851                 #endregion // Properties
852         }
853 }