# CompositionNineGridBrush

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

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

```rust
struct CompositionNineGridBrush
```

A brush that paints another brush stretched as a nine-grid (WinUI
`Microsoft.UI.Composition.CompositionNineGridBrush`): the source is cut
by its four insets into corners, edges and a centre; the corners keep
their size (the insets times the inset scales), the edges stretch along
one axis, the centre along both.

The source is a colour or gradient brush (the nine regions of the area
are filled with it, the frame only when the centre is hollow) or a
`CompositionSurfaceBrush`, whose
surface is cut at its natural size: the insets are in the units of the
natural size of the surface. The insets and inset scales are animatable.

Deviation (winui-composition.md): the stretch, alignment and transform
of a surface brush source are not applied; its surface is cut as it is.

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

## Members

- [`left_inset`](#function-left_inset)
- [`set_left_inset`](#function-set_left_inset)
- [`top_inset`](#function-top_inset)
- [`set_top_inset`](#function-set_top_inset)
- [`right_inset`](#function-right_inset)
- [`set_right_inset`](#function-set_right_inset)
- [`bottom_inset`](#function-bottom_inset)
- [`set_bottom_inset`](#function-set_bottom_inset)
- [`left_inset_scale`](#function-left_inset_scale)
- [`set_left_inset_scale`](#function-set_left_inset_scale)
- [`top_inset_scale`](#function-top_inset_scale)
- [`set_top_inset_scale`](#function-set_top_inset_scale)
- [`right_inset_scale`](#function-right_inset_scale)
- [`set_right_inset_scale`](#function-set_right_inset_scale)
- [`bottom_inset_scale`](#function-bottom_inset_scale)
- [`set_bottom_inset_scale`](#function-set_bottom_inset_scale)
- [`from_brush`](#function-from_brush)
- [`source`](#function-source)
- [`set_source`](#function-set_source)
- [`is_center_hollow`](#function-is_center_hollow)
- [`set_is_center_hollow`](#function-set_is_center_hollow)
- [`set_insets`](#function-set_insets)
- [`set_insets_with`](#function-set_insets_with)
- [`set_inset_scales`](#function-set_inset_scales)
- [`set_inset_scales_with`](#function-set_inset_scales_with)

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

### left_inset

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

The width of the left column of the source (animatable as
`LeftInset`).

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

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

### set_left_inset

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



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

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

### top_inset

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

The height of the top row of the source (animatable as `TopInset`).

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

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

### set_top_inset

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



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

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

### right_inset

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

The width of the right column of the source (animatable as
`RightInset`).

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

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

### set_right_inset

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



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

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

### bottom_inset

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

The height of the bottom row of the source (animatable as
`BottomInset`).

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

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

### set_bottom_inset

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



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

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

### left_inset_scale

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

The scale of the left inset in the painted area (default 1;
animatable as `LeftInsetScale`).

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

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

### set_left_inset_scale

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



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

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

### top_inset_scale

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

The scale of the top inset in the painted area (default 1).

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

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

### set_top_inset_scale

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



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

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

### right_inset_scale

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

The scale of the right inset in the painted area (default 1).

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

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

### set_right_inset_scale

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



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

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

### bottom_inset_scale

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

The scale of the bottom inset in the painted area (default 1).

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

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

### set_bottom_inset_scale

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



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

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

### from_brush

```rust
fn from_brush(brush: &Rc<CompositionBrush>) -> Option<CompositionNineGridBrush>
```

The handle of `brush` as a nine-grid brush, if it is one.

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

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

### source

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

The brush that is cut into nine regions.

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

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

### set_source

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



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

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

### is_center_hollow

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

Whether the centre region is left unpainted.

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

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

### set_is_center_hollow

```rust
fn set_is_center_hollow(self: &Self, value: bool)
```



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

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

### set_insets

```rust
fn set_insets(self: &Self, inset: f32)
```

`SetInsets(inset)`: the four insets.

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

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

### set_insets_with

```rust
fn set_insets_with(self: &Self, left: f32, top: f32, right: f32, bottom: f32)
```

`SetInsets(left, top, right, bottom)`.

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

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

### set_inset_scales

```rust
fn set_inset_scales(self: &Self, scale: f32)
```

`SetInsetScales(scale)`: the four inset scales.

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

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

### set_inset_scales_with

```rust
fn set_inset_scales_with(self: &Self, left: f32, top: f32, right: f32, bottom: f32)
```

`SetInsetScales(left, top, right, bottom)`.

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

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