Class SvgGraphics2D

Class SvgGraphics2D

Namespace: Aspose.Imaging.FileFormats.Svg.Graphics
Assembly: Aspose.Imaging.dll (25.7.0)

Provides drawing commmands to compose an Svg image.

public class SvgGraphics2D
    {
        private readonly IDrawingAttributeGroup attributes;
        private readonly IBasicPath currentPath;
        private readonly Stack<IBasicPath> pathStack;
        private readonly Stack<IDrawingAttributeGroup> attributeStack;
        public SvgGraphics2D(IDocument document)
        {
        }
        public void DrawImage(Image image, double x, double y, double width, double height)
        {
        }
        public void DrawPath(IBasicPath path, IDrawingAttributeGroup attribute)
        {
        }
        public void FillPath(IBasicPath path, IDrawingAttributeGroup attribute)
        {
        }
        public IBasicPath CurrentPath
        {
            get => currentPath;
            set
            {
                if (currentPath != null)
                    pathStack.Push(currentPath);
                currentPath = value;
                attributeStack.Clear();
            }
        }
        public IDrawingAttributeGroup Attributes
        {
            get => attributes;
            set
            {
                if (attributeStack.Count > 0)
                    attributes = attributeStack.Pop();
                attributes = value;
            }
        }
    }

Inheritance

object SvgGraphics2D

Inherited Members

object.GetType() , object.MemberwiseClone() , object.ToString() , object.Equals(object?) , object.Equals(object?, object?) , object.ReferenceEquals(object?, object?) , object.GetHashCode()

Constructors

SvgGraphics2D(int, int, int)

Initializes a new instance of the Aspose.Imaging.FileFormats.Svg.Graphics.SvgGraphics2D class.

public SvgGraphics2D(int width, int height, int dpi)
   {
   }

Parameters

width int

The width of the output Svg image.

height int

The width of the output Svg image.

dpi int

The device resolution, e.g. 96 dots per inch.

Examples

This example shows how to create an SVG image of the specified size and rasterize it to PNG.

string dir = "c:\\temp\\";
   int imageWidth = 100;
   int imageHeight = 100;
   int dpi = 96;
   Aspose.Imaging.FileFormats.Svg.Graphics.SvgGraphics2D graphics = new Aspose.Imaging.FileFormats.Svg.Graphics.SvgGraphics2D(imageWidth, imageHeight, dpi);
   Aspose.Imaging.Pen pen = new Aspose.Imaging.Pen(Aspose.Imaging.Color.Yellow, 10);
   Aspose.Imaging.Brushes.SolidBrush brush = new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.Red);
   graphics.FillRectangle(pen, brush, 0, 0, imageWidth, imageHeight);
   using (Aspose.Imaging.FileFormats.Svg.SvgImage svgImage = graphics.EndRecording())
   {
      svgImage.Save(dir + "test.output.svg");
   }

This example shows how to create an SVG image of the specified size and draw different shapes on it using SvgGraphics2D.

string dir = "c:\\temp\\";
   int imageWidth = 600;
   int imageHeight = 400;
   int dpi = 96;
   Aspose.Imaging.FileFormats.Svg.Graphics.SvgGraphics2D graphics = new Aspose.Imaging.FileFormats.Svg.Graphics.SvgGraphics2D(imageWidth, imageHeight, dpi);
   graphics.DrawRectangle(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Black, 1), 0, 0, imageWidth, imageHeight);
   graphics.FillRectangle(new Aspose.Imaging.Pen(Aspose.Imaging.Color.WhiteSmoke, 1), new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.WhiteSmoke), 10, 10, 580, 380);
   graphics.DrawLine(new Aspose.Imaging.Pen(Aspose.Imaging.Color.DarkGreen, 1), 0, 0, imageWidth, imageHeight);
   graphics.DrawLine(new Aspose.Imaging.Pen(Aspose.Imaging.Color.DarkGreen, 1), 0, imageHeight, imageWidth, 0);
   graphics.DrawArc(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Blue, 2), new Aspose.Imaging.Rectangle(0, 0, 200, 200), 90, 270);
   graphics.FillArc(new Aspose.Imaging.Pen(Aspose.Imaging.Color.LightCoral, 10), new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.LightSkyBlue), new Aspose.Imaging.Rectangle(0, 0, 150, 150), 90, 270);
   graphics.DrawCubicBezier(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Red, 2), new Aspose.Imaging.PointF(0, 0), new Aspose.Imaging.PointF(200, 133), new Aspose.Imaging.PointF(400, 166), new Aspose.Imaging.PointF(600, 400));
   using (Aspose.Imaging.RasterImage imageToDraw = (Aspose.Imaging.RasterImage)Aspose.Imaging.Image.Load(dir + "sample.bmp"))
   {
       graphics.DrawImage(imageToDraw, new Aspose.Imaging.Point(400, 200), new Aspose.Imaging.Size(100, 50));
   }
   graphics.DrawString(new Aspose.Imaging.Font("Arial", 48, Aspose.Imaging.FontStyle.Regular), "Hello World!", new Aspose.Imaging.Point(200, 300), Aspose.Imaging.Color.DarkRed);
   Aspose.Imaging.Figure figureToFill = new Aspose.Imaging.Figure();
   figureToFill.IsClosed = true;
   Aspose.Imaging.GraphicsPath pathToFill = new Aspose.Imaging.GraphicsPath();
   pathToFill.AddFigure(figureToFill);
   figureToFill.AddShapes(new Shape[]
   {
       new Aspose.Imaging.Shapes.ArcShape(new Aspose.Imaging.Rectangle(400, 0, 200, 100), 45, 300),
       new Aspose.Imaging.Shapes.BezierShape(
           new Aspose.Imaging.PointF[]
           {
               new Aspose.Imaging.PointF(300, 200),
               new Aspose.Imaging.PointF(400, 200),
               new Aspose.Imaging.PointF(500, 100),
               new Aspose.Imaging.PointF(600, 200),
           }),
       new Aspose.Imaging.Shapes.PolygonShape(
           new Aspose.Imaging.PointF[]
           {
               new Aspose.Imaging.PointF(300, 100),
           }),
       new Aspose.Imaging.Shapes.RectangleShape(new Aspose.Imaging.RectangleF(0, 100, 200, 200)),
   });
   graphics.FillPath(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Green, 2), new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.Yellow), pathToFill);
   Aspose.Imaging.GraphicsPath pathToDraw = new Aspose.Imaging.GraphicsPath();
   Aspose.Imaging.Figure figureToDraw = new Aspose.Imaging.Figure();
   pathToDraw.AddFigure(figureToDraw);
   figureToDraw.AddShapes(new Aspose.Imaging.Shape[]
   {
       new Aspose.Imaging.Shapes.ArcShape(new Aspose.Imaging.RectangleF(200, 200, 200, 200), 0, 360),
   });
   graphics.DrawPath(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Orange, 5), pathToDraw);
   using (Aspose.Imaging.FileFormats.Svg.SvgImage svgImage = graphics.EndRecording())
   {
       svgImage.Save(dir + "test.output.svg");
   }

SvgGraphics2D(SvgImage)

Initializes a new instance of the Aspose.Imaging.FileFormats.Svg.Graphics.SvgGraphics2D class.

public SvgGraphics2D(SvgImage image)
   {
   }
I assumed the closing brace and newline are already in the correct place, so I left them as they were. This code looks like a constructor, which should be followed by an opening curly brace on the same line when using modern C# style guidelines.

Parameters

image SvgImage

The image to perform drawing operations on.

