using System;
using System.Drawing;
using System.Drawing.Drawing2D;
using Svg.Transforms;
namespace Svg
{
///
/// Represents and SVG image
///
[SvgElement("image")]
public class SvgImage : SvgVisualElement
{
///
/// Initializes a new instance of the class.
///
public SvgImage()
{
Width = new SvgUnit(0.0f);
Height = new SvgUnit(0.0f);
}
///
/// Gets an representing the top left point of the rectangle.
///
public SvgPoint Location
{
get { return new SvgPoint(X, Y); }
}
[SvgAttribute("x")]
public virtual SvgUnit X
{
get { return this.Attributes.GetAttribute("x"); }
set { this.Attributes["x"] = value; }
}
[SvgAttribute("y")]
public virtual SvgUnit Y
{
get { return this.Attributes.GetAttribute("y"); }
set { this.Attributes["y"] = value; }
}
[SvgAttribute("width")]
public virtual SvgUnit Width
{
get { return this.Attributes.GetAttribute("width"); }
set { this.Attributes["width"] = value; }
}
[SvgAttribute("height")]
public virtual SvgUnit Height
{
get { return this.Attributes.GetAttribute("height"); }
set { this.Attributes["height"] = value; }
}
[SvgAttribute("href", SvgAttributeAttribute.XLinkNamespace)]
public virtual Uri Href
{
get { return this.Attributes.GetAttribute("href"); }
set { this.Attributes["href"] = value; }
}
///
/// Gets the bounds of the element.
///
/// The bounds.
public override RectangleF Bounds
{
get { return new RectangleF(this.Location.ToDeviceValue(), new SizeF(this.Width, this.Height)); }
}
///
/// Gets the for this element.
///
public override GraphicsPath Path
{
get
{
return null;
}
protected set
{
}
}
///
/// Renders the and contents to the specified object.
///
protected override void Render(SvgRenderer renderer)
{
if (Width.Value > 0.0f && Height.Value > 0.0f)
{
//TODO:
//base.Render(renderer);
}
}
public override SvgElement DeepCopy()
{
return DeepCopy();
}
public override SvgElement DeepCopy()
{
var newObj = base.DeepCopy() as SvgImage;
newObj.Height = this.Height;
newObj.Width = this.Width;
newObj.X = this.X;
newObj.Y = this.Y;
newObj.Href = this.Href;
return newObj;
}
}
}