using System; using System.Collections.Generic; using System.Text; using System.Drawing; using System.ComponentModel; namespace Svg { /// /// Represents a colour stop in a gradient. /// [SvgElement("stop")] public class SvgGradientStop : SvgElement { private SvgUnit _offset; private Color _colour; private float _opacity; /// /// Gets or sets the offset, i.e. where the stop begins from the beginning, of the gradient stop. /// [SvgAttribute("offset")] public SvgUnit Offset { get { return this._offset; } set { this._offset = value.ToPercentage(); } } /// /// Gets or sets the colour of the gradient stop. /// [SvgAttribute("stop-color")] [TypeConverter(typeof(SvgColourConverter))] public Color Colour { get { return this._colour; } set { this._colour = value; } } /// /// Gets or sets the opacity of the gradient stop (0-1). /// [SvgAttribute("stop-opacity")] public float Opacity { get { return this._opacity; } set { this._opacity = value; } } /// /// Initializes a new instance of the class. /// public SvgGradientStop() { this._offset = new SvgUnit(0.0f); this._colour = Color.Transparent; this._opacity = 1.0f; } /// /// Initializes a new instance of the class. /// /// The offset. /// The colour. public SvgGradientStop(SvgUnit offset, Color colour) { this._offset = offset; this._colour = colour; this._opacity = 1.0f; } public override SvgElement DeepCopy() { return DeepCopy(); } public override SvgElement DeepCopy() { var newObj = base.DeepCopy() as SvgGradientStop; newObj.Offset = this.Offset; newObj.Colour = this.Colour; newObj.Opacity = this.Opacity; return newObj; } } }