Methods

DrawArc(Pen, Rectangle, float, float)

Draws an arc representing a portion of an ellipse specified by a Rectangle structure.

public void DrawArc(
       Pen pen,
       Rectangle rect,
       float startAngle,
       float arcAngle
   )
   {
   }

Parameters

pen Pen

The pen to draw the outline of the figure.

rect Rectangle

The boundaries of the ellipse.

startAngle float

The angle in degrees measured clockwise from the x-axis to the starting point of the arc.

arcAngle float

The angle in degrees measured clockwise from the startAngle parameter to ending point of the arc.

Examples

This example shows how to create an SVG image of the specified size and draw different shapes on it using SvgGraphics2D.

string dir = "c:\\temp\\";
   int imageWidth = 600;
   int imageHeight = 400;
   int dpi = 96;
   Aspose.Imaging.FileFormats.Svg.Graphics.SvgGraphics2D graphics = new Aspose.Imaging.FileFormats.Svg.Graphics.SvgGraphics2D(imageWidth, imageHeight, dpi);
   graphics.DrawRectangle(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Black, 1), 0, 0, imageWidth, imageHeight);
   graphics.FillRectangle(new Aspose.Imaging.Pen(Aspose.Imaging.Color.WhiteSmoke, 1), new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.WhiteSmoke), 10, 10, 580, 380);
   graphics.DrawLine(new Aspose.Imaging.Pen(Aspose.Imaging.Color.DarkGreen, 1), 0, 0, imageWidth, imageHeight);
   graphics.DrawLine(new Aspose.Imaging.Pen(Aspose.Imaging.Color.DarkGreen, 1), 0, imageHeight, imageWidth, 0);
   graphics.DrawArc(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Blue, 2), new Aspose.Imaging.Rectangle(0, 0, 200, 200), 90, 270);
   graphics.FillArc(new Aspose.Imaging.Pen(Aspose.Imaging.Color.LightCoral, 10), new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.LightSkyBlue), new Aspose.Imaging.Rectangle(0, 0, 150, 150), 90, 270);
   graphics.DrawCubicBezier(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Red, 2),
       new Aspose.Imaging.PointF(0, 0),
       new Aspose.Imaging.PointF(200, 133),
       new Aspose.Imaging.PointF(400, 166),
       new Aspose.Imaging.PointF(600, 400));
   using (Aspose.Imaging.RasterImage imageToDraw = (Aspose.Imaging.RasterImage)Aspose.Imaging.Image.Load(dir + "sample.bmp"))
   {
       graphics.DrawImage(imageToDraw, new Aspose.Imaging.Point(400, 200), new Aspose.Imaging.Size(100, 50));
   }
   graphics.DrawString(new Aspose.Imaging.Font("Arial", 48, Aspose.Imaging.FontStyle.Regular), "Hello World!", new Aspose.Imaging.Point(200, 300), Aspose.Imaging.Color.DarkRed);
   Aspose.Imaging.Figure figureToFill = new Aspose.Imaging.Figure();
   figureToFill.IsClosed = true;
   Aspose.Imaging.GraphicsPath pathToFill = new Aspose.Imaging.GraphicsPath();
   pathToFill.AddFigure(figureToFill);
   figureToFill.AddShapes(new Shape[]
       {
           new Aspose.Imaging.Shapes.ArcShape(new Aspose.Imaging.Rectangle(400, 0, 200, 100), 45, 300),
           new Aspose.Imaging.Shapes.BezierShape(
               new Aspose.Imaging.PointF[]
               {
                   new Aspose.Imaging.PointF(300, 200),
                   new Aspose.Imaging.PointF(400, 200),
                   new Aspose.Imaging.PointF(500, 100),
                   new Aspose.Imaging.PointF(600, 200),
               }),
           new Aspose.Imaging.Shapes.PolygonShape(
               new Aspose.Imaging.PointF[]
               {
                   new Aspose.Imaging.PointF(300, 100),
               }),
           new Aspose.Imaging.Shapes.RectangleShape(new Aspose.Imaging.RectangleF(0, 100, 200, 200)),
       });
   graphics.FillPath(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Green, 2), new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.Yellow), pathToFill);
   Aspose.Imaging.GraphicsPath pathToDraw = new Aspose.Imaging.GraphicsPath();
   Aspose.Imaging.Figure figureToDraw = new Aspose.Imaging.Figure();
   pathToDraw.AddFigure(figureToDraw);
   figureToDraw.AddShapes(new Aspose.Imaging.Shape[]
       {
           new Aspose.Imaging.Shapes.ArcShape(new Aspose.Imaging.RectangleF(200, 200, 200, 200), 0, 360),
       });
   graphics.DrawPath(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Orange, 5), pathToDraw);
   using (Aspose.Imaging.FileFormats.Svg.SvgImage svgImage = graphics.EndRecording())
   {
       svgImage.Save(dir + "test.output.svg");
   }

DrawCubicBezier(Pen, PointF, PointF, PointF, PointF)

Draws the cubic bezier.

public void DrawCubicBezier(
      Pen pen,
      PointF pt1,
      PointF pt2,
      PointF pt3,
      PointF pt4
   )

Parameters

pen Pen

The pen that determines the color, width, and style of the figure.

pt1 PointF

The starting point of the curve.

pt2 PointF

The first control point for the curve.

pt3 PointF

The second control point for the curve.

pt4 PointF

The ending point of the curve.

Examples

This example shows how to create an SVG image of the specified size and draw different shapes on it using SvgGraphics2D.

