# Geometry

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-base/media/struct-geometry/

**struct** · [`ferroui-base`](/docs/0.5.0/api/ferroui-base/) · v0.5.0

```rust
struct Geometry
```

Defines a geometric shape.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/geometry.rs#L24)

## Members

- [`TYPE`](#assoc_const-type)
- [`to_ref`](#function-to_ref)
- [`clone_geometry`](#function-clone_geometry)
- [`transform_property`](#function-transform_property)
- [`construct`](#function-construct)
- [`changed_subscriber_count`](#function-changed_subscriber_count)
- [`changed`](#function-changed)
- [`bounds`](#function-bounds)
- [`transform`](#function-transform)
- [`set_transform`](#function-set_transform)
- [`parse`](#function-parse)
- [`from_commands`](#function-from_commands)
- [`try_get_path_data`](#function-try_get_path_data)
- [`get_render_bounds`](#function-get_render_bounds)
- [`fill_contains`](#function-fill_contains)
- [`get_fill_intersection_result`](#function-get_fill_intersection_result)
- [`stroke_contains`](#function-stroke_contains)
- [`get_widened_geometry`](#function-get_widened_geometry)
- [`affects_geometry`](#function-affects_geometry)
- [`invalidate_geometry`](#function-invalidate_geometry)
- [`contour_length`](#function-contour_length)
- [`combine`](#function-combine)
- [`try_get_point_at_distance`](#function-try_get_point_at_distance)
- [`try_get_point_and_tangent_at_distance`](#function-try_get_point_and_tangent_at_distance)
- [`try_get_segment`](#function-try_get_segment)

<a id="assoc_const-type"></a>

### TYPE

```rust
const TYPE: &'static $crate::TypeInfo
```

The runtime type of this class.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/geometry.rs#L34)

<a id="function-to_ref"></a>

### to_ref

```rust
fn to_ref(self: &Self) -> $crate::Ref<Geometry>
```

Returns a strong reference to this object.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/geometry.rs#L34)

<a id="function-clone_geometry"></a>

### clone_geometry

```rust
fn clone_geometry(self: &Self) -> Ref<Geometry>
```

Clones the geometry.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/geometry.rs#L34)

<a id="function-transform_property"></a>

### transform_property

```rust
fn transform_property() -> &'static StyledProperty<Option<Ref<Transform>>>
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/geometry.rs#L57)

<a id="function-construct"></a>

### construct

```rust
fn construct() -> Self
```

Creates the class data of a geometry whose platform implementation is
created on demand.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/geometry.rs#L70)

<a id="function-changed_subscriber_count"></a>

### changed_subscriber_count

```rust
fn changed_subscriber_count(self: &Self) -> usize
```

The number of subscribers to the changes of the geometry (a
diagnostics member, used by tests to verify that subscriptions are
released).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/geometry.rs#L99)

<a id="function-changed"></a>

### changed

```rust
fn changed(self: &Self, handler: impl Fn() -> () + 'static) -> Subscription
```

Subscribes to changes of the geometry. Dropping the returned guard
removes the handler; `Subscription::detach` keeps it for the life of
the geometry.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/geometry.rs#L106)

<a id="function-bounds"></a>

### bounds

```rust
fn bounds(self: &Self) -> Rect
```

The geometry's bounding rectangle.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/geometry.rs#L126)

<a id="function-transform"></a>

### transform

```rust
fn transform(self: &Self) -> Option<Ref<Transform>>
```

A transform to apply to the geometry.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/geometry.rs#L152)

<a id="function-set_transform"></a>

### set_transform

```rust
fn set_transform(self: &Self, value: impl Into<Nullable<Transform>>)
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/geometry.rs#L156)

<a id="function-parse"></a>

### parse

```rust
fn parse(s: &str) -> Result<Ref<Geometry>, FormatError>
```

Creates a geometry from a string of path data.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/geometry.rs#L161)

<a id="function-from_commands"></a>

### from_commands

```rust
fn from_commands(commands: &[crate::media::PathCommand]) -> Ref<Geometry>
```

Creates a geometry from path data the compiler of the markup parsed
(`PathCommand::record`): the geometry
`parse` makes of the same text (#603).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/geometry.rs#L168)

<a id="function-try_get_path_data"></a>

### try_get_path_data

```rust
fn try_get_path_data(self: &Self) -> Option<crate::media::GeometryPathData>
```

Exports the backend's actual fill and stroke curves, including this
geometry's transform, without flattening Beziers into line segments.
Returns `None` when the active backend cannot expose its path data.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/geometry.rs#L175)

<a id="function-get_render_bounds"></a>

### get_render_bounds

```rust
fn get_render_bounds(self: &Self, pen: &dyn IPen) -> Rect
```

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

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/geometry.rs#L180)

<a id="function-fill_contains"></a>

### fill_contains

```rust
fn fill_contains(self: &Self, point: Point) -> bool
```

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

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/geometry.rs#L185)

<a id="function-get_fill_intersection_result"></a>

### get_fill_intersection_result

```rust
fn get_fill_intersection_result(self: &Self, geometry: &Geometry) -> Option<IntersectionResult>
```

Gets the relation between this geometry's fill and another one's.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/geometry.rs#L190)

<a id="function-stroke_contains"></a>

### stroke_contains

```rust
fn stroke_contains(self: &Self, pen: &dyn IPen, point: Point) -> bool
```

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

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/geometry.rs#L198)

<a id="function-get_widened_geometry"></a>

### get_widened_geometry

```rust
fn get_widened_geometry(self: &Self, pen: &dyn IPen) -> Ref<Geometry>
```

Gets a geometry that is the shape defined by the stroke on the
geometry produced by the specified pen.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/geometry.rs#L204)

<a id="function-affects_geometry"></a>

### affects_geometry

```rust
fn affects_geometry(properties: &[&'static FerroProperty])
```

Marks the given properties as affecting the geometry's platform
implementation: after a change to any of them, the implementation is
recreated and the changed notification is raised.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/geometry.rs#L211)

<a id="function-invalidate_geometry"></a>

### invalidate_geometry

```rust
fn invalidate_geometry(self: &Self)
```

Invalidates the platform implementation of the geometry.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/geometry.rs#L218)

<a id="function-contour_length"></a>

### contour_length

```rust
fn contour_length(self: &Self) -> f64
```

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

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/geometry.rs#L303)

<a id="function-combine"></a>

### combine

```rust
fn combine(geometry1: impl IntoRef<Geometry>, geometry2: &Ref<RectangleGeometry>, combine_mode: GeometryCombineMode, transform: impl Into<Nullable<Transform>>) -> Ref<Geometry>
```

Combines the two geometries using the specified combine mode and
applies the specified transform to the resulting geometry.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/geometry.rs#L309)

<a id="function-try_get_point_at_distance"></a>

### try_get_point_at_distance

```rust
fn try_get_point_at_distance(self: &Self, distance: f64) -> Option<Point>
```

Attempts to get the corresponding point at the specified distance.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/geometry.rs#L325)

<a id="function-try_get_point_and_tangent_at_distance"></a>

### try_get_point_and_tangent_at_distance

```rust
fn try_get_point_and_tangent_at_distance(self: &Self, distance: f64) -> Option<(Point, Point)>
```

Attempts to get the corresponding point and tangent from the
specified distance along the contour of the geometry.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/geometry.rs#L331)

<a id="function-try_get_segment"></a>

### try_get_segment

```rust
fn try_get_segment(self: &Self, start_distance: f64, stop_distance: f64, start_on_begin_figure: bool) -> Option<Ref<Geometry>>
```

Attempts to get the corresponding path segment given by the two
distances specified. Imagine it like snipping a part of the current
geometry.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/geometry.rs#L338)

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- [`GeometryImplExt`](/docs/0.5.0/api/ferroui-base/media/trait-geometryimplext/)
- [`FerroObjectImplExt`](/docs/0.5.0/api/ferroui-base/trait-ferroobjectimplext/)
- [`ClassDefaults`](/docs/0.5.0/api/ferroui-base/trait-classdefaults/)
- `Borrow<T>`
- `BorrowMut<T>`
- `Into<U>`
- `From<T>`
- `TryInto<U>`
- `TryFrom<U>`
- [`Receiver`](/docs/0.5.0/api/ferroui-system/task/oneshot/struct-receiver/)
- `Any`
- `ErasedDestructor`
- `IntoEither`
- `Deref`
- [`Upcast<T>`](/docs/0.5.0/api/ferroui-base/trait-upcast/)
- [`Upcast<Geometry>`](/docs/0.5.0/api/ferroui-base/trait-upcast/)
- [`StaticType`](/docs/0.5.0/api/ferroui-base/trait-statictype/)
- [`ObjectType`](/docs/0.5.0/api/ferroui-base/trait-objecttype/)
- [`Subclassable<T>`](/docs/0.5.0/api/ferroui-base/trait-subclassable/)
- [`FerroObjectImpl`](/docs/0.5.0/api/ferroui-base/trait-ferroobjectimpl/)
- [`GeometryImpl`](/docs/0.5.0/api/ferroui-base/media/trait-geometryimpl/)
- `ICompositionRenderResource`
- [`IAffectsRender`](/docs/0.5.0/api/ferroui-base/media/trait-iaffectsrender/)

## Availability

Extracted for `aarch64-apple-darwin`. Cargo features are listed in the [crate index](/docs/0.5.0/api/).
