GraphicsPath Class
Represents a series of connected lines and curves. This class cannot be inherited.
Inheritance Hierarchy

Namespace: Aspose.Imaging
Assembly: Aspose.Imaging (in Aspose.Imaging.dll) Version: 19.9
Syntax
[SerializableAttribute]
public sealed class GraphicsPath : ObjectWithBounds

The GraphicsPath type exposes the following members.

Constructors
Properties
  NameDescription
Public propertyBounds
Gets or sets the object's bounds.
(Overrides ObjectWithBoundsBounds.)
Public propertyFigures
Gets the path figures.
Public propertyFillMode
Gets or sets a FillMode enumeration that determines how the interiors of shapes in this GraphicsPath are filled.
Methods
  NameDescription
Public methodCode exampleAddFigure
Adds a new figure.
Public methodCode exampleAddFigures
Adds new figures.
Public methodAddPath(GraphicsPath)
Appends the specified GraphicsPath to this path.
Public methodAddPath(GraphicsPath, Boolean)
Appends the specified GraphicsPath to this path.
Public methodDeepClone
Performs a deep clone of this graphics path.
Public methodEquals
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
Public methodFlatten
Converts each curve in this path into a sequence of connected line segments.
Public methodFlatten(Matrix)
Applies the specified transform and then converts each curve in this GraphicsPath into a sequence of connected line segments.
Public methodFlatten(Matrix, Single)
Converts each curve in this GraphicsPath into a sequence of connected line segments.
Public methodGetBounds(Matrix)
Gets the object's bounds.
(Overrides ObjectWithBoundsGetBounds(Matrix).)
Public methodGetBounds(Matrix, Pen)
Gets the object's bounds.
(Overrides ObjectWithBoundsGetBounds(Matrix, Pen).)
Public methodGetHashCode
Serves as a hash function for a particular type.
(Inherited from Object.)
Public methodGetType
Gets the type of the current instance.
(Inherited from Object.)
Public methodIsOutlineVisible(Point, Pen)
Indicates whether the specified point is contained within (under) the outline of this GraphicsPath when drawn with the specified Pen.
Public methodIsOutlineVisible(PointF, Pen)
Indicates whether the specified point is contained within (under) the outline of this GraphicsPath when drawn with the specified Pen.
Public methodIsOutlineVisible(Int32, Int32, Pen)
Indicates whether the specified point is contained within (under) the outline of this GraphicsPath when drawn with the specified Pen.
Public methodIsOutlineVisible(Single, Single, Pen)
Indicates whether the specified point is contained within (under) the outline of this GraphicsPath when drawn with the specified Pen.
Public methodIsOutlineVisible(Point, Pen, Graphics)
Indicates whether the specified point is contained within (under) the outline of this GraphicsPath when drawn with the specified Pen and using the specified Graphics.
Public methodIsOutlineVisible(PointF, Pen, Graphics)
Indicates whether the specified point is contained within (under) the outline of this GraphicsPath when drawn with the specified Pen and using the specified Graphics.
Public methodIsOutlineVisible(Int32, Int32, Pen, Graphics)
Indicates whether the specified point is contained within (under) the outline of this GraphicsPath when drawn with the specified Pen and using the specified Graphics.
Public methodIsOutlineVisible(Single, Single, Pen, Graphics)
Indicates whether the specified point is contained within (under) the outline of this GraphicsPath when drawn with the specified Pen and using the specified Graphics.
Public methodIsVisible(Point)
Indicates whether the specified point is contained within this GraphicsPath.
Public methodIsVisible(PointF)
Indicates whether the specified point is contained within this GraphicsPath.
Public methodIsVisible(Int32, Int32)
Indicates whether the specified point is contained within this GraphicsPath.
Public methodIsVisible(Single, Single)
Indicates whether the specified point is contained within this GraphicsPath.
Public methodIsVisible(Point, Graphics)
Indicates whether the specified point is contained within this GraphicsPath.
Public methodIsVisible(PointF, Graphics)
Indicates whether the specified point is contained within this GraphicsPath.
Public methodIsVisible(Int32, Int32, Graphics)
Indicates whether the specified point is contained within this GraphicsPath, using the specified Graphics.
Public methodIsVisible(Single, Single, Graphics)
Indicates whether the specified point is contained within this GraphicsPath in the visible clip region of the specified Graphics.
Public methodRemoveFigure
Removes a figure.
Public methodRemoveFigures
Removes figures.
Public methodReset
Empties the graphics path and sets the FillMode to Alternate.
Public methodReverse
Reverses the order of figures, shapes, and points in each shape of this GraphicsPath.
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Public methodTransform
Applies the specified transformation to the shape.
(Overrides ObjectWithBoundsTransform(Matrix).)
Public methodWarp(PointF, RectangleF)
Applies a warp transform, defined by a rectangle and a parallelogram, to this GraphicsPath.
Public methodWarp(PointF, RectangleF, Matrix)
Applies a warp transform, defined by a rectangle and a parallelogram, to this GraphicsPath.
Public methodWarp(PointF, RectangleF, Matrix, WarpMode)
Applies a warp transform, defined by a rectangle and a parallelogram, to this GraphicsPath.
Public methodWarp(PointF, RectangleF, Matrix, WarpMode, Single)
Applies a warp transform, defined by a rectangle and a parallelogram, to this GraphicsPath.
Public methodWiden(Pen)
Adds an additional outline to the path.
Public methodWiden(Pen, Matrix)
Adds an additional outline to the GraphicsPath.
Public methodWiden(Pen, Matrix, Single)
Replaces this GraphicsPath with curves that enclose the area that is filled when this path is drawn by the specified pen.
Examples
This examples make use of GraphicsPath and Graphics class to create and manipulate Figures on an Image surface. Example creates a new Image (of type Tiff), clears the surface and draws paths with the help of GraphicsPath class. At the end DrawPath method exposed by Graphics class is called to render the paths on surface.
[C#]

//Create an instance of FileStream
using (System.IO.FileStream stream = new System.IO.FileStream(@"C:\temp\output.tiff", System.IO.FileMode.Create))
{
    //Create an instance of TiffOptions and set its various properties
    Aspose.Imaging.ImageOptions.TiffOptions tiffOptions = new Aspose.Imaging.ImageOptions.TiffOptions(Imaging.FileFormats.Tiff.Enums.TiffExpectedFormat.Default);

    //Set the source for the instance of ImageOptions
    tiffOptions.Source = new Aspose.Imaging.Sources.StreamSource(stream);

    //Create an instance of Image 
    using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Create(tiffOptions, 500, 500))
    {
        //Create and initialize an instance of Graphics class
        Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(image);

        //Clear Graphics surface
        graphics.Clear(Color.Wheat);

        //Create an instance of GraphicsPath class
        Aspose.Imaging.GraphicsPath graphicspath = new Aspose.Imaging.GraphicsPath();

        //Create an instance of Figure class
        Aspose.Imaging.Figure figure = new Aspose.Imaging.Figure();

        //Add Shapes to Figure object
        figure.AddShape(new Aspose.Imaging.Shapes.RectangleShape(new Aspose.Imaging.RectangleF(10f, 10f, 300f, 300f)));
        figure.AddShape(new Aspose.Imaging.Shapes.EllipseShape(new Aspose.Imaging.RectangleF(50f, 50f, 300f, 300f)));
        figure.AddShape(new Aspose.Imaging.Shapes.PieShape(new Aspose.Imaging.RectangleF(new Aspose.Imaging.PointF(250f, 250f), new Aspose.Imaging.SizeF(200f, 200f)), 0f, 45f));

        //Add Figure object to GraphicsPath
        graphicspath.AddFigure(figure);

        //Draw path with Pen object of color Black
        graphics.DrawPath(new Aspose.Imaging.Pen(Aspose.Imaging.Color.Black, 2), graphicspath);

        // save all changes.
        image.Save();
    }
}
See Also