string dir = "c:\\temp\\";
   int imageWidth = 600;
   int imageHeight = 400;
   int dpi = 96;
   Aspose.Imaging.FileFormats.Svg.Graphics.SvgGraphics2D graphics = new Aspose.Imaging.FileFormats.Svg.Graphics.SvgGraphics2D(imageWidth, imageHeight, dpi);
   graphics.DrawRectangle(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Black, 1), 0, 0, imageWidth, imageHeight);
   graphics.FillRectangle(new Aspose.Imaging.Pen(Aspose.Imaging.Color.WhiteSmoke, 1), new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.WhiteSmoke), 10, 10, 580, 380);
   graphics.DrawLine(new Aspose.Imaging.Pen(Aspose.Imaging.Color.DarkGreen, 1), 0, 0, imageWidth, imageHeight);
   graphics.DrawLine(new Aspose.Imaging.Pen(Aspose.Imaging.Color.DarkGreen, 1), 0, imageHeight, imageWidth, 0);
   graphics.DrawArc(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Blue, 2), new Aspose.Imaging.Rectangle(0, 0, 200, 200), 90, 270);
   graphics.FillArc(new Aspose.Imaging.Pen(Aspose.Imaging.Color.LightCoral, 10), new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.LightSkyBlue), new Aspose.Imaging.Rectangle(0, 0, 150, 150), 90, 270);
   graphics.DrawCubicBezier(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Red, 2),
       new Aspose.Imaging.PointF(0, 0),
       new Aspose.Imaging.PointF(200, 133),
       new Aspose.Imaging.PointF(400, 166),
       new Aspose.Imaging.PointF(600, 400));
   using (Aspose.Imaging.RasterImage imageToDraw = (Aspose.Imaging.RasterImage)Aspose.Imaging.Image.Load(dir + "sample.bmp"))
   {
       graphics.DrawImage(imageToDraw, new Aspose.Imaging.Point(400, 200), new Aspose.Imaging.Size(100, 50));
   }
   graphics.DrawString(new Aspose.Imaging.Font("Arial", 48, Aspose.Imaging.FontStyle.Regular), "Hello World!", new Aspose.Imaging.Point(200, 300), Aspose.Imaging.Color.DarkRed);
   Aspose.Imaging.Figure figureToFill = new Aspose.Imaging.Figure();
   figureToFill.IsClosed = true;
   Aspose.Imaging.GraphicsPath pathToFill = new Aspose.Imaging.GraphicsPath();
   pathToFill.AddFigure(figureToFill);
   figureToFill.AddShapes(new Shape[]
       {
           new Aspose.Imaging.Shapes.ArcShape(new Aspose.Imaging.Rectangle(400, 0, 200, 100), 45, 300),
           new Aspose.Imaging.Shapes.BezierShape(
               new Aspose.Imaging.PointF[]
               {
                   new Aspose.Imaging.PointF(300, 200),
                   new Aspose.Imaging.PointF(400, 200),
                   new Aspose.Imaging.PointF(500, 100),
                   new Aspose.Imaging.PointF(600, 200),
               }),
           new Aspose.Imaging.Shapes.PolygonShape(
               new Aspose.Imaging.PointF[]
               {
                   new Aspose.Imaging.PointF(300, 100),
               }),
           new Aspose.Imaging.Shapes.RectangleShape(new Aspose.Imaging.RectangleF(0, 100, 200, 200)),
       });
   graphics.FillPath(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Green, 2), new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.Yellow), pathToFill);
   Aspose.Imaging.GraphicsPath pathToDraw = new Aspose.Imaging.GraphicsPath();
   Aspose.Imaging.Figure figureToDraw = new Aspose.Imaging.Figure();
   pathToDraw.AddFigure(figureToDraw);
   figureToDraw.AddShapes(new Aspose.Imaging.Shape[]
       {
           new Aspose.Imaging.Shapes.ArcShape(new Aspose.Imaging.RectangleF(200, 200, 200, 200), 0, 360),
       });
   graphics.DrawPath(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Orange, 5), pathToDraw);
   using (Aspose.Imaging.FileFormats.Svg.SvgImage svgImage = graphics.EndRecording())
   {
       svgImage.Save(dir + "test.output.svg");
   }

DrawImage(RasterImage, Point)

Draws the specified image at the specified location.

public void DrawImage(RasterImage image, Point origin)
{
}

Parameters

image RasterImage

The drawn image.

origin Point

The location of the drawn image.

DrawImage(RasterImage, Point, Size)

Draws the specified image of the specified size at the specified location.

public void DrawImage(RasterImage image, Point origin, Size size)
   {
   }

Parameters

image RasterImage

The drawn image.

origin Point

The location of the drawn image.

size Size

The desired size of the drawn image.

Examples

This example shows how to create an SVG image of the specified size and draw different shapes on it using SvgGraphics2D.

string dir = "c:\\temp\\";
   int imageWidth = 600;
   int imageHeight = 400;
   int dpi = 96;
   Aspose.Imaging.FileFormats.Svg.Graphics.SvgGraphics2D graphics = new Aspose.Imaging.FileFormats.Svg.Graphics.SvgGraphics2D(imageWidth, imageHeight, dpi);
   graphics.DrawRectangle(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Black, 1), 0, 0, imageWidth, imageHeight);
   graphics.FillRectangle(new Aspose.Imaging.Pen(Aspose.Imaging.Color.WhiteSmoke, 1), new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.WhiteSmoke), 10, 10, 580, 380);
   graphics.DrawLine(new Aspose.Imaging.Pen(Aspose.Imaging.Color.DarkGreen, 1), 0, 0, imageWidth, imageHeight);
   graphics.DrawLine(new Aspose.Imaging.Pen(Aspose.Imaging.Color.DarkGreen, 1), 0, imageHeight, imageWidth, 0);
   graphics.DrawArc(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Blue, 2), new Aspose.Imaging.Rectangle(0, 0, 200, 200), 90, 270);
   graphics.FillArc(new Aspose.Imaging.Pen(Aspose.Imaging.Color.LightCoral, 10), new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.LightSkyBlue), new Aspose.Imaging.Rectangle(0, 0, 150, 150), 90, 270);
   graphics.DrawCubicBezier(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Red, 2),
       new Aspose.Imaging.PointF(0, 0),
       new Aspose.Imaging.PointF(200, 133),
       new Aspose.Imaging.PointF(400, 166),
       new Aspose.Imaging.PointF(600, 400));
   using (Aspose.Imaging.RasterImage imageToDraw = (Aspose.Imaging.RasterImage)Aspose.Imaging.Image.Load(dir + "sample.bmp"))
   {
       graphics.DrawImage(imageToDraw, new Aspose.Imaging.Point(400, 200), new Aspose.Imaging.Size(100, 50));
   }
   graphics.DrawString(new Aspose.Imaging.Font("Arial", 48, Aspose.Imaging.FontStyle.Regular), "Hello World!", new Aspose.Imaging.Point(200, 300), Aspose.Imaging.Color.DarkRed);
   Aspose.Imaging.Figure figureToFill = new Aspose.Imaging.Figure();
   figureToFill.IsClosed = true;
   Aspose.Imaging.GraphicsPath pathToFill = new Aspose.Imaging.GraphicsPath();
   pathToFill.AddFigure(figureToFill);
   figureToFill.AddShapes(new Shape[]
       {
           new Aspose.Imaging.Shapes.ArcShape(new Aspose.Imaging.Rectangle(400, 0, 200, 100), 45, 300),
           new Aspose.Imaging.Shapes.BezierShape(
               new Aspose.Imaging.PointF[]
               {
                   new Aspose.Imaging.PointF(300, 200),
                   new Aspose.Imaging.PointF(400, 200),
                   new Aspose.Imaging.PointF(500, 100),
                   new Aspose.Imaging.PointF(600, 200),
               }),
           new Aspose.Imaging.Shapes.PolygonShape(
               new Aspose.Imaging.PointF[]
               {
                   new Aspose.Imaging.PointF(300, 100),
               }),
           new Aspose.Imaging.Shapes.RectangleShape(new Aspose.Imaging.RectangleF(0, 100, 200, 200)),
       });
   graphics.FillPath(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Green, 2), new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.Yellow), pathToFill);
   Aspose.Imaging.GraphicsPath pathToDraw = new Aspose.Imaging.GraphicsPath();
   Aspose.Imaging.Figure figureToDraw = new Aspose.Imaging.Figure();
   pathToDraw.AddFigure(figureToDraw);
   figureToDraw.AddShapes(new Aspose.Imaging.Shape[]
       {
           new Aspose.Imaging.Shapes.ArcShape(new Aspose.Imaging.RectangleF(200, 200, 200, 200), 0, 360),
       });
   graphics.DrawPath(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Orange, 5), pathToDraw);
   using (Aspose.Imaging.FileFormats.Svg.SvgImage svgImage = graphics.EndRecording())
   {
       svgImage.Save(dir + "test.output.svg");
   }

DrawImage(Rectangle, Rectangle, RasterImage)

Draws the specified portion of the specified image at the specified location and with the specified size.

public void DrawImage(
       Rectangle srcRect,
       Rectangle destRect,
       RasterImage image)
   {
   }

Parameters

srcRect Rectangle

The portion of the image object to draw.

destRect Rectangle

The location and size of the drawn image. The image is scaled to fit the rectangle.

image RasterImage

The image to draw.

DrawLine(Pen, int, int, int, int)

Draws the line.

public void DrawLine(
      Pen pen,
      int x1,
      int y1,
      int x2,
      int y2
   )
   {
   }

