Commit b12621e2 authored by davescriven's avatar davescriven
Browse files

- Fixed #6184: Transforms are parsed but ignored

   The fragments were behaving as the "root" of a document instead of potentially being anywhere.
parent 27a276d9
......@@ -65,33 +65,21 @@ namespace Svg
}
/// <summary>
/// Renders the <see cref="SvgElement"/> and contents to the specified <see cref="Graphics"/> object.
/// Pushes the transforms.
/// </summary>
/// <param name="graphics">The <see cref="Graphics"/> object to render to.</param>
protected override void Render(Graphics graphics)
/// <param name="graphics">The graphics.</param>
protected internal override void PushTransforms(Graphics graphics)
{
Matrix oldTransform = null;
base.PushTransforms(graphics);
if (!this.ViewBox.Equals(SvgViewBox.Empty))
{
oldTransform = graphics.Transform;
Matrix viewBoxTransform = new Matrix();
if (this.ViewBox.MinX > 0 || this.ViewBox.MinY > 0)
{
viewBoxTransform.Translate(this.ViewBox.MinX, this.ViewBox.MinY, MatrixOrder.Append);
graphics.TranslateTransform(this.ViewBox.MinX, this.ViewBox.MinY, MatrixOrder.Append);
}
viewBoxTransform.Scale(this.Width.ToDeviceValue()/this.ViewBox.Width, this.Height.ToDeviceValue()/this.ViewBox.Height);
graphics.Transform = viewBoxTransform;
}
base.Render(graphics);
if (oldTransform != null)
{
graphics.Transform = oldTransform;
graphics.ScaleTransform(this.Width.ToDeviceValue() / this.ViewBox.Width, this.Height.ToDeviceValue() / this.ViewBox.Height, MatrixOrder.Append);
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment