Skip to main content

Geometry Class

Definition​

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

Defines a geometric shape.

public class Geometry

Inheritance: object -> AvaloniaObject -> Geometry

Implements: ICompositionRenderResource, ICompositionRenderResource<ServerCompositionSimpleGeometry>, ICompositorSerializable

Methods​

NameDescription
Bind (8 overloads)Binds a Avalonia.AvaloniaProperty to an Avalonia.Data.BindingBase. Inherited from AvaloniaObject.
CheckAccessReturns a value indicating whether the current thread is the UI thread. Inherited from AvaloniaObject.
ClearValue (4 overloads)Clears a Avalonia.AvaloniaProperty's local value. Inherited from AvaloniaObject.
CloneClones the geometry.
CoerceValueCoerces the specified Avalonia.AvaloniaProperty. Inherited from AvaloniaObject.
CombineCombines the two geometries using the specified Avalonia.Media.GeometryCombineMode and applies the specified transform to the resulting geometry.
EqualsCompares two objects using reference equality. Inherited from AvaloniaObject.
FillContainsIndicates whether the geometry's fill contains the specified point.
GetBaseValueInherited from AvaloniaObject.
GetHashCodeGets the hash code for the object. Inherited from AvaloniaObject.
GetRenderBoundsGets the geometry's bounding rectangle with the specified pen.
GetValue (3 overloads)Gets a Avalonia.AvaloniaProperty value. Inherited from AvaloniaObject.
GetWidenedGeometryGets a Avalonia.Media.Geometry that is the shape defined by the stroke on the Geometry produced by the specified Pen.
IsAnimatingChecks whether a Avalonia.AvaloniaProperty is animating. Inherited from AvaloniaObject.
IsSetChecks whether a Avalonia.AvaloniaProperty is set on this object. Inherited from AvaloniaObject.
ParseCreates a Avalonia.Media.Geometry from a string.
SetCurrentValue (2 overloads)Sets the value of a dependency property without changing its value source. Inherited from AvaloniaObject.
SetValue (3 overloads)Sets a Avalonia.AvaloniaProperty value. Inherited from AvaloniaObject.
StrokeContainsIndicates whether the geometry's stroke contains the specified point.
TryGetPointAndTangentAtDistanceNo summary available.
TryGetPointAtDistanceNo summary available.
TryGetSegmentNo summary available.
VerifyAccessChecks that the current thread is the UI thread and throws if not. Inherited from AvaloniaObject.

Clone Method​

Clones the geometry.

public Avalonia.Media.Geometry Clone()

Returns​

Avalonia.Media.Geometry

A cloned geometry.

Combine Method​

Combines the two geometries using the specified Avalonia.Media.GeometryCombineMode and applies the specified transform to the resulting geometry.

public Avalonia.Media.Geometry Combine(Avalonia.Media.Geometry geometry1, Avalonia.Media.RectangleGeometry geometry2, Avalonia.Media.GeometryCombineMode combineMode, Avalonia.Media.Transform transform)

Parameters​

geometry1 Avalonia.Media.Geometry

The first geometry to combine.

geometry2 Avalonia.Media.RectangleGeometry

The second geometry to combine.

combineMode Avalonia.Media.GeometryCombineMode

One of the enumeration values that specifies how the geometries are combined.

transform Avalonia.Media.Transform

A transformation to apply to the combined geometry, or null.

Returns​

Avalonia.Media.Geometry

FillContains Method​

Indicates whether the geometry's fill contains the specified point.

public bool FillContains(Avalonia.Point point)

Parameters​

point Avalonia.Point

The point.

Returns​

bool

true if the geometry contains the point; otherwise, false.

GetRenderBounds Method​

Gets the geometry's bounding rectangle with the specified pen.

public Avalonia.Rect GetRenderBounds(Avalonia.Media.IPen pen)

Parameters​

pen Avalonia.Media.IPen

The stroke thickness.

Returns​

Avalonia.Rect

The bounding rectangle.

GetWidenedGeometry Method​

Gets a Avalonia.Media.Geometry that is the shape defined by the stroke on the Geometry produced by the specified Pen.

public Avalonia.Media.Geometry GetWidenedGeometry(Avalonia.Media.IPen pen)

Parameters​

pen Avalonia.Media.IPen

The pen to use.

Returns​

Avalonia.Media.Geometry

The outlined geometry.

Parse Method​

Creates a Avalonia.Media.Geometry from a string.

public Avalonia.Media.Geometry Parse(string s)

Parameters​

s string

The string.

Returns​

Avalonia.Media.Geometry

A Avalonia.Media.StreamGeometry.

StrokeContains Method​

Indicates whether the geometry's stroke contains the specified point.

public bool StrokeContains(Avalonia.Media.IPen pen, Avalonia.Point point)

Parameters​

pen Avalonia.Media.IPen

The pen to use.

point Avalonia.Point

The point.

Returns​

bool

true if the geometry contains the point; otherwise, false.

TryGetPointAndTangentAtDistance Method​

public bool TryGetPointAndTangentAtDistance(double distance, Avalonia.Point& point, Avalonia.Point& tangent)

Parameters​

distance double

point Avalonia.Point&

tangent Avalonia.Point&

Returns​

bool

TryGetPointAtDistance Method​

public bool TryGetPointAtDistance(double distance, Avalonia.Point& point)

Parameters​

distance double

point Avalonia.Point&

Returns​

bool

TryGetSegment Method​

public bool TryGetSegment(double startDistance, double stopDistance, bool startOnBeginFigure, Avalonia.Media.Geometry& segmentGeometry)

Parameters​

startDistance double

stopDistance double

startOnBeginFigure bool

segmentGeometry Avalonia.Media.Geometry&

Returns​

bool

Properties​

NameDescription
BoundsGets the geometry's bounding rectangle.
ContourLengthGets the geometry's total length as if all its contours are placed in a straight line.
DispatcherReturns the Avalonia.AvaloniaObject.Dispatcher that this Avalonia.AvaloniaObject is associated with. Inherited from AvaloniaObject.
ItemInherited from AvaloniaObject.
TransformGets or sets a transform to apply to the geometry.

Bounds Property​

Gets the geometry's bounding rectangle.

public Avalonia.Rect Bounds { get; set; }

ContourLength Property​

Gets the geometry's total length as if all its contours are placed in a straight line.

public double ContourLength { get; set; }

Transform Property​

Gets or sets a transform to apply to the geometry.

public Avalonia.Media.Transform Transform { get; set; }

Fields​

NameDescription
TransformPropertyDefines the Avalonia.Media.Geometry.Transform property.

TransformProperty Field​

Defines the Avalonia.Media.Geometry.Transform property.

public Avalonia.StyledProperty<TValue><Avalonia.Media.Transform> TransformProperty

Events​

NameDescription
ChangedRaised when the geometry changes.
PropertyChangedRaised when a Avalonia.AvaloniaProperty value changes on this object. Inherited from AvaloniaObject.

Changed Event​

Raised when the geometry changes.

public event EventHandler Changed