# ShapeVisual

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-base/rendering/composition/struct-shapevisual/

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

```rust
struct ShapeVisual
```

A visual that draws shapes (WinUI `Microsoft.UI.Composition.ShapeVisual`):
its `shapes` in order, through its
`view_box` when it has one, then its children.

The shapes are clipped to the size of the visual (so a shape visual
without a size shows no shapes, as in WinUI); the visual itself does not
clip its children (`clip_to_bounds` is `false`, as for a sprite visual).
A change of a shape, of its geometry or brushes, of the collections or
of the view box, an animation included, redraws the visual.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/rendering/composition/shape_visual.rs#L22)

## Members

- [`from_visual`](#function-from_visual)
- [`visual`](#function-visual)
- [`shapes`](#function-shapes)
- [`view_box`](#function-view_box)
- [`set_view_box`](#function-set_view_box)

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

### from_visual

```rust
fn from_visual(visual: &Rc<CompositionVisual>) -> Option<ShapeVisual>
```

The handle of `visual` as a shape visual, if it is one.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/rendering/composition/shape_visual.rs#L48)

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

### visual

```rust
fn visual(self: &Self) -> &Rc<CompositionVisual>
```

The visual as a composition visual.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/rendering/composition/shape_visual.rs#L53)

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

### shapes

```rust
fn shapes(self: &Self) -> Rc<CompositionShapeCollection>
```

The shapes the visual draws, in order.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/rendering/composition/shape_visual.rs#L65)

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

### view_box

```rust
fn view_box(self: &Self) -> Option<Rc<CompositionViewBox>>
```

The area of the shape coordinates the visual shows.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/rendering/composition/shape_visual.rs#L73)

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

### set_view_box

```rust
fn set_view_box(self: &Self, value: Option<Rc<CompositionViewBox>>)
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/rendering/composition/shape_visual.rs#L77)

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- [`ClassDefaults`](/docs/0.5.0/api/ferroui-base/trait-classdefaults/)
- `Borrow<T>`
- `BorrowMut<T>`
- `CloneToUninit`
- `Into<U>`
- `From<T>`
- `TryInto<U>`
- `TryFrom<U>`
- [`Receiver`](/docs/0.5.0/api/ferroui-system/task/oneshot/struct-receiver/)
- `Any`
- `ToOwned`
- `ErasedDestructor`
- `IntoEither`
- `Clone`
- `Deref`

## Availability

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