# Shape

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-controls/shapes/struct-shape/

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

```rust
struct Shape
```

Provides a base class for shape elements, such as `Ellipse`, `Polygon`
and `Rectangle`.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/shapes/shape.rs#L22)

## Members

- [`TYPE`](#assoc_const-type)
- [`to_ref`](#function-to_ref)
- [`create_defining_geometry`](#function-create_defining_geometry)
- [`on_geometry_changed`](#function-on_geometry_changed)
- [`fill_property`](#function-fill_property)
- [`stretch_property`](#function-stretch_property)
- [`stroke_property`](#function-stroke_property)
- [`stroke_dash_array_property`](#function-stroke_dash_array_property)
- [`stroke_dash_offset_property`](#function-stroke_dash_offset_property)
- [`stroke_thickness_property`](#function-stroke_thickness_property)
- [`stroke_line_cap_property`](#function-stroke_line_cap_property)
- [`stroke_join_property`](#function-stroke_join_property)
- [`stroke_miter_limit_property`](#function-stroke_miter_limit_property)
- [`construct`](#function-construct)
- [`get_alpha_mask`](#function-get_alpha_mask)
- [`defining_geometry`](#function-defining_geometry)
- [`rendered_geometry`](#function-rendered_geometry)
- [`fill`](#function-fill)
- [`set_fill`](#function-set_fill)
- [`stretch`](#function-stretch)
- [`set_stretch`](#function-set_stretch)
- [`stroke`](#function-stroke)
- [`set_stroke`](#function-set_stroke)
- [`stroke_dash_array`](#function-stroke_dash_array)
- [`set_stroke_dash_array`](#function-set_stroke_dash_array)
- [`stroke_dash_offset`](#function-stroke_dash_offset)
- [`set_stroke_dash_offset`](#function-set_stroke_dash_offset)
- [`stroke_thickness`](#function-stroke_thickness)
- [`set_stroke_thickness`](#function-set_stroke_thickness)
- [`stroke_line_cap`](#function-stroke_line_cap)
- [`set_stroke_line_cap`](#function-set_stroke_line_cap)
- [`stroke_join`](#function-stroke_join)
- [`set_stroke_join`](#function-set_stroke_join)
- [`stroke_miter_limit`](#function-stroke_miter_limit)
- [`set_stroke_miter_limit`](#function-set_stroke_miter_limit)
- [`affects_geometry`](#function-affects_geometry)
- [`invalidate_geometry`](#function-invalidate_geometry)

<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.Controls/shapes/shape.rs#L34)

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

### to_ref

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

Returns a strong reference to this object.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/shapes/shape.rs#L34)

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

### create_defining_geometry

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

Creates the shape's defining geometry.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/shapes/shape.rs#L34)

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

### on_geometry_changed

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

Called when the underlying `Geometry` changed.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/shapes/shape.rs#L34)

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

### fill_property

```rust
fn fill_property() -> &'static StyledProperty<Option<Rc<dyn IBrush>>>
```

Defines the `Fill` property.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/shapes/shape.rs#L167)

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

### stretch_property

```rust
fn stretch_property() -> &'static StyledProperty<Stretch>
```

Defines the `Stretch` property.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/shapes/shape.rs#L167)

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

### stroke_property

```rust
fn stroke_property() -> &'static StyledProperty<Option<Rc<dyn IBrush>>>
```

Defines the `Stroke` property.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/shapes/shape.rs#L167)

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

### stroke_dash_array_property

```rust
fn stroke_dash_array_property() -> &'static StyledProperty<Option<MediaCollection<f64>>>
```

Defines the `StrokeDashArray` property.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/shapes/shape.rs#L167)

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

### stroke_dash_offset_property

```rust
fn stroke_dash_offset_property() -> &'static StyledProperty<f64>
```

Defines the `StrokeDashOffset` property.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/shapes/shape.rs#L167)

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

### stroke_thickness_property

```rust
fn stroke_thickness_property() -> &'static StyledProperty<f64>
```

Defines the `StrokeThickness` property.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/shapes/shape.rs#L167)

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

### stroke_line_cap_property

```rust
fn stroke_line_cap_property() -> &'static StyledProperty<PenLineCap>
```

Defines the `StrokeLineCap` property.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/shapes/shape.rs#L167)

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

### stroke_join_property

```rust
fn stroke_join_property() -> &'static StyledProperty<PenLineJoin>
```

Defines the `StrokeJoin` property.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/shapes/shape.rs#L167)

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

### stroke_miter_limit_property

```rust
fn stroke_miter_limit_property() -> &'static StyledProperty<f64>
```

Defines the `StrokeMiterLimit` property.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/shapes/shape.rs#L167)

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

### construct

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

Creates the class data; see `ferroui_base::FerroObject::construct`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/shapes/shape.rs#L234)

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

### get_alpha_mask

```rust
fn get_alpha_mask(self: &Self) -> Option<Rc<CompositionBrush>>
```

`Shape.GetAlphaMask`: a composition brush that shows the alpha of the
shape (its fill and its stroke), for the `Mask` of a
`DropShadow` or
another composition effect. The same brush is returned on every call;
it follows the shape as the shape is drawn again (its geometry, stroke,
size and visibility). `None` when no compositor is available.

See `AlphaMask` for how the mask is drawn.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/shapes/shape.rs#L254)

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

### defining_geometry

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

Gets a value that represents the `Geometry` of the shape.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/shapes/shape.rs#L259)

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

### rendered_geometry

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

Gets a value that represents the final rendered `Geometry` of the
shape.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/shapes/shape.rs#L279)

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

### fill

```rust
fn fill(self: &Self) -> Option<Rc<dyn IBrush>>
```

Gets the brush that specifies how the shape's interior is painted.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/shapes/shape.rs#L308)

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

### set_fill

```rust
fn set_fill(self: &Self, value: Option<Rc<dyn IBrush>>)
```

Sets the brush that specifies how the shape's interior is painted.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/shapes/shape.rs#L313)

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

### stretch

```rust
fn stretch(self: &Self) -> Stretch
```

Gets a `Stretch` value that describes how the shape fills its
allocated space.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/shapes/shape.rs#L319)

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

### set_stretch

```rust
fn set_stretch(self: &Self, value: Stretch)
```

Sets a `Stretch` value that describes how the shape fills its
allocated space.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/shapes/shape.rs#L325)

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

### stroke

```rust
fn stroke(self: &Self) -> Option<Rc<dyn IBrush>>
```

Gets the brush that specifies how the shape's outline is painted.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/shapes/shape.rs#L330)

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

### set_stroke

```rust
fn set_stroke(self: &Self, value: Option<Rc<dyn IBrush>>)
```

Sets the brush that specifies how the shape's outline is painted.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/shapes/shape.rs#L335)

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

### stroke_dash_array

```rust
fn stroke_dash_array(self: &Self) -> Option<MediaCollection<f64>>
```

Gets a collection of values that indicate the pattern of dashes and
gaps that is used to outline shapes.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/shapes/shape.rs#L341)

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

### set_stroke_dash_array

```rust
fn set_stroke_dash_array(self: &Self, value: Option<MediaCollection<f64>>)
```

Sets a collection of values that indicate the pattern of dashes and
gaps that is used to outline shapes.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/shapes/shape.rs#L347)

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

### stroke_dash_offset

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

Gets a value that specifies the distance within the dash pattern
where a dash begins.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/shapes/shape.rs#L353)

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

### set_stroke_dash_offset

```rust
fn set_stroke_dash_offset(self: &Self, value: f64)
```

Sets a value that specifies the distance within the dash pattern
where a dash begins.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/shapes/shape.rs#L359)

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

### stroke_thickness

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

Gets the width of the shape outline.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/shapes/shape.rs#L364)

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

### set_stroke_thickness

```rust
fn set_stroke_thickness(self: &Self, value: f64)
```

Sets the width of the shape outline.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/shapes/shape.rs#L369)

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

### stroke_line_cap

```rust
fn stroke_line_cap(self: &Self) -> PenLineCap
```

Gets a `PenLineCap` value that describes the shape at the ends of a
line.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/shapes/shape.rs#L375)

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

### set_stroke_line_cap

```rust
fn set_stroke_line_cap(self: &Self, value: PenLineCap)
```

Sets a `PenLineCap` value that describes the shape at the ends of a
line.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/shapes/shape.rs#L381)

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

### stroke_join

```rust
fn stroke_join(self: &Self) -> PenLineJoin
```

Gets a `PenLineJoin` value that specifies the type of join that is
used at the vertices of a shape.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/shapes/shape.rs#L387)

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

### set_stroke_join

```rust
fn set_stroke_join(self: &Self, value: PenLineJoin)
```

Sets a `PenLineJoin` value that specifies the type of join that is
used at the vertices of a shape.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/shapes/shape.rs#L393)

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

### stroke_miter_limit

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

Gets the limit on the ratio of the miter length to half the
`StrokeThickness` of the pen.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/shapes/shape.rs#L399)

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

### set_stroke_miter_limit

```rust
fn set_stroke_miter_limit(self: &Self, value: f64)
```

Sets the limit on the ratio of the miter length to half the
`StrokeThickness` of the pen.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/shapes/shape.rs#L405)

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

### affects_geometry

```rust
fn affects_geometry<T: ObjectType + Upcast<Shape>>(properties: &[&'static FerroProperty])
```

Marks a property as affecting the shape's geometry.

After a call to this method in a control's class initialisation, any
change to the property on an object of class `T` causes
`invalidate_geometry` to be called on
the element.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/shapes/shape.rs#L415)

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

### invalidate_geometry

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

Invalidates the geometry of this shape.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/shapes/shape.rs#L427)

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- [`ShapeImplExt`](/docs/0.5.0/api/ferroui-controls/shapes/trait-shapeimplext/)
- [`ControlImplExt`](/docs/0.5.0/api/ferroui-controls/trait-controlimplext/)
- `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`
- [`InputElementImplExt`](/docs/0.5.0/api/ferroui-base/input/trait-inputelementimplext/)
- [`InteractiveImplExt`](/docs/0.5.0/api/ferroui-base/interactivity/trait-interactiveimplext/)
- [`LayoutableImplExt`](/docs/0.5.0/api/ferroui-base/layout/trait-layoutableimplext/)
- [`FerroObjectImplExt`](/docs/0.5.0/api/ferroui-base/trait-ferroobjectimplext/)
- [`StyledElementImplExt`](/docs/0.5.0/api/ferroui-base/trait-styledelementimplext/)
- [`ClassDefaults`](/docs/0.5.0/api/ferroui-base/trait-classdefaults/)
- [`VisualImplExt`](/docs/0.5.0/api/ferroui-base/trait-visualimplext/)
- `ErasedDestructor`
- `IntoEither`
- `Deref`
- [`Upcast<T>`](/docs/0.5.0/api/ferroui-base/trait-upcast/)
- [`Upcast<Shape>`](/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/)
- [`StyledElementImpl`](/docs/0.5.0/api/ferroui-base/trait-styledelementimpl/)
- [`InteractiveImpl`](/docs/0.5.0/api/ferroui-base/interactivity/trait-interactiveimpl/)
- [`InputElementImpl`](/docs/0.5.0/api/ferroui-base/input/trait-inputelementimpl/)
- [`ControlImpl`](/docs/0.5.0/api/ferroui-controls/trait-controlimpl/)
- [`ShapeImpl`](/docs/0.5.0/api/ferroui-controls/shapes/trait-shapeimpl/)
- [`FerroObjectImpl`](/docs/0.5.0/api/ferroui-base/trait-ferroobjectimpl/)
- [`VisualImpl`](/docs/0.5.0/api/ferroui-base/trait-visualimpl/)
- [`LayoutableImpl`](/docs/0.5.0/api/ferroui-base/layout/trait-layoutableimpl/)

## Availability

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