Parameters

pen Pen

The pen that determines the color, width, and style of the figure.

x1 int

The x-coordinate of the first point.

y1 int

The y-coordinate of the first point.

x2 int

The x-coordinate of the second point.

y2 int

The y-coordinate of the second point.

Examples

This example shows how to create an SVG image of the specified size and draw different shapes on it using SvgGraphics2D.

string dir = "c:\\temp\\";
   int imageWidth = 600;
   int imageHeight = 400;
   int dpi = 96;
   Aspose.Imaging.FileFormats.Svg.Graphics.SvgGraphics2D graphics = new Aspose.Imaging.FileFormats.Svg.Graphics.SvgGraphics2D(imageWidth, imageHeight, dpi);
   graphics.DrawRectangle(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Black, 1), 0, 0, imageWidth, imageHeight);
   graphics.FillRectangle(new Aspose.Imaging.Pen(Aspose.Imaging.Color.WhiteSmoke, 1), new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.WhiteSmoke), 10, 10, imageWidth - 20, imageHeight - 20);
   graphics.DrawLine(new Aspose.Imaging.Pen(Aspose.Imaging.Color.DarkGreen, 1), 0, 0, imageWidth, imageHeight);
   graphics.DrawLine(new Aspose.Imaging.Pen(Aspose.Imaging.Color.DarkGreen, 1), 0, imageHeight, imageWidth, 0);
   graphics.DrawArc(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Blue, 2), new Aspose.Imaging.Rectangle(0, 0, 200, 200), 90, 270);
   graphics.FillArc(new Aspose.Imaging.Pen(Aspose.Imaging.Color.LightCoral, 10), new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.LightSkyBlue), new Aspose.Imaging.Rectangle(0, 0, 150, 150), 90, 270);
   graphics.DrawCubicBezier(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Red, 2),
                             new Aspose.Imaging.PointF(0, 0),
                             new Aspose.Imaging.PointF(200, 133),
                             new Aspose.Imaging.PointF(400, 166),
                             new Aspose.Imaging.PointF(600, 400));
   using (Aspose.Imaging.RasterImage imageToDraw = (Aspose.Imaging.RasterImage)Aspose.Imaging.Image.Load(dir + "sample.bmp"))
   {
       graphics.DrawImage(imageToDraw, new Aspose.Imaging.Point(400, 200), new Aspose.Imaging.Size(100, 50));
   }
   graphics.DrawString(new Aspose.Imaging.Font("Arial", 48, Aspose.Imaging.FontStyle.Regular), "Hello World!", new Aspose.Imaging.Point(200, 300), Aspose.Imaging.Color.DarkRed);
   Aspose.Imaging.Figure figureToFill = new Aspose.Imaging.Figure();
   figureToFill.IsClosed = true;
   Aspose.Imaging.GraphicsPath pathToFill = new Aspose.Imaging.GraphicsPath();
   pathToFill.AddFigure(figureToFill);
   figureToFill.AddShapes(new Shape[]
   {
       new Aspose.Imaging.Shapes.ArcShape(new Aspose.Imaging.Rectangle(400, 0, 200, 100), 45, 300),
       new Aspose.Imaging.Shapes.BezierShape(
           new Aspose.Imaging.PointF[]
           {
               new Aspose.Imaging.PointF(300, 200),
               new Aspose.Imaging.PointF(400, 200),
               new Aspose.Imaging.PointF(500, 100),
               new Aspose.Imaging.PointF(600, 200),
           }),
       new Aspose.Imaging.Shapes.PolygonShape(
           new Aspose.Imaging.PointF[]
           {
               new Aspose.Imaging.PointF(300, 100),
           }),
       new Aspose.Imaging.Shapes.RectangleShape(new Aspose.Imaging.RectangleF(0, 100, 200, 200)),
   });
   graphics.FillPath(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Green, 2), new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.Yellow), pathToFill);
   Aspose.Imaging.GraphicsPath pathToDraw = new Aspose.Imaging.GraphicsPath();
   Aspose.Imaging.Figure figureToDraw = new Aspose.Imaging.Figure();
   pathToDraw.AddFigure(figureToDraw);
   figureToDraw.AddShapes(new Aspose.Imaging.Shape[]
   {
       new Aspose.Imaging.Shapes.ArcShape(new Aspose.Imaging.RectangleF(200, 200, 200, 200), 0, 360),
   });
   graphics.DrawPath(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Orange, 5), pathToDraw);
   using (Aspose.Imaging.FileFormats.Svg.SvgImage svgImage = graphics.EndRecording())
   {
       svgImage.Save(dir + "test.output.svg");
   }

DrawPath(Pen, GraphicsPath)

Draws the path.

public void DrawPath(Pen pen, GraphicsPath path)
   {
   }

Parameters

pen Pen

The pen to draw the outline of the figure.

path GraphicsPath

The path to draw.

Examples

This example shows how to create an SVG image of the specified size and draw different shapes on it using SvgGraphics2D.

string dir = "c:\\temp\\";
   int imageWidth = 600;
   int imageHeight = 400;
   int dpi = 96;
   Aspose.Imaging.FileFormats.Svg.Graphics.SvgGraphics2D graphics = new Aspose.Imaging.FileFormats.Svg.Graphics.SvgGraphics2D(imageWidth, imageHeight, dpi);
   graphics.DrawRectangle(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Black, 1), 0, 0, imageWidth, imageHeight);
   graphics.FillRectangle(new Aspose.Imaging.Pen(Aspose.Imaging.Color.WhiteSmoke, 1), new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.WhiteSmoke), 10, 10, 580, 380);
   graphics.DrawLine(new Aspose.Imaging.Pen(Aspose.Imaging.Color.DarkGreen, 1), 0, 0, imageWidth, imageHeight);
   graphics.DrawLine(new Aspose.Imaging.Pen(Aspose.Imaging.Color.DarkGreen, 1), 0, imageHeight, imageWidth, 0);
   graphics.DrawArc(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Blue, 2), new Aspose.Imaging.Rectangle(0, 0, 200, 200), 90, 270);
   graphics.FillArc(new Aspose.Imaging.Pen(Aspose.Imaging.Color.LightCoral, 10), new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.LightSkyBlue), new Aspose.Imaging.Rectangle(0, 0, 150, 150), 90, 270);
   graphics.DrawCubicBezier(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Red, 2),
                            new Aspose.Imaging.PointF(0, 0),
                            new Aspose.Imaging.PointF(200, 133),
                            new Aspose.Imaging.PointF(400, 166),
                            new Aspose.Imaging.PointF(600, 400));
   using (Aspose.Imaging.RasterImage imageToDraw = (Aspose.Imaging.RasterImage)Aspose.Imaging.Image.Load(dir + "sample.bmp"))
   {
       graphics.DrawImage(imageToDraw, new Aspose.Imaging.Point(400, 200), new Aspose.Imaging.Size(100, 50));
   }
   graphics.DrawString(new Aspose.Imaging.Font("Arial", 48, Aspose.Imaging.FontStyle.Regular), "Hello World!", new Aspose.Imaging.Point(200, 300), Aspose.Imaging.Color.DarkRed);
   Aspose.Imaging.Figure figureToFill = new Aspose.Imaging.Figure();
   figureToFill.IsClosed = true;
   Aspose.Imaging.GraphicsPath pathToFill = new Aspose.Imaging.GraphicsPath();
   pathToFill.AddFigure(figureToFill);
   figureToFill.AddShapes(new Shape[]
   {
       new Aspose.Imaging.Shapes.ArcShape(new Aspose.Imaging.Rectangle(400, 0, 200, 100), 45, 300),
       new Aspose.Imaging.Shapes.BezierShape(
           new Aspose.Imaging.PointF[]
           {
               new Aspose.Imaging.PointF(300, 200),
               new Aspose.Imaging.PointF(400, 200),
               new Aspose.Imaging.PointF(500, 100),
               new Aspose.Imaging.PointF(600, 200)
           }),
       new Aspose.Imaging.Shapes.PolygonShape(
           new Aspose.Imaging.PointF[]
           {
               new Aspose.Imaging.PointF(300, 100),
           }),
       new Aspose.Imaging.Shapes.RectangleShape(new Aspose.Imaging.RectangleF(0, 100, 200, 200))
   });
   graphics.FillPath(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Green, 2), new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.Yellow), pathToFill);
   Aspose.Imaging.GraphicsPath pathToDraw = new Aspose.Imaging.GraphicsPath();
   Aspose.Imaging.Figure figureToDraw = new Aspose.Imaging.Figure();
   pathToDraw.AddFigure(figureToDraw);
   figureToDraw.AddShapes(new Aspose.Imaging.Shape[]
   {
       new Aspose.Imaging.Shapes.ArcShape(new Aspose.Imaging.RectangleF(200, 200, 200, 200), 0, 360)
   });
   graphics.DrawPath(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Orange, 5), pathToDraw);
   using (Aspose.Imaging.FileFormats.Svg.SvgImage svgImage = graphics.EndRecording())
   {
       svgImage.Save(dir + "test.output.svg");
   }

