//-------------------------------------------------------------
//
// Copyright © Microsoft Corporation. All Rights Reserved.
//
//-------------------------------------------------------------
// @owner=alexgor, deliant
//=================================================================
// File: IChartRenderingEngine.cs
//
// Namespace: DataVisualization.Charting
//
// Classes: IChartRenderingEngine, IChartAnimationEngine
//
// Purpose: Defines interfaces which must be implemented by
// every rendering and animation engine class. These
// interfaces are used in GDI+, SVG and Flash rendering.
// Note that animation is only available in SVG and
// Flash rendering engines.
//
// Reviwed: AG - Jul 15, 2003
// AG - MArch 14, 2007
//
//===================================================================
#region Used namespaces
using System;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Text;
using System.Drawing.Imaging;
using System.ComponentModel;
using System.Collections;
#endregion
#if WINFORMS_CONTROL
namespace System.Windows.Forms.DataVisualization.Charting
#else
namespace System.Web.UI.DataVisualization.Charting
#endif
{
///
/// IChartRenderingEngine interface defines a set of methods and properties
/// which must be implemented by any chart rendering engine. It contains
/// methods for drawing basic shapes.
///
internal interface IChartRenderingEngine
{
#region Drawing Methods
///
/// Draws a line connecting two PointF structures.
///
/// Pen object that determines the color, width, and style of the line.
/// PointF structure that represents the first point to connect.
/// PointF structure that represents the second point to connect.
void DrawLine(
Pen pen,
PointF pt1,
PointF pt2
);
///
/// Draws a line connecting the two points specified by coordinate pairs.
///
/// Pen object that determines the color, width, and style of the line.
/// x-coordinate of the first point.
/// y-coordinate of the first point.
/// x-coordinate of the second point.
/// y-coordinate of the second point.
void DrawLine(
Pen pen,
float x1,
float y1,
float x2,
float y2
);
///
/// Draws the specified portion of the specified Image object at the specified location and with the specified size.
///
/// Image object to draw.
/// Rectangle structure that specifies the location and size of the drawn image. The image is scaled to fit the rectangle.
/// x-coordinate of the upper-left corner of the portion of the source image to draw.
/// y-coordinate of the upper-left corner of the portion of the source image to draw.
/// Width of the portion of the source image to draw.
/// Height of the portion of the source image to draw.
/// Member of the GraphicsUnit enumeration that specifies the units of measure used to determine the source rectangle.
/// ImageAttributes object that specifies recoloring and gamma information for the image object.
void DrawImage(
System.Drawing.Image image,
Rectangle destRect,
int srcX,
int srcY,
int srcWidth,
int srcHeight,
GraphicsUnit srcUnit,
ImageAttributes imageAttr
);
///
/// Draws an ellipse defined by a bounding rectangle specified by
/// a pair of coordinates, a height, and a width.
///
/// Pen object that determines the color, width, and style of the ellipse.
/// x-coordinate of the upper-left corner of the bounding rectangle that defines the ellipse.
/// y-coordinate of the upper-left corner of the bounding rectangle that defines the ellipse.
/// Width of the bounding rectangle that defines the ellipse.
/// Height of the bounding rectangle that defines the ellipse.
void DrawEllipse(
Pen pen,
float x,
float y,
float width,
float height
);
///
/// Draws a cardinal spline through a specified array of PointF structures
/// using a specified tension. The drawing begins offset from
/// the beginning of the array.
///
/// Pen object that determines the color, width, and height of the curve.
/// Array of PointF structures that define the spline.
/// Offset from the first element in the array of the points parameter to the starting point in the curve.
/// Number of segments after the starting point to include in the curve.
/// Value greater than or equal to 0.0F that specifies the tension of the curve.
void DrawCurve(
Pen pen,
PointF[] points,
int offset,
int numberOfSegments,
float tension
);
///
/// Draws a rectangle specified by a coordinate pair, a width, and a height.
///
/// Pen object that determines the color, width, and style of the rectangle.
/// x-coordinate of the upper-left corner of the rectangle to draw.
/// y-coordinate of the upper-left corner of the rectangle to draw.
/// Width of the rectangle to draw.
/// Height of the rectangle to draw.
void DrawRectangle(
Pen pen,
int x,
int y,
int width,
int height
);
///
/// Draws a polygon defined by an array of PointF structures.
///
/// Pen object that determines the color, width, and style of the polygon.
/// Array of PointF structures that represent the vertices of the polygon.
void DrawPolygon(
Pen pen,
PointF[] points
);
///
/// 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.
///
/// String to draw.
/// Font object that defines the text format of the string.
/// Brush object that determines the color and texture of the drawn text.
/// RectangleF structure that specifies the location of the drawn text.
/// StringFormat object that specifies formatting properties, such as line spacing and alignment, that are applied to the drawn text.
void DrawString(
string s,
Font font,
Brush brush,
RectangleF layoutRectangle,
StringFormat format
);
///
/// 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.
///
/// String to draw.
/// Font object that defines the text format of the string.
/// Brush object that determines the color and texture of the drawn text.
/// PointF structure that specifies the upper-left corner of the drawn text.
/// StringFormat object that specifies formatting properties, such as line spacing and alignment, that are applied to the drawn text.
void DrawString(
string s,
Font font,
Brush brush,
PointF point,
StringFormat format
);
///
/// Draws the specified portion of the specified Image object at the specified location and with the specified size.
///
/// Image object to draw.
/// Rectangle structure that specifies the location and size of the drawn image. The image is scaled to fit the rectangle.
/// x-coordinate of the upper-left corner of the portion of the source image to draw.
/// y-coordinate of the upper-left corner of the portion of the source image to draw.
/// Width of the portion of the source image to draw.
/// Height of the portion of the source image to draw.
/// Member of the GraphicsUnit enumeration that specifies the units of measure used to determine the source rectangle.
/// ImageAttributes object that specifies recoloring and gamma information for the image object.
void DrawImage(
System.Drawing.Image image,
Rectangle destRect,
float srcX,
float srcY,
float srcWidth,
float srcHeight,
GraphicsUnit srcUnit,
ImageAttributes imageAttrs
);
///
/// Draws a rectangle specified by a coordinate pair, a width, and a height.
///
/// A Pen object that determines the color, width, and style of the rectangle.
/// The x-coordinate of the upper-left corner of the rectangle to draw.
/// The y-coordinate of the upper-left corner of the rectangle to draw.
/// The width of the rectangle to draw.
/// The height of the rectangle to draw.
void DrawRectangle(
Pen pen,
float x,
float y,
float width,
float height
);
///
/// Draws a GraphicsPath object.
///
/// Pen object that determines the color, width, and style of the path.
/// GraphicsPath object to draw.
void DrawPath(
Pen pen,
GraphicsPath path
);
///
/// Draws a pie shape defined by an ellipse specified by a coordinate pair, a width, and a height and two radial lines.
///
/// Pen object that determines the color, width, and style of the pie shape.
/// x-coordinate of the upper-left corner of the bounding rectangle that defines the ellipse from which the pie shape comes.
/// y-coordinate of the upper-left corner of the bounding rectangle that defines the ellipse from which the pie shape comes.
/// Width of the bounding rectangle that defines the ellipse from which the pie shape comes.
/// Height of the bounding rectangle that defines the ellipse from which the pie shape comes.
/// Angle measured in degrees clockwise from the x-axis to the first side of the pie shape.
/// Angle measured in degrees clockwise from the startAngle parameter to the second side of the pie shape.
void DrawPie(
Pen pen,
float x,
float y,
float width,
float height,
float startAngle,
float sweepAngle
);
///
/// Draws an arc representing a portion of an ellipse specified by a pair of coordinates, a width, and a height.
///
/// Pen object that determines the color, width, and style of the arc.
/// x-coordinate of the upper-left corner of the rectangle that defines the ellipse.
/// y-coordinate of the upper-left corner of the rectangle that defines the ellipse.
/// Width of the rectangle that defines the ellipse.
/// Height of the rectangle that defines the ellipse.
/// Angle in degrees measured clockwise from the x-axis to the starting point of the arc.
/// Angle in degrees measured clockwise from the startAngle parameter to ending point of the arc.
void DrawArc(
Pen pen,
float x,
float y,
float width,
float height,
float startAngle,
float sweepAngle
);
///
/// Draws the specified Image object at the specified location and with the specified size.
///
/// Image object to draw.
/// RectangleF structure that specifies the location and size of the drawn image.
void DrawImage(
System.Drawing.Image image,
RectangleF rect
);
///
/// Draws an ellipse defined by a bounding RectangleF.
///
/// Pen object that determines the color, width, and style of the ellipse.
/// RectangleF structure that defines the boundaries of the ellipse.
void DrawEllipse(
Pen pen,
RectangleF rect
);
///
/// Draws a series of line segments that connect an array of PointF structures.
///
/// Pen object that determines the color, width, and style of the line segments.
/// Array of PointF structures that represent the points to connect.
void DrawLines(
Pen pen,
PointF[] points
);
#endregion // Drawing Methods
#region Filling Methods
///
/// Fills the interior of an ellipse defined by a bounding rectangle
/// specified by a RectangleF structure.
///
/// Brush object that determines the characteristics of the fill.
/// RectangleF structure that represents the bounding rectangle that defines the ellipse.
void FillEllipse(
Brush brush,
RectangleF rect
);
///
/// Fills the interior of a GraphicsPath object.
///
/// Brush object that determines the characteristics of the fill.
/// GraphicsPath object that represents the path to fill.
void FillPath(
Brush brush,
GraphicsPath path
);
///
/// Fills the interior of a Region object.
///
/// Brush object that determines the characteristics of the fill.
/// Region object that represents the area to fill.
void FillRegion(
Brush brush,
Region region
);
///
/// Fills the interior of a rectangle specified by a RectangleF structure.
///
/// Brush object that determines the characteristics of the fill.
/// RectangleF structure that represents the rectangle to fill.
void FillRectangle(
Brush brush,
RectangleF rect
);
///
/// Fills the interior of a rectangle specified by a pair of coordinates, a width, and a height.
///
/// Brush object that determines the characteristics of the fill.
/// x-coordinate of the upper-left corner of the rectangle to fill.
/// y-coordinate of the upper-left corner of the rectangle to fill.
/// Width of the rectangle to fill.
/// Height of the rectangle to fill.
void FillRectangle(
Brush brush,
float x,
float y,
float width,
float height
);
///
/// Fills the interior of a polygon defined by an array of points specified by PointF structures .
///
/// Brush object that determines the characteristics of the fill.
/// Array of PointF structures that represent the vertices of the polygon to fill.
void FillPolygon(
Brush brush,
PointF[] points
);
///
/// Fills the interior of a pie section defined by an ellipse
/// specified by a pair of coordinates, a width, and a height
/// and two radial lines.
///
/// Brush object that determines the characteristics of the fill.
/// x-coordinate of the upper-left corner of the bounding rectangle that defines the ellipse from which the pie section comes.
/// y-coordinate of the upper-left corner of the bounding rectangle that defines the ellipse from which the pie section comes.
/// Width of the bounding rectangle that defines the ellipse from which the pie section comes.
/// Height of the bounding rectangle that defines the ellipse from which the pie section comes.
/// Angle in degrees measured clockwise from the x-axis to the first side of the pie section.
/// Angle in degrees measured clockwise from the startAngle parameter to the second side of the pie section.
void FillPie(
Brush brush,
float x,
float y,
float width,
float height,
float startAngle,
float sweepAngle
);
#endregion // Filling Methods
#region Other Methods
///
/// Measures the specified string when drawn with the specified
/// Font object and formatted with the specified StringFormat object.
///
/// String to measure.
/// Font object defines the text format of the string.
/// SizeF structure that specifies the maximum layout area for the text.
/// StringFormat object that represents formatting information, such as line spacing, for the string.
/// 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.
SizeF MeasureString(
string text,
Font font,
SizeF layoutArea,
StringFormat stringFormat
);
///
/// Measures the specified string when drawn with the specified
/// Font object and formatted with the specified StringFormat object.
///
/// String to measure.
/// Font object defines the text format of the string.
/// 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.
SizeF MeasureString(
string text,
Font font
);
///
/// Saves the current state of this Graphics object and identifies the saved state with a GraphicsState object.
///
/// This method returns a GraphicsState object that represents the saved state of this Graphics object.
GraphicsState Save();
///
/// Restores the saved state of graphics object.
///
/// State to restore.
void Restore(
GraphicsState gstate
);
///
/// Resets the clip region of this Graphics object to an infinite region.
///
void ResetClip();
///
/// Sets the clipping region of this Graphics object to the rectangle specified by a RectangleF structure.
///
/// RectangleF structure that represents the new clip region.
void SetClip(
RectangleF rect
);
///
/// Sets the clipping region of this Graphics object to the result of the
/// specified operation combining the current clip region and the
/// specified GraphicsPath object.
///
/// GraphicsPath object to combine.
/// Member of the CombineMode enumeration that specifies the combining operation to use.
void SetClip(
GraphicsPath path,
CombineMode combineMode
);
///
/// Prepends the specified translation to the transformation matrix of this Graphics object.
///
/// x component of the translation.
/// y component of the translation.
void TranslateTransform(
float dx,
float dy
);
///
/// This method starts Selection mode
///
/// The location of the referenced object, expressed as a URI reference.
/// Title which could be used for tooltips.
void BeginSelection( string hRef, string title );
///
/// This method stops Selection mode
///
void EndSelection( );
#endregion // Other Methods
#region Properties
///
/// Gets or sets the world transformation for this Graphics object.
///
Matrix Transform {get; set;}
///
/// Gets or sets the rendering quality for this Graphics object.
///
SmoothingMode SmoothingMode {get; set;}
///
/// Gets or sets the rendering mode for text associated with this Graphics object.
///
TextRenderingHint TextRenderingHint {get; set;}
///
/// Gets or sets a Region object that limits the drawing region of this Graphics object.
///
Region Clip {get; set;}
///
/// Reference to the Graphics object
///
Graphics Graphics {get; set;}
///
/// Gets a value indicating whether the clipping region of this Graphics object is empty.
///
bool IsClipEmpty {get;}
#endregion // Properties
}
}