diff --git a/Document Structure/SvgDocument.cs b/Document Structure/SvgDocument.cs
index 9056f929baa71ac5c6c189eb28bfd376c436a6f3..be1185d9ec82be9cbffda27f48a36f6cd94e10f0 100644
--- a/Document Structure/SvgDocument.cs
+++ b/Document Structure/SvgDocument.cs
@@ -259,11 +259,32 @@ namespace Svg
/// Renders the to the specified .
///
/// The to render the document with.
+ /// The parameter cannot be null.
public void Draw(SvgRenderer renderer)
{
+ if (renderer == null)
+ {
+ throw new ArgumentNullException("renderer");
+ }
+
Render(renderer);
}
+ ///
+ /// Renders the to the specified .
+ ///
+ /// The to be rendered to.
+ /// The parameter cannot be null.
+ public void Draw(Graphics graphics)
+ {
+ if (graphics == null)
+ {
+ throw new ArgumentNullException("graphics");
+ }
+
+ Render(SvgRenderer.FromGraphics(graphics));
+ }
+
///
/// Renders the and returns the image as a .
///
diff --git a/SvgRenderer.cs b/SvgRenderer.cs
index c216e39fd0a7ec83a0266f76760436bfd6b95240..eae2e166554714fa07690707bf89b37f921b6ce4 100644
--- a/SvgRenderer.cs
+++ b/SvgRenderer.cs
@@ -36,6 +36,17 @@ namespace Svg
return renderer;
}
+ ///
+ /// Creates a new from the specified .
+ ///
+ /// The to create the renderer from.
+ public static SvgRenderer FromGraphics(Graphics graphics)
+ {
+ SvgRenderer renderer = new SvgRenderer();
+ renderer._innerGraphics = graphics;
+ return renderer;
+ }
+
public void SetClip(Region region)
{
this._innerGraphics.SetClip(region, CombineMode.Union);