DrawRectangle(Pen, int, int, int, int)

Draws the rectangle.

public void DrawRectangle(
       Pen pen,
       int x,
       int y,
       int width,
       int height
   )
   {
   }

Parameters

pen Pen

The pen to draw the outline of the figure.

x int

The x-coordinate of the upper-left corner of the rectangle to draw.

y int

The y-coordinate of the upper-left corner of the rectangle to draw.

width int

The width of the rectangle to draw.

height int

The height of the rectangle to draw.

Examples

This example shows how to create an SVG image of the specified size and draw different shapes on it using SvgGraphics2D.

string dir = "c:\\temp\\";
   int imageWidth = 600;
   int imageHeight = 400;
   int dpi = 96;
   Aspose.Imaging.FileFormats.Svg.Graphics.SvgGraphics2D graphics = new Aspose.Imaging.FileFormats.Svg.Graphics.SvgGraphics2D(imageWidth, imageHeight, dpi);
   graphics.DrawRectangle(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Black, 1), 0, 0, imageWidth, imageHeight);
   graphics.FillRectangle(new Aspose.Imaging.Pen(Aspose.Imaging.Color.WhiteSmoke, 1), new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.WhiteSmoke), 10, 10, 580, 380);
   graphics.DrawLine(new Aspose.Imaging.Pen(Aspose.Imaging.Color.DarkGreen, 1), 0, 0, imageWidth, imageHeight);
   graphics.DrawLine(new Aspose.Imaging.Pen(Aspose.Imaging.Color.DarkGreen, 1), 0, imageHeight, imageWidth, 0);
   graphics.DrawArc(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Blue, 2), new Aspose.Imaging.Rectangle(0, 0, 200, 200), 90, 270);
   graphics.FillArc(new Aspose.Imaging.Pen(Aspose.Imaging.Color.LightCoral, 10), new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.LightSkyBlue), new Aspose.Imaging.Rectangle(0, 0, 150, 150), 90, 270);
   graphics.DrawCubicBezier(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Red, 2),
                             new Aspose.Imaging.PointF(0, 0),
                             new Aspose.Imaging.PointF(200, 133),
                             new Aspose.Imaging.PointF(400, 166),
                             new Aspose.Imaging.PointF(600, 400));
   using (Aspose.Imaging.RasterImage imageToDraw = (Aspose.Imaging.RasterImage)Aspose.Imaging.Image.Load(dir + "sample.bmp"))
   {
       graphics.DrawImage(imageToDraw, new Aspose.Imaging.Point(400, 200), new Aspose.Imaging.Size(100, 50));
   }
   graphics.DrawString(new Aspose.Imaging.Font("Arial", 48, Aspose.Imaging.FontStyle.Regular), "Hello World!", new Aspose.Imaging.Point(200, 300), Aspose.Imaging.Color.DarkRed);
   Aspose.Imaging.Figure figureToFill = new Aspose.Imaging.Figure();
   figureToFill.IsClosed = true;
   Aspose.Imaging.GraphicsPath pathToFill = new Aspose.Imaging.GraphicsPath();
   pathToFill.AddFigure(figureToFill);
   figureToFill.AddShapes(new Shape[]
   {
       new Aspose.Imaging.Shapes.ArcShape(new Aspose.Imaging.Rectangle(400, 0, 200, 100), 45, 300),
       new Aspose.Imaging.Shapes.BezierShape(
           new Aspose.Imaging.PointF[]
           {
               new Aspose.Imaging.PointF(300, 200),
               new Aspose.Imaging.PointF(400, 200),
               new Aspose.Imaging.PointF(500, 100),
               new Aspose.Imaging.PointF(600, 200),
           }),
       new Aspose.Imaging.Shapes.PolygonShape(
           new Aspose.Imaging.PointF[]
           {
               new Aspose.Imaging.PointF(300, 100),
           }),
       new Aspose.Imaging.Shapes.RectangleShape(new Aspose.Imaging.RectangleF(0, 100, 200, 200)),
   });
   graphics.FillPath(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Green, 2), new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.Yellow), pathToFill);
   Aspose.Imaging.GraphicsPath pathToDraw = new Aspose.Imaging.GraphicsPath();
   Aspose.Imaging.Figure figureToDraw = new Aspose.Imaging.Figure();
   pathToDraw.AddFigure(figureToDraw);
   figureToDraw.AddShapes(new Aspose.Imaging.Shape[]
   {
       new Aspose.Imaging.Shapes.ArcShape(new Aspose.Imaging.RectangleF(200, 200, 200, 200), 0, 360),
   });
   graphics.DrawPath(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Orange, 5), pathToDraw);
   using (Aspose.Imaging.FileFormats.Svg.SvgImage svgImage = graphics.EndRecording())
   {
       svgImage.Save(dir + "test.output.svg");
   }

DrawString(Font, string, Point, Color)

Draws the text string.

public void DrawString(
    Font font,
    string text,
    Point origin,
    Color textColor
)
{
}

Parameters

font Font

The font used to render text.

text string

The unicode text string.

origin Point

The top-left corner of the text run.

textColor Color

The text color.

Examples

This example shows how to create an SVG image of the specified size and draw different shapes on it using SvgGraphics2D.

