using System; using System.Collections.Generic; using System.Text; using System.Drawing; using System.Drawing.Drawing2D; using System.Xml.Serialization; using System.Xml; using System.Diagnostics; using Svg.Pathing; using Svg.Transforms; namespace Svg { /// /// Represents an SVG path element. /// [SvgElement("path")] public class SvgPath : SvgVisualElement { private SvgPathSegmentList _pathData; private GraphicsPath _path; private int _pathLength; /// /// Gets or sets a of path data. /// [SvgAttribute("d")] public SvgPathSegmentList PathData { get { return this._pathData; } set { this._pathData = value; this._pathData._owner = this; this.IsPathDirty = true; } } /// /// Gets or sets the length of the path. /// [SvgAttribute("pathLength")] public int PathLength { get { return this._pathLength; } set { this._pathLength = value; } } /// /// Gets the for this element. /// public override GraphicsPath Path { get { if (this._path == null || this.IsPathDirty) { _path = new GraphicsPath(); foreach (SvgPathSegment segment in this.PathData) { segment.AddToPath(_path); } this.IsPathDirty = false; } return _path; } } internal void OnPathUpdated() { this.IsPathDirty = true; } /// /// Gets or sets a value to determine if anti-aliasing should occur when the element is being rendered. /// protected override bool RequiresSmoothRendering { get { return true; } } /// /// Gets the bounds of the element. /// /// The bounds. public override System.Drawing.RectangleF Bounds { get { return this.Path.GetBounds(); } } /// /// Initializes a new instance of the class. /// public SvgPath() { this._pathData = new SvgPathSegmentList(); this._pathData._owner = this; } } }