# LayerVisual

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

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

```rust
struct LayerVisual
```

A container visual whose children are composed into one offscreen layer,
which is then drawn with the opacity of the visual and its shadow (WinUI
`Microsoft.UI.Composition.LayerVisual`).

The shadow of a layer visual follows the alpha of the composed children
where the drawing context can draw a drop shadow of a layer (the Skia
and Vello backends); elsewhere it is the box shadow of the rectangle of
the visual, as the shadow of a sprite visual.

The effect (an effect brush) is applied to the composed children: they
are the first source parameter of its graph, and the rest of the graph
is drawn around them (a blur pushes the blur effect of the drawing
context around the layer, a composite draws its other sources under and
over it).

Like a sprite visual, a layer visual does not clip to its bounds when it
is created (`clip_to_bounds` is `false`).

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

## Members

- [`from_visual`](#function-from_visual)
- [`visual`](#function-visual)
- [`shadow`](#function-shadow)
- [`set_shadow`](#function-set_shadow)
- [`effect`](#function-effect)
- [`set_effect`](#function-set_effect)

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

### from_visual

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

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

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

<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/layer_visual.rs#L56)

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

### shadow

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

The shadow of the composed layer.

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

<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/layer_visual.rs#L72)

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

### effect

```rust
fn effect(self: &Self) -> Option<CompositionEffectBrush>
```

`Effect`: the effect brush applied to the composed children, which
are the first source parameter of its graph. (The upstream `effect`
of every visual, an image effect, is `visual().effect()`.)

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

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

### set_effect

```rust
fn set_effect(self: &Self, value: Option<CompositionEffectBrush>)
```



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

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