string dir = "c:\\temp\\";
   int imageWidth = 600;
   int imageHeight = 400;
   int dpi = 96;
   Aspose.Imaging.FileFormats.Svg.Graphics.SvgGraphics2D graphics = new Aspose.Imaging.FileFormats.Svg.Graphics.SvgGraphics2D(imageWidth, imageHeight, dpi);
   graphics.DrawRectangle(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Black, 1), 0, 0, imageWidth, imageHeight);
   graphics.FillRectangle(new Aspose.Imaging.Pen(Aspose.Imaging.Color.WhiteSmoke, 1), new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.WhiteSmoke), 10, 10, 580, 380);
   graphics.DrawLine(new Aspose.Imaging.Pen(Aspose.Imaging.Color.DarkGreen, 1), 0, 0, imageWidth, imageHeight);
   graphics.DrawLine(new Aspose.Imaging.Pen(Aspose.Imaging.Color.DarkGreen, 1), 0, imageHeight, imageWidth, 0);
   graphics.DrawArc(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Blue, 2), new Aspose.Imaging.Rectangle(0, 0, 200, 200), 90, 270);
   graphics.FillArc(new Aspose.Imaging.Pen(Aspose.Imaging.Color.LightCoral, 10), new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.LightSkyBlue), new Aspose.Imaging.Rectangle(0, 0, 150, 150), 90, 270);
   graphics.DrawCubicBezier(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Red, 2),
       new Aspose.Imaging.PointF(0, 0),
       new Aspose.Imaging.PointF(200, 133),
       new Aspose.Imaging.PointF(400, 166),
       new Aspose.Imaging.PointF(600, 400));
   using (Aspose.Imaging.RasterImage imageToDraw = (Aspose.Imaging.RasterImage)Aspose.Imaging.Image.Load(dir + "sample.bmp"))
   {
       graphics.DrawImage(imageToDraw, new Aspose.Imaging.Point(400, 200), new Aspose.Imaging.Size(100, 50));
   }
   graphics.DrawString(new Aspose.Imaging.Font("Arial", 48, Aspose.Imaging.FontStyle.Regular), "Hello World!", new Aspose.Imaging.Point(200, 300), Aspose.Imaging.Color.DarkRed);
   Aspose.Imaging.Figure figureToFill = new Aspose.Imaging.Figure();
   figureToFill.IsClosed = true;
   Aspose.Imaging.GraphicsPath pathToFill = new Aspose.Imaging.GraphicsPath();
   pathToFill.AddFigure(figureToFill);
   figureToFill.AddShapes(new Shape[]
       {
           new Aspose.Imaging.Shapes.ArcShape(new Aspose.Imaging.Rectangle(400, 0, 200, 100), 45, 300),
           new Aspose.Imaging.Shapes.BezierShape(
               new Aspose.Imaging.PointF[]
               {
                   new Aspose.Imaging.PointF(300, 200),
                   new Aspose.Imaging.PointF(400, 200),
                   new Aspose.Imaging.PointF(500, 100),
                   new Aspose.Imaging.PointF(600, 200),
               }),
           new Aspose.Imaging.Shapes.PolygonShape(
               new Aspose.Imaging.PointF[]
               {
                   new Aspose.Imaging.PointF(300, 100),
               }),
           new Aspose.Imaging.Shapes.RectangleShape(new Aspose.Imaging.RectangleF(0, 100, 200, 200)),
       });
   graphics.FillPath(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Green, 2), new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.Yellow), pathToFill);
   Aspose.Imaging.GraphicsPath pathToDraw = new Aspose.Imaging.GraphicsPath();
   Aspose.Imaging.Figure figureToDraw = new Aspose.Imaging.Figure();
   pathToDraw.AddFigure(figureToDraw);
   figureToDraw.AddShapes(new Aspose.Imaging.Shape[]
       {
           new Aspose.Imaging.Shapes.ArcShape(new Aspose.Imaging.RectangleF(200, 200, 200, 200), 0, 360),
       });
   graphics.DrawPath(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Orange, 5), pathToDraw);
   using (Aspose.Imaging.FileFormats.Svg.SvgImage svgImage = graphics.EndRecording())
   {
       svgImage.Save(dir + "test.output.svg");
   }

EndRecording()

Gets the final Svg image which includes all drawing commands performed via Aspose.Imaging.FileFormats.Svg.Graphics.SvgGraphics2D object.

public SvgImage EndRecording()
    {
    }
Assuming that there is no existing code inside the `EndRecording` method, I have kept it empty. If there are any existing statements within the method, they will be properly indented and spaced according to standard C# conventions.

Returns

SvgImage

The final Svg image.

Examples

This example shows how to create an SVG image of the specified size and draw different shapes on it using SvgGraphics2D.

string dir = "c:\\temp\\";
   int imageWidth = 600;
   int imageHeight = 400;
   int dpi = 96;
   Aspose.Imaging.FileFormats.Svg.Graphics.SvgGraphics2D graphics = new Aspose.Imaging.FileFormats.Svg.Graphics.SvgGraphics2D(imageWidth, imageHeight, dpi);
   graphics.DrawRectangle(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Black, 1), 0, 0, imageWidth, imageHeight);
   graphics.FillRectangle(new Aspose.Imaging.Pen(Aspose.Imaging.Color.WhiteSmoke, 1), new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.WhiteSmoke), 10, 10, imageWidth - 20, imageHeight - 20);
   graphics.DrawLine(new Aspose.Imaging.Pen(Aspose.Imaging.Color.DarkGreen, 1), 0, 0, imageWidth, imageHeight);
   graphics.DrawLine(new Aspose.Imaging.Pen(Aspose.Imaging.Color.DarkGreen, 1), 0, imageHeight, imageWidth, 0);
   graphics.DrawArc(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Blue, 2), new Aspose.Imaging.Rectangle(0, 0, 200, 200), 90, 270);
   graphics.FillArc(new Aspose.Imaging.Pen(Aspose.Imaging.Color.LightCoral, 10), new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.LightSkyBlue), new Aspose.Imaging.RectangleF(0, 0, 150, 150), 90, 270);
   graphics.DrawCubicBezier(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Red, 2),
                            new Aspose.Imaging.PointF(0, 0),
                            new Aspose.Imaging.PointF(200, 133),
                            new Aspose.Imaging.PointF(400, 166),
                            new Aspose.Imaging.PointF(600, 400));
   using (Aspose.Imaging.RasterImage imageToDraw = (Aspose.Imaging.RasterImage)Aspose.Imaging.Image.Load(dir + "sample.bmp"))
   {
       graphics.DrawImage(imageToDraw, new Aspose.Imaging.Point(400, 200), new Aspose.Imaging.Size(100, 50));
   }
   graphics.DrawString(new Aspose.Imaging.Font("Arial", 48, Aspose.Imaging.FontStyle.Regular), "Hello World!", new Aspose.Imaging.PointF(200, 300), Aspose.Imaging.Color.DarkRed);
   Aspose.Imaging.Figure figureToFill = new Aspose.Imaging.Figure();
   figureToFill.IsClosed = true;
   Aspose.Imaging.GraphicsPath pathToFill = new Aspose.Imaging.GraphicsPath();
   pathToFill.AddFigure(figureToFill);
   figureToFill.AddShapes(new Shape[]
   {
       new Aspose.Imaging.Shapes.ArcShape(new Aspose.Imaging.RectangleF(400, 0, 200, 100), 45, 300),
       new Aspose.Imaging.Shapes.BezierShape(
           new Aspose.Imaging.PointF[]
           {
               new Aspose.Imaging.PointF(300, 200),
               new Aspose.Imaging.PointF(400, 200),
               new Aspose.Imaging.PointF(500, 100),
               new Aspose.Imaging.PointF(600, 200),
           }),
       new Aspose.Imaging.Shapes.PolygonShape(
           new Aspose.Imaging.PointF[]
           {
               new Aspose.Imaging.PointF(300, 100),
           }),
       new Aspose.Imaging.Shapes.RectangleShape(new Aspose.Imaging.RectangleF(0, 100, 200, 200)),
   });
   graphics.FillPath(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Green, 2), new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.Yellow), pathToFill);
   Aspose.Imaging.GraphicsPath pathToDraw = new Aspose.Imaging.GraphicsPath();
   Aspose.Imaging.Figure figureToDraw = new Aspose.Imaging.Figure();
   pathToDraw.AddFigure(figureToDraw);
   figureToDraw.AddShapes(new Aspose.Imaging.Shape[]
   {
       new Aspose.Imaging.Shapes.ArcShape(new Aspose.Imaging.RectangleF(200, 200, 200, 200), 0, 360),
   });
   graphics.DrawPath(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Orange, 5), pathToDraw);
   using (Aspose.Imaging.FileFormats.Svg.SvgImage svgImage = graphics.EndRecording())
   {
       svgImage.Save(dir + "test.output.svg");
   }

