Skip to main content

StreamGeometryContext Class

Definition

Namespace:Avalonia.Media
Assembly:Avalonia.Base
Package:Avalonia

Describes a geometry using drawing commands.

public class StreamGeometryContext

Inheritance: object -> StreamGeometryContext

Implements: IGeometryContext, IDisposable

Remarks

This class is used to define the geometry of a Avalonia.Media.StreamGeometry. An instance of Avalonia.Media.StreamGeometryContext is obtained by calling Avalonia.Media.StreamGeometry.Open.

Constructors

NameDescription
StreamGeometryContextInitializes a new instance of the Avalonia.Media.StreamGeometryContext class.

StreamGeometryContext Constructor

Initializes a new instance of the Avalonia.Media.StreamGeometryContext class.

public StreamGeometryContext(Avalonia.Platform.IStreamGeometryContextImpl impl)

Parameters

impl Avalonia.Platform.IStreamGeometryContextImpl

The platform-specific implementation.

Methods

NameDescription
ArcToDraws an arc to the specified point.
BeginFigureBegins a new figure.
CubicBezierToDraws a Bezier curve to the specified point.
DisposeFinishes the drawing session.
EndFigureEnds the figure started by Avalonia.Platform.IGeometryContext.BeginFigure(Avalonia.Point,bool).
LineToDraws a line to the specified point.
PreciseArcToDraws an arc to the specified point using polylines, quadratic or cubic Bezier curves Significantly more precise when drawing elliptic arcs with extreme width:height ratios.
QuadraticBezierToDraws a quadratic Bezier curve to the specified point.
SetFillRuleSets path's winding rule (default is EvenOdd). You should call this method before any calls to BeginFigure. If you wonder why, ask Direct2D guys about their design decisions.

ArcTo Method

Draws an arc to the specified point.

public void ArcTo(Avalonia.Point point, Avalonia.Size size, double rotationAngle, bool isLargeArc, Avalonia.Media.SweepDirection sweepDirection, bool isStroked)

Parameters

point Avalonia.Point

The destination point where the arc ends.

size Avalonia.Size

The radii of an ellipse whose path is used to draw the arc.

rotationAngle double

The rotation angle (in degrees) of the ellipse that specifies the path of the arc; positive values are clockwise. This will rotate the entire arc relative to the X-axis and is not commonly used.

isLargeArc bool

Specifies whether the arc should follow the longer path around an ellipse rather than the shorter one. true to draw the arc greater than 180 degrees; otherwise, false.

sweepDirection Avalonia.Media.SweepDirection

A value that indicates whether the arc is drawn in the Clockwise or Counterclockwise direction.

isStroked bool

Whether the segment is stroked.

BeginFigure Method

Begins a new figure.

public void BeginFigure(Avalonia.Point startPoint, bool isFilled)

Parameters

startPoint Avalonia.Point

The starting point for the figure.

isFilled bool

Whether the figure is filled.

CubicBezierTo Method

Draws a Bezier curve to the specified point.

public void CubicBezierTo(Avalonia.Point controlPoint1, Avalonia.Point controlPoint2, Avalonia.Point endPoint, bool isStroked)

Parameters

controlPoint1 Avalonia.Point

The first control point used to specify the shape of the curve.

controlPoint2 Avalonia.Point

The second control point used to specify the shape of the curve.

endPoint Avalonia.Point

The destination point for the end of the curve.

isStroked bool

Whether the segment is stroked.

Dispose Method

Finishes the drawing session.

public void Dispose()

EndFigure Method

Ends the figure started by Avalonia.Platform.IGeometryContext.BeginFigure(Avalonia.Point,bool).

public void EndFigure(bool isClosed)

Parameters

isClosed bool

Whether the figure is closed.

LineTo Method

Draws a line to the specified point.

public void LineTo(Avalonia.Point point, bool isStroked)

Parameters

point Avalonia.Point

The destination point.

isStroked bool

Whether the segment is stroked.

PreciseArcTo Method

Draws an arc to the specified point using polylines, quadratic or cubic Bezier curves Significantly more precise when drawing elliptic arcs with extreme width:height ratios.

public void PreciseArcTo(Avalonia.Point point, Avalonia.Size size, double rotationAngle, bool isLargeArc, Avalonia.Media.SweepDirection sweepDirection)

Parameters

point Avalonia.Point

The destination point.

size Avalonia.Size

The radii of an oval whose perimeter is used to draw the angle.

rotationAngle double

The rotation angle (in radians) of the oval that specifies the curve.

isLargeArc bool

true to draw the arc greater than 180 degrees; otherwise, false.

sweepDirection Avalonia.Media.SweepDirection

A value that indicates whether the arc is drawn in the Clockwise or Counterclockwise direction.

QuadraticBezierTo Method

Draws a quadratic Bezier curve to the specified point.

public void QuadraticBezierTo(Avalonia.Point controlPoint, Avalonia.Point endPoint, bool isStroked)

Parameters

controlPoint Avalonia.Point

The control point used to specify the shape of the curve.

endPoint Avalonia.Point

The destination point for the end of the curve.

isStroked bool

Whether the segment is stroked.

SetFillRule Method

Sets path's winding rule (default is EvenOdd). You should call this method before any calls to BeginFigure. If you wonder why, ask Direct2D guys about their design decisions.

public void SetFillRule(Avalonia.Media.FillRule fillRule)

Parameters

fillRule Avalonia.Media.FillRule