/// <summary>
/// Renders the <see cref="SvgElement"/> and contents to the specified <see cref="Graphics"/> object.
/// </summary>
protected override void Render(SvgRenderer renderer)
{
if (!Visible || !Displayable)
{
return;
}
if (Width.Value > 0.0f && Height.Value > 0.0f && this.Href != null)
{
using (Image b = GetImage(this.Href))
{
if (b != null)
{
this.PushTransforms(renderer);
this.SetClip(renderer);
RectangleF srcRect = new RectangleF(0, 0, b.Width, b.Height);
var destRect = new RectangleF(this.Location.ToDeviceValue(),
new SizeF(Width.ToDeviceValue(), Height.ToDeviceValue()));
renderer.DrawImage(b, destRect, srcRect, GraphicsUnit.Pixel);
this.ResetClip(renderer);
this.PopTransforms(renderer);
}
}
// TODO: cache images... will need a shared context for this
// TODO: support preserveAspectRatio, etc
}
}