# SpriteVisual

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

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

```rust
struct SpriteVisual
```

A visual that paints its size with a composition brush and casts a
shadow (WinUI `Microsoft.UI.Composition.SpriteVisual`): the shadow of its
rectangle, then the brush over `(0, 0, size)`, then its children.

The brush is any [`CompositionBrush`](/docs/0.5.0/api/ferroui-base/rendering/composition/brushes/struct-compositionbrush/): the colour and gradient brushes
fill the rectangle, a
`CompositionSurfaceBrush` lays out its
surface in it. A change of the brush or of the shadow, an animation
included, redraws the visual.

Unlike the other visuals of the compositor, a sprite visual does not
clip to its bounds when it is created (`clip_to_bounds` is `false`), as
a WinUI visual: its shadow and its children may extend beyond its size.

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

## Members

- [`from_visual`](#function-from_visual)
- [`visual`](#function-visual)
- [`brush`](#function-brush)
- [`set_brush`](#function-set_brush)
- [`shadow`](#function-shadow)
- [`set_shadow`](#function-set_shadow)

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

### from_visual

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

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

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

<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/sprite_visual.rs#L52)

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

### brush

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

The brush the visual paints its size with.

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

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

### set_brush

```rust
fn set_brush(self: &Self, value: Option<Rc<CompositionBrush>>)
```



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

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

### shadow

```rust
fn shadow(self: &Self) -> Option<Rc<DropShadow>>
```

The shadow of the visual.

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

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

### set_shadow

```rust
fn set_shadow(self: &Self, value: Option<Rc<DropShadow>>)
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/rendering/composition/sprite_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/).
