# CompositionGradientBrush

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

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

```rust
struct CompositionGradientBrush
```

The base of the composition gradient brushes: the gradient stops and the
spread method.

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

## Members

- [`from_brush`](#function-from_brush)
- [`gradient_stops`](#function-gradient_stops)
- [`set_gradient_stops`](#function-set_gradient_stops)
- [`spread_method`](#function-spread_method)
- [`set_spread_method`](#function-set_spread_method)
- [`anchor_point`](#function-anchor_point)
- [`set_anchor_point`](#function-set_anchor_point)
- [`center_point`](#function-center_point)
- [`set_center_point`](#function-set_center_point)
- [`offset`](#function-offset)
- [`set_offset`](#function-set_offset)
- [`rotation_angle`](#function-rotation_angle)
- [`set_rotation_angle`](#function-set_rotation_angle)
- [`scale`](#function-scale)
- [`set_scale`](#function-set_scale)
- [`transform_matrix`](#function-transform_matrix)
- [`set_transform_matrix`](#function-set_transform_matrix)
- [`rotation_angle_in_degrees`](#function-rotation_angle_in_degrees)
- [`set_rotation_angle_in_degrees`](#function-set_rotation_angle_in_degrees)
- [`extend_mode`](#function-extend_mode)
- [`set_extend_mode`](#function-set_extend_mode)
- [`interpolation_space`](#function-interpolation_space)
- [`set_interpolation_space`](#function-set_interpolation_space)
- [`mapping_mode`](#function-mapping_mode)
- [`set_mapping_mode`](#function-set_mapping_mode)
- [`color_stops`](#function-color_stops)
- [`set_color_stops`](#function-set_color_stops)

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

### from_brush

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

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

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

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

### gradient_stops

```rust
fn gradient_stops(self: &Self) -> FerroList<Rc<dyn IGradientStop>>
```

The gradient stops. Mutations of the list itself are not tracked - assign
the property to ship in-place edits made after a commit. Stops created via
`Compositor::create_gradient_stop_with` stay live
on the server and animate individually; other stops are snapshotted at
serialization time.

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

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

### set_gradient_stops

```rust
fn set_gradient_stops(self: &Self, value: FerroList<Rc<dyn IGradientStop>>)
```



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

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

### spread_method

```rust
fn spread_method(self: &Self) -> GradientSpreadMethod
```

How the gradient repeats outside the stop range.

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

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

### set_spread_method

```rust
fn set_spread_method(self: &Self, value: GradientSpreadMethod)
```



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

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

### anchor_point

```rust
fn anchor_point(self: &Self) -> Vector
```

The point of the gradient, relative to the size of the painted area,
that is placed at `offset` (animatable as `AnchorPoint`).

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

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

### set_anchor_point

```rust
fn set_anchor_point(self: &Self, value: Vector)
```



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

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

### center_point

```rust
fn center_point(self: &Self) -> Vector
```

The point the gradient is scaled and rotated about, in the
coordinates of the painted area (animatable as `CenterPoint`).

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

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

### set_center_point

```rust
fn set_center_point(self: &Self, value: Vector)
```



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

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

### offset

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

The offset of the gradient (animatable as `Offset`).

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

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

### set_offset

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



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

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

### rotation_angle

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

The rotation of the gradient about its centre point, in radians
(animatable as `RotationAngle`).

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

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

### set_rotation_angle

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



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

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

### scale

```rust
fn scale(self: &Self) -> Vector
```

The scale of the gradient about its centre point (default `(1, 1)`;
animatable as `Scale`).

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

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

### set_scale

```rust
fn set_scale(self: &Self, value: Vector)
```



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

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

### transform_matrix

```rust
fn transform_matrix(self: &Self) -> Matrix
```

The transform matrix of the gradient (WinUI `Matrix3x2`; animatable
as `TransformMatrix`).

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

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

### set_transform_matrix

```rust
fn set_transform_matrix(self: &Self, value: Matrix)
```



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

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

### rotation_angle_in_degrees

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

The rotation in degrees: a view of
`rotation_angle` (not an animation target).

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

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

### set_rotation_angle_in_degrees

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



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

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

### extend_mode

```rust
fn extend_mode(self: &Self) -> CompositionGradientExtendMode
```

How the gradient continues outside its stops: a view of
`spread_method` (`Clamp` is `Pad`, `Wrap` is
`Repeat`, `Mirror` is `Reflect`).

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

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

### set_extend_mode

```rust
fn set_extend_mode(self: &Self, value: CompositionGradientExtendMode)
```



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

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

### interpolation_space

```rust
fn interpolation_space(self: &Self) -> CompositionColorSpace
```

The colour space the stops are interpolated in.

Deviation (winui-composition.md): stored only; the drawing contexts
interpolate in RGB.

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

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

### set_interpolation_space

```rust
fn set_interpolation_space(self: &Self, value: CompositionColorSpace)
```



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

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

### mapping_mode

```rust
fn mapping_mode(self: &Self) -> CompositionMappingMode
```

How the points of the WinUI members are measured (default
`Relative`). Changing it keeps the numbers of the points and changes
their unit, as WinUI reads the same numbers in the new mode.

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

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

### set_mapping_mode

```rust
fn set_mapping_mode(self: &Self, value: CompositionMappingMode)
```



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

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

### color_stops

```rust
fn color_stops(self: &Self) -> FerroList<Rc<dyn IGradientStop>>
```

`ColorStops`: the WinUI name of
`gradient_stops`, with the same rule: a change
of the list itself is shipped when the list is assigned again
(`set_color_stops`).

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

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

### set_color_stops

```rust
fn set_color_stops(self: &Self, value: FerroList<Rc<dyn IGradientStop>>)
```



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

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