# CompositionMaskBrush

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

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

```rust
struct CompositionMaskBrush
```

A brush that paints a source brush through the alpha of a mask brush
(WinUI `Microsoft.UI.Composition.CompositionMaskBrush`).

A colour or gradient mask is the opacity mask of the drawing context. A
surface (or other composition) brush as the mask is painted over the
source in a layer with the destination-in blending of bitmaps.

Deviation (winui-composition.md): a mask that is not a colour or gradient
brush masks through the bitmaps it draws only (a loaded image surface);
shapes drawn by a visual surface used as a mask do not mask.

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

## Members

- [`from_brush`](#function-from_brush)
- [`source`](#function-source)
- [`set_source`](#function-set_source)
- [`mask`](#function-mask)
- [`set_mask`](#function-set_mask)

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

### from_brush

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

The handle of `brush` as a mask brush, if it is one.

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

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

### source

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

The brush that is painted.

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

<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#L194)

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

### mask

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

The brush whose alpha masks the source.

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

<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/brushes/composition_nine_grid_brush.rs#L203)

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