# DropShadow

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

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

```rust
struct DropShadow
```

The shadow of a sprite or layer visual (WinUI
`Microsoft.UI.Composition.DropShadow`), with animatable `BlurRadius`,
`Color`, `Offset` and `Opacity`.

On a sprite visual the shadow is cast by the rectangle of the visual (a
box shadow of the drawing context), by the alpha of its
`mask` (any composition brush, such as the brush of
`GetAlphaMask` of a shape, a text block or an image), or, with the
`InheritFromVisualContent` `source_policy`, by the
alpha of the brush of the visual. On a layer visual it is cast by the
composed children, or by the mask. The shadow is drawn under the content
and nothing of it is removed; the Z of the offset moves it as the
renderers project that depth for the visual (a visual turned out of its
plane).

Deviation (winui-composition.md): without effects in the drawing context
the shadow is the box shadow of the rectangle. WinUI's `CompositionShadow`
base class has no members and is not a separate type.

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

## Members

- [`compositor`](#function-compositor)
- [`object`](#function-object)
- [`is_disposed`](#function-is_disposed)
- [`dispose`](#function-dispose)
- [`blur_radius`](#function-blur_radius)
- [`set_blur_radius`](#function-set_blur_radius)
- [`color`](#function-color)
- [`set_color`](#function-set_color)
- [`offset`](#function-offset)
- [`set_offset`](#function-set_offset)
- [`opacity`](#function-opacity)
- [`set_opacity`](#function-set_opacity)
- [`mask`](#function-mask)
- [`set_mask`](#function-set_mask)
- [`source_policy`](#function-source_policy)
- [`set_source_policy`](#function-set_source_policy)

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

### compositor

```rust
fn compositor(self: &Self) -> &Rc<Compositor>
```



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

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

### object

```rust
fn object(self: &Self) -> &CompositionObject
```

The embedded `CompositionObject`.

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

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

### is_disposed

```rust
fn is_disposed(self: &Self) -> bool
```



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

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

### dispose

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



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

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

### blur_radius

```rust
fn blur_radius(self: &Self) -> f32
```

The radius of the blur (default 9).

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

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

### set_blur_radius

```rust
fn set_blur_radius(self: &Self, value: f32)
```



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

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

### color

```rust
fn color(self: &Self) -> Color
```

The colour of the shadow (default black).

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

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

### set_color

```rust
fn set_color(self: &Self, value: Color)
```



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

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

### offset

```rust
fn offset(self: &Self) -> Vector3D
```

The offset of the shadow from the visual (WinUI `Vector3`). The Z is
a depth in the space of the visual: it moves the shadow only where
the visual is turned out of its plane (`Orientation`, `RotationAxis`),
as the renderers project that visual.

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

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

### set_offset

```rust
fn set_offset(self: &Self, value: Vector3D)
```



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

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

### opacity

```rust
fn opacity(self: &Self) -> f32
```

The opacity of the shadow (default 1).

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

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

### set_opacity

```rust
fn set_opacity(self: &Self, value: f32)
```



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

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

### mask

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

The brush whose alpha shapes the shadow, painted over the area of the
visual; `None` for the shape of the visual. Ignored with the
`InheritFromVisualContent` source policy.

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

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

### set_mask

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



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

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

### source_policy

```rust
fn source_policy(self: &Self) -> CompositionDropShadowSourcePolicy
```

What the shadow is cast from: `Default` for the mask (or the shape of
the visual), `InheritFromVisualContent` for the alpha of the content
of the visual (the brush of a sprite visual, the children of a layer
visual).

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

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

### set_source_policy

```rust
fn set_source_policy(self: &Self, value: CompositionDropShadowSourcePolicy)
```



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

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- [`ClassDefaults`](/docs/0.5.0/api/ferroui-base/trait-classdefaults/)
- `Borrow<T>`
- `BorrowMut<T>`
- `Into<U>`
- `From<T>`
- `TryInto<U>`
- `TryFrom<U>`
- `Any`
- `ErasedDestructor`
- `IntoEither`
- `DropShadowHooks`
- `IRegisterForSerialization`
- `ICompositionObjectHost`
- [`ICompositionObjectAnimations`](/docs/0.5.0/api/ferroui-base/rendering/composition/trait-icompositionobjectanimations/)
- [`AsCompositionObject`](/docs/0.5.0/api/ferroui-base/rendering/composition/trait-ascompositionobject/)
- `ICompositionObject`
- `ICompositorSerializable`

## Availability

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