FillArc(Pen, Brush, Rectangle, float, float)

Fills an arc representing a portion of an ellipse specified by a Rectangle structure.

public void FillArc(
       Pen pen,
       Brush brush,
       Rectangle rect,
       float startAngle,
       float arcAngle
   )
   {
   }

Parameters

pen Pen

The pen to draw the outline of the figure.

brush Brush

The brush to fill the interior of the figure.

rect Rectangle

The boundaries of the ellipse.

startAngle float

The angle in degrees measured clockwise from the x-axis to the starting point of the arc.

arcAngle float

The angle in degrees measured clockwise from the startAngle parameter to ending point of the arc.

Examples

This example shows how to create an SVG image of the specified size and draw different shapes on it using SvgGraphics2D.

string dir = "c:\\temp\\";
   int imageWidth = 600;
   int imageHeight = 400;
   int dpi = 96;
   Aspose.Imaging.FileFormats.Svg.Graphics.SvgGraphics2D graphics = new Aspose.Imaging.FileFormats.Svg.Graphics.SvgGraphics2D(imageWidth, imageHeight, dpi);
   graphics.DrawRectangle(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Black, 1), 0, 0, imageWidth, imageHeight);
   graphics.FillRectangle(new Aspose.Imaging.Pen(Aspose.Imaging.Color.WhiteSmoke, 1), new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.WhiteSmoke), 10, 10, 580, 380);
   graphics.DrawLine(new Aspose.Imaging.Pen(Aspose.Imaging.Color.DarkGreen, 1), 0, 0, imageWidth, imageHeight);
   graphics.DrawLine(new Aspose.Imaging.Pen(Aspose.Imaging.Color.DarkGreen, 1), 0, imageHeight, imageWidth, 0);
   graphics.DrawArc(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Blue, 2), new Aspose.Imaging.Rectangle(0, 0, 200, 200), 90, 270);
   graphics.FillArc(new Aspose.Imaging.Pen(Aspose.Imaging.Color.LightCoral, 10), new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.LightSkyBlue), new Aspose.Imaging.Rectangle(0, 0, 150, 150), 90, 270);
   graphics.DrawCubicBezier(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Red, 2),
      new Aspose.Imaging.PointF(0, 0),
      new Aspose.Imaging.PointF(200, 133),
      new Aspose.Imaging.PointF(400, 166),
      new Aspose.Imaging.PointF(600, 400));
   using (Aspose.Imaging.RasterImage imageToDraw = (Aspose.Imaging.RasterImage)Aspose.Imaging.Image.Load(dir + "sample.bmp"))
   {
       graphics.DrawImage(imageToDraw, new Aspose.Imaging.Point(400, 200), new Aspose.Imaging.Size(100, 50));
   }
   graphics.DrawString(new Aspose.Imaging.Font("Arial", 48, Aspose.Imaging.FontStyle.Regular), "Hello World!", new Aspose.Imaging.Point(200, 300), Aspose.Imaging.Color.DarkRed);
   Aspose.Imaging.Figure figureToFill = new Aspose.Imaging.Figure();
   figureToFill.IsClosed = true;
   Aspose.Imaging.GraphicsPath pathToFill = new Aspose.Imaging.GraphicsPath();
   pathToFill.AddFigure(figureToFill);
   figureToFill.AddShapes(new Shape[]
       {
           new Aspose.Imaging.Shapes.ArcShape(new Aspose.Imaging.Rectangle(400, 0, 200, 100), 45, 300),
           new Aspose.Imaging.Shapes.BezierShape(
               new Aspose.Imaging.PointF[]
               {
                   new Aspose.Imaging.PointF(300, 200),
                   new Aspose.Imaging.PointF(400, 200),
                   new Aspose.Imaging.PointF(500, 100),
                   new Aspose.Imaging.PointF(600, 200),
               }),
           new Aspose.Imaging.Shapes.PolygonShape(
               new Aspose.Imaging.PointF[]
               {
                   new Aspose.Imaging.PointF(300, 100),
               }),
           new Aspose.Imaging.Shapes.RectangleShape(new Aspose.Imaging.RectangleF(0, 100, 200, 200)),
       });
   graphics.FillPath(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Green, 2), new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.Yellow), pathToFill);
   Aspose.Imaging.GraphicsPath pathToDraw = new Aspose.Imaging.GraphicsPath();
   Aspose.Imaging.Figure figureToDraw = new Aspose.Imaging.Figure();
   pathToDraw.AddFigure(figureToDraw);
   figureToDraw.AddShapes(new Aspose.Imaging.Shape[]
       {
           new Aspose.Imaging.Shapes.ArcShape(new Aspose.Imaging.RectangleF(200, 200, 200, 200), 0, 360),
       });
   graphics.DrawPath(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Orange, 5), pathToDraw);
   using (Aspose.Imaging.FileFormats.Svg.SvgImage svgImage = graphics.EndRecording())
   {
       svgImage.Save(dir + "test.output.svg");
   }

FillPath(Pen, Brush, GraphicsPath)

Fills the path.

public void FillPath(
       Pen pen,
       Brush brush,
       GraphicsPath path
   )
   {
   }

Parameters

pen Pen

The pen to draw the outline of the figure.

brush Brush

The brush to fill the interior of the figure.

path GraphicsPath

The path to draw.

Examples

This example shows how to create an SVG image of the specified size and draw different shapes on it using SvgGraphics2D.

