Click or drag to resize
CanvasPathBuilder Class
A path builder is used for creating freeform CanvasGeometry objects.
Inheritance Hierarchy
SystemObject
  Microsoft.Graphics.Canvas.GeometryCanvasPathBuilder

Namespace:  Microsoft.Graphics.Canvas.Geometry
Assembly:  Microsoft.Graphics.Canvas (in Microsoft.Graphics.Canvas.dll) Version: 0.0.0.0
Syntax
C#
public sealed class CanvasPathBuilder : IDisposable

The CanvasPathBuilder type exposes the following members.

Constructors
  NameDescription
Public methodCanvasPathBuilder
Initializes a new instance of the CanvasPathBuilder class.
Top
Methods
  NameDescription
Public methodAddArc(Vector2, Single, Single, Single, Single)
Adds a single arc to the path, specified as a portion of an ellipse.
Public methodAddArc(Vector2, Single, Single, Single, CanvasSweepDirection, CanvasArcSize)
Adds a single arc to the path, specified by start and end points through which an ellipse will be fitted.
Public methodAddCubicBezier
Adds a cubic bezier to the path. The bezier starts where the path left off, and has the specified control points and end point.
Public methodAddGeometry
Adds all the figures of the specified geometry to the path.
Public methodAddLine(Vector2)
Adds a line segment to the path, with the specified end point.
Public methodAddLine(Single, Single)
Adds a line segment to the path, with the specified end point.
Public methodAddQuadraticBezier
Adds a quadratic bezier to the path. The bezier starts where the path left off, and has the specified control point and end point.
Public methodBeginFigure(Vector2)
Starts a new figure at the specified point, with the default figure fill option of Default.
Public methodBeginFigure(Single, Single)
Starts a new figure at the specified point, with the default figure fill option of Default.
Public methodBeginFigure(Vector2, CanvasFigureFill)
Starts a new figure at the specified point, with the specified figure fill option.
Public methodBeginFigure(Single, Single, CanvasFigureFill)
Starts a new figure at the specified point, with the specified figure fill option.
Public methodDispose
Releases all resources used by the CanvasPathBuilder.
Public methodEndFigure
Ends the current figure; optionally, closes it.
Public methodSetFilledRegionDetermination
Specifies the method used to determine which points are inside the geometry described by this path builder, and which points are outside.
Public methodSetSegmentOptions
Specifies stroke and join options to be applied to new segments added to the path builder.
Top
Remarks
Paths consist of zero or more figures, where a figure is made up of straight or curved segments. Figures can be opened or closed.
Examples

The following is an example of how to create a simple CanvasGeometry using a CanvasPathBuilder object.

CanvasPathBuilder pathBuilder = new CanvasPathBuilder(device);

pathBuilder.BeginFigure(1, 1);
pathBuilder.AddLine(300, 300);
pathBuilder.AddLine(1, 300);
pathBuilder.EndFigure(CanvasFigureLoop.Closed);

CanvasGeometry triangleGeometry = CanvasGeometry.CreatePath(pathBuilder);
See Also