# DropShadowRecipe

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-base/media/struct-dropshadowrecipe/

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

```rust
struct DropShadowRecipe
```

The values of the drop shadow of a theme shadow (WinUI's
`DropShadowRecipe`, `GetDropShadowRecipe`): an ambient and a directional
shadow of the elevation of an element.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/theme_shadow.rs#L336)

## Members

- [`radius_x`](#struct_field-radius_x)
- [`radius_y`](#struct_field-radius_y)
- [`elevation`](#struct_field-elevation)
- [`ambient_blur_radius`](#struct_field-ambient_blur_radius)
- [`directional_blur_radius`](#struct_field-directional_blur_radius)
- [`ambient_y_offset`](#struct_field-ambient_y_offset)
- [`directional_y_offset`](#struct_field-directional_y_offset)
- [`ambient_opacity`](#struct_field-ambient_opacity)
- [`directional_opacity`](#struct_field-directional_opacity)
- [`ambient_color`](#struct_field-ambient_color)
- [`directional_color`](#struct_field-directional_color)
- [`insets`](#struct_field-insets)
- [`new`](#function-new)
- [`with_corner_radius`](#function-with_corner_radius)
- [`is_visible`](#function-is_visible)
- [`box_shadows`](#function-box_shadows)

<a id="struct_field-radius_x"></a>

### radius_x

```rust
radius_x: f64
```

The corner radii of the rounded rectangle that casts the shadow.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/theme_shadow.rs#L338)

<a id="struct_field-radius_y"></a>

### radius_y

```rust
radius_y: f64
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/theme_shadow.rs#L339)

<a id="struct_field-elevation"></a>

### elevation

```rust
elevation: f32
```

The elevation: half the Z of the translation, at most 64.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/theme_shadow.rs#L341)

<a id="struct_field-ambient_blur_radius"></a>

### ambient_blur_radius

```rust
ambient_blur_radius: f32
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/theme_shadow.rs#L342)

<a id="struct_field-directional_blur_radius"></a>

### directional_blur_radius

```rust
directional_blur_radius: f32
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/theme_shadow.rs#L343)

<a id="struct_field-ambient_y_offset"></a>

### ambient_y_offset

```rust
ambient_y_offset: f32
```

How far each shadow is moved down.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/theme_shadow.rs#L345)

<a id="struct_field-directional_y_offset"></a>

### directional_y_offset

```rust
directional_y_offset: f32
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/theme_shadow.rs#L346)

<a id="struct_field-ambient_opacity"></a>

### ambient_opacity

```rust
ambient_opacity: f32
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/theme_shadow.rs#L347)

<a id="struct_field-directional_opacity"></a>

### directional_opacity

```rust
directional_opacity: f32
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/theme_shadow.rs#L348)

<a id="struct_field-ambient_color"></a>

### ambient_color

```rust
ambient_color: crate::media::Color
```

Black with the opacity in the alpha (truncated, as WinUI converts it).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/theme_shadow.rs#L350)

<a id="struct_field-directional_color"></a>

### directional_color

```rust
directional_color: crate::media::Color
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/theme_shadow.rs#L351)

<a id="struct_field-insets"></a>

### insets

```rust
insets: crate::Thickness
```

How far the shadow reaches around the element.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/theme_shadow.rs#L353)

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

### new

```rust
fn new(translation_z: f32, theme: ThemeShadowTheme) -> DropShadowRecipe
```

`GetDropShadowRecipe(translationZ, theme)`: no shadow below an
elevation of 2; up to 16 a directional shadow only, of the opacity
`min(elevation / 100 + 0.06, 0.14)` in the light theme and 0.26 in the
dark one; above 16 also an ambient shadow, blurred by a third of the
elevation and moved down by 2, of the opacity 0.15 (light) or 0.37
(dark), the directional one 0.19 (light) or 0.37 (dark). The
directional shadow is blurred by the elevation and moved down by half
of it. The corner radii are zero; see
`with_corner_radius`.

A high contrast theme has no shadow: both opacities are zero.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/theme_shadow.rs#L368)

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

### with_corner_radius

```rust
fn with_corner_radius(self: Self, radius_x: f64, radius_y: f64) -> DropShadowRecipe
```

The recipe with the corner radii of the rounded rectangle that casts
the shadow.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/theme_shadow.rs#L419)

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

### is_visible

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

Whether the recipe draws anything.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/theme_shadow.rs#L426)

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

### box_shadows

```rust
fn box_shadows(self: &Self) -> Vec<BoxShadow>
```

The two shadows as the box shadows of the rounded rectangle the shadow
is drawn around, the ambient first (`CreateDropShadowVisual` puts it
at the bottom). Each is blurred by one more than its radius, because
the rectangle is one pixel smaller on each side than the element
(`CreateDropShadowVisual` shrinks the dummy shape so that the
antialiased edge of the element lies over the shadow).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/media/theme_shadow.rs#L436)

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- [`PropertyValue`](/docs/0.5.0/api/ferroui-base/trait-propertyvalue/)
- [`AnyValue`](/docs/0.5.0/api/ferroui-base/trait-anyvalue/)
- [`ClassDefaults`](/docs/0.5.0/api/ferroui-base/trait-classdefaults/)
- `Borrow<T>`
- `BorrowMut<T>`
- `CloneToUninit`
- `Into<U>`
- `From<T>`
- `TryInto<U>`
- `TryFrom<U>`
- `Any`
- `ToOwned`
- `ErasedDestructor`
- `IntoEither`
- `Clone`
- `Copy`
- `Debug`
- `StructuralPartialEq`
- `PartialEq`

## Availability

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