string dir = "c:\\temp\\";
   int imageWidth = 600;
   int imageHeight = 400;
   int dpi = 96;
   Aspose.Imaging.FileFormats.Svg.Graphics.SvgGraphics2D graphics = new Aspose.Imaging.FileFormats.Svg.Graphics.SvgGraphics2D(imageWidth, imageHeight, dpi);
   graphics.DrawRectangle(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Black, 1), 0, 0, imageWidth, imageHeight);
   graphics.FillRectangle(new Aspose.Imaging.Pen(Aspose.Imaging.Color.WhiteSmoke, 1), new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.WhiteSmoke), 10, 10, 580, 380);
   graphics.DrawLine(new Aspose.Imaging.Pen(Aspose.Imaging.Color.DarkGreen, 1), 0, 0, imageWidth, imageHeight);
   graphics.DrawLine(new Aspose.Imaging.Pen(Aspose.Imaging.Color.DarkGreen, 1), 0, imageHeight, imageWidth, 0);
   graphics.DrawArc(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Blue, 2), new Aspose.Imaging.Rectangle(0, 0, 200, 200), 90, 270);
   graphics.FillArc(new Aspose.Imaging.Pen(Aspose.Imaging.Color.LightCoral, 10), new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.LightSkyBlue), new Aspose.Imaging.Rectangle(0, 0, 150, 150), 90, 270);
   graphics.DrawCubicBezier(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Red, 2),
       new Aspose.Imaging.PointF(0, 0),
       new Aspose.Imaging.PointF(200, 133),
       new Aspose.Imaging.PointF(400, 166),
       new Aspose.Imaging.PointF(600, 400));
   using (Aspose.Imaging.RasterImage imageToDraw = (Aspose.Imaging.RasterImage)Aspose.Imaging.Image.Load(dir + "sample.bmp"))
   {
       graphics.DrawImage(imageToDraw, new Aspose.Imaging.Point(400, 200), new Aspose.Imaging.Size(100, 50));
   }
   graphics.DrawString(new Aspose.Imaging.Font("Arial", 48, Aspose.Imaging.FontStyle.Regular), "Hello World!", new Aspose.Imaging.Point(200, 300), Aspose.Imaging.Color.DarkRed);
   Aspose.Imaging.Figure figureToFill = new Aspose.Imaging.Figure();
   figureToFill.IsClosed = true;
   Aspose.Imaging.GraphicsPath pathToFill = new Aspose.Imaging.GraphicsPath();
   pathToFill.AddFigure(figureToFill);
   figureToFill.AddShapes(new Shape[]
   {
       new Aspose.Imaging.Shapes.ArcShape(new Aspose.Imaging.Rectangle(400, 0, 200, 100), 45, 300),
       new Aspose.Imaging.Shapes.BezierShape(
           new Aspose.Imaging.PointF[]
           {
               new Aspose.Imaging.PointF(300, 200),
               new Aspose.Imaging.PointF(400, 200),
               new Aspose.Imaging.PointF(500, 100),
               new Aspose.Imaging.PointF(600, 200)
           }),
       new Aspose.Imaging.Shapes.PolygonShape(
           new Aspose.Imaging.PointF[]
           {
               new Aspose.Imaging.PointF(300, 100),
           }),
       new Aspose.Imaging.Shapes.RectangleShape(new Aspose.Imaging.RectangleF(0, 100, 200, 200)),
   });
   graphics.FillPath(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Green, 2), new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.Yellow), pathToFill);
   Aspose.Imaging.GraphicsPath pathToDraw = new Aspose.Imaging.GraphicsPath();
   Aspose.Imaging.Figure figureToDraw = new Aspose.Imaging.Figure();
   pathToDraw.AddFigure(figureToDraw);
   figureToDraw.AddShapes(new Aspose.Imaging.Shape[]
   {
       new Aspose.Imaging.Shapes.ArcShape(new Aspose.Imaging.RectangleF(200, 200, 200, 200), 0, 360),
   });
   graphics.DrawPath(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Orange, 5), pathToDraw);
   using (Aspose.Imaging.FileFormats.Svg.SvgImage svgImage = graphics.EndRecording())
   {
       svgImage.Save(dir + "test.output.svg");
   }

FillRectangle(Pen, Brush, int, int, int, int)

Fills the rectangle.

public void FillRectangle(
      Pen pen,
      Brush brush,
      int x,
      int y,
      int width,
      int height
   )
   {
   }

Parameters

pen Pen

The pen to draw the outline of the figure.

brush Brush

The brush to fill the interior of the figure.

x int

The x-coordinate of the upper-left corner of the rectangle to draw.

y int

The y-coordinate of the upper-left corner of the rectangle to draw.

width int

The width of the rectangle to draw.

height int

The height of the rectangle to draw.

Examples

This example shows how to create an SVG image of the specified size and draw different shapes on it using SvgGraphics2D.

string dir = "c:\\temp\\";
   int imageWidth = 600;
   int imageHeight = 400;
   int dpi = 96;
   Aspose.Imaging.FileFormats.Svg.Graphics.SvgGraphics2D graphics = new Aspose.Imaging.FileFormats.Svg.Graphics.SvgGraphics2D(imageWidth, imageHeight, dpi);
   graphics.DrawRectangle(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Black, 1), 0, 0, imageWidth, imageHeight);
   graphics.FillRectangle(new Aspose.Imaging.Pen(Aspose.Imaging.Color.WhiteSmoke, 1), new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.WhiteSmoke), 10, 10, 580, 380);
   graphics.DrawLine(new Aspose.Imaging.Pen(Aspose.Imaging.Color.DarkGreen, 1), 0, 0, imageWidth, imageHeight);
   graphics.DrawLine(new Aspose.Imaging.Pen(Aspose.Imaging.Color.DarkGreen, 1), 0, imageHeight, imageWidth, 0);
   graphics.DrawArc(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Blue, 2), new Aspose.Imaging.Rectangle(0, 0, 200, 200), 90, 270);
   graphics.FillArc(new Aspose.Imaging.Pen(Aspose.Imaging.Color.LightCoral, 10), new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.LightSkyBlue), new Aspose.Imaging.Rectangle(0, 0, 150, 150), 90, 270);
   graphics.DrawCubicBezier(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Red, 2),
       new Aspose.Imaging.PointF(0, 0),
       new Aspose.Imaging.PointF(200, 133),
       new Aspose.Imaging.PointF(400, 166),
       new Aspose.Imaging.PointF(600, 400));
   using (Aspose.Imaging.RasterImage imageToDraw = (Aspose.Imaging.RasterImage)Aspose.Imaging.Image.Load(dir + "sample.bmp"))
   {
       graphics.DrawImage(imageToDraw, new Aspose.Imaging.Point(400, 200), new Aspose.Imaging.Size(100, 50));
   }
   graphics.DrawString(new Aspose.Imaging.Font("Arial", 48, Aspose.Imaging.FontStyle.Regular), "Hello World!", new Aspose.Imaging.Point(200, 300), Aspose.Imaging.Color.DarkRed);
   Aspose.Imaging.Figure figureToFill = new Aspose.Imaging.Figure();
   figureToFill.IsClosed = true;
   Aspose.Imaging.GraphicsPath pathToFill = new Aspose.Imaging.GraphicsPath();
   pathToFill.AddFigure(figureToFill);
   figureToFill.AddShapes(new Shape[]
       {
           new Aspose.Imaging.Shapes.ArcShape(new Aspose.Imaging.Rectangle(400, 0, 200, 100), 45, 300),
           new Aspose.Imaging.Shapes.BezierShape(
               new Aspose.Imaging.PointF[]
               {
                   new Aspose.Imaging.PointF(300, 200),
                   new Aspose.Imaging.PointF(400, 200),
                   new Aspose.Imaging.PointF(500, 100),
                   new Aspose.Imaging.PointF(600, 200),
               }),
           new Aspose.Imaging.Shapes.PolygonShape(
               new Aspose.Imaging.PointF[]
               {
                   new Aspose.Imaging.PointF(300, 100),
               }),
           new Aspose.Imaging.Shapes.RectangleShape(new Aspose.Imaging.RectangleF(0, 100, 200, 200)),
       });
   graphics.FillPath(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Green, 2), new Aspose.Imaging.Brushes.SolidBrush(Aspose.Imaging.Color.Yellow), pathToFill);
   Aspose.Imaging.GraphicsPath pathToDraw = new Aspose.Imaging.GraphicsPath();
   Aspose.Imaging.Figure figureToDraw = new Aspose.Imaging.Figure();
   pathToDraw.AddFigure(figureToDraw);
   figureToDraw.AddShapes(new Aspose.Imaging.Shape[]
       {
           new Aspose.Imaging.Shapes.ArcShape(new Aspose.Imaging.RectangleF(200, 200, 200, 200), 0, 360),
       });
   graphics.DrawPath(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Orange, 5), pathToDraw);
   using (Aspose.Imaging.FileFormats.Svg.SvgImage svgImage = graphics.EndRecording())
   {
       svgImage.Save(dir + "test.output.svg");
   }
 English