# ColorMatrixAlphaMode

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-base/media/enum-colormatrixalphamode/

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

```rust
enum ColorMatrixAlphaMode
```

How a [`ColorMatrix`](/docs/0.5.0/api/ferroui-base/media/struct-colormatrix/) treats the premultiplied colours it is applied to
(Win2D `CanvasAlphaMode` of `ColorMatrixEffect.AlphaMode`, Direct2D's
`D2D1_COLORMATRIX_ALPHA_MODE`).

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

## Members

- [`Premultiplied`](#variant-premultiplied)
- [`Straight`](#variant-straight)

<a id="variant-premultiplied"></a>

### Premultiplied

```rust
Premultiplied
```

The colour is un-premultiplied, the matrix applied to `[R, G, B, a, 1]`
and the result premultiplied again (the Win2D default).

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

<a id="variant-straight"></a>

### Straight

```rust
Straight
```

The matrix is applied to the premultiplied colour as it is,
`[R a, G a, B a, a, 1]`, and the result taken as premultiplied (its
colour clamped to its alpha).

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

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- [`ResourceKeyObject`](/docs/0.5.0/api/ferroui-base/controls/trait-resourcekeyobject/)
- [`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`
- `Default`
- `StructuralPartialEq`
- `PartialEq`
- `Eq`
- `Hash`

## Availability

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