# CompositionSpriteShape

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

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

```rust
struct CompositionSpriteShape
```

A shape that fills and strokes a geometry (WinUI
`Microsoft.UI.Composition.CompositionSpriteShape`).

The fill and the stroke are composition brushes: the colour and gradient
brushes are brushes of the drawing context, a
`CompositionSurfaceBrush` is painted
inside the geometry (the fill) or inside the widened outline (the
stroke). `StrokeThickness`, `StrokeDashOffset` and `StrokeMiterLimit` are
animatable.

Deviation (winui-composition.md): the platform pen has one line cap, so
`stroke_start_cap` caps both ends of the stroke and the dashes;
`stroke_end_cap` and `stroke_dash_cap` are stored only. A non-scaling
stroke divides the thickness by the scale of the transforms of the shape
(the square root of the determinant), which is exact for a uniform scale
only.

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

## Members

- [`from_shape`](#function-from_shape)
- [`shape`](#function-shape)
- [`fill_brush`](#function-fill_brush)
- [`set_fill_brush`](#function-set_fill_brush)
- [`geometry`](#function-geometry)
- [`set_geometry`](#function-set_geometry)
- [`is_stroke_non_scaling`](#function-is_stroke_non_scaling)
- [`set_is_stroke_non_scaling`](#function-set_is_stroke_non_scaling)
- [`stroke_brush`](#function-stroke_brush)
- [`set_stroke_brush`](#function-set_stroke_brush)
- [`stroke_dash_array`](#function-stroke_dash_array)
- [`set_stroke_dash_array`](#function-set_stroke_dash_array)
- [`stroke_dash_cap`](#function-stroke_dash_cap)
- [`set_stroke_dash_cap`](#function-set_stroke_dash_cap)
- [`stroke_dash_offset`](#function-stroke_dash_offset)
- [`set_stroke_dash_offset`](#function-set_stroke_dash_offset)
- [`stroke_end_cap`](#function-stroke_end_cap)
- [`set_stroke_end_cap`](#function-set_stroke_end_cap)
- [`stroke_line_join`](#function-stroke_line_join)
- [`set_stroke_line_join`](#function-set_stroke_line_join)
- [`stroke_miter_limit`](#function-stroke_miter_limit)
- [`set_stroke_miter_limit`](#function-set_stroke_miter_limit)
- [`stroke_start_cap`](#function-stroke_start_cap)
- [`set_stroke_start_cap`](#function-set_stroke_start_cap)
- [`stroke_thickness`](#function-stroke_thickness)
- [`set_stroke_thickness`](#function-set_stroke_thickness)

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

### from_shape

```rust
fn from_shape(shape: &Rc<CompositionShape>) -> Option<CompositionSpriteShape>
```

The handle of `shape` as a sprite shape, if it is one.

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

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

### shape

```rust
fn shape(self: &Self) -> &Rc<CompositionShape>
```

The shape as a `CompositionShape`.

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

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

### fill_brush

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

The brush the geometry is filled with.

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

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

### set_fill_brush

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



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

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

### geometry

```rust
fn geometry(self: &Self) -> Option<Rc<CompositionGeometry>>
```

The geometry the shape draws.

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

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

### set_geometry

```rust
fn set_geometry(self: &Self, value: Option<Rc<CompositionGeometry>>)
```



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

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

### is_stroke_non_scaling

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

Whether the thickness of the stroke ignores the transforms of the
shape (and of the view box).

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

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

### set_is_stroke_non_scaling

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



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

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

### stroke_brush

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

The brush the outline is stroked with.

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

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

### set_stroke_brush

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



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

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

### stroke_dash_array

```rust
fn stroke_dash_array(self: &Self) -> Vec<f32>
```

The lengths of the dashes and gaps of the stroke, in multiples of the
stroke thickness (WinUI `CompositionStrokeDashArray`); empty for a
solid stroke.

Deviation (winui-composition.md): a plain list of values, replaced as a
whole, not a `CompositionObject` of its own.

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

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

### set_stroke_dash_array

```rust
fn set_stroke_dash_array(self: &Self, value: Vec<f32>)
```



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

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

### stroke_dash_cap

```rust
fn stroke_dash_cap(self: &Self) -> CompositionStrokeCap
```

The cap of the ends of the dashes (stored only, see the type).

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

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

### set_stroke_dash_cap

```rust
fn set_stroke_dash_cap(self: &Self, value: CompositionStrokeCap)
```



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

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

### stroke_dash_offset

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

How far into the dash pattern the stroke starts, in multiples of the
stroke thickness.

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

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

### set_stroke_dash_offset

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



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

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

### stroke_end_cap

```rust
fn stroke_end_cap(self: &Self) -> CompositionStrokeCap
```

The cap of the end of the stroke (stored only, see the type).

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

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

### set_stroke_end_cap

```rust
fn set_stroke_end_cap(self: &Self, value: CompositionStrokeCap)
```



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

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

### stroke_line_join

```rust
fn stroke_line_join(self: &Self) -> CompositionStrokeLineJoin
```

How the segments of the stroke are joined (default `Miter`).

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

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

### set_stroke_line_join

```rust
fn set_stroke_line_join(self: &Self, value: CompositionStrokeLineJoin)
```



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

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

### stroke_miter_limit

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

The limit of the ratio of the miter length to half the thickness
(default 2).

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

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

### set_stroke_miter_limit

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



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

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

### stroke_start_cap

```rust
fn stroke_start_cap(self: &Self) -> CompositionStrokeCap
```

The cap of the start of the stroke; the platform pen caps both ends
and the dashes with it.

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

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

### set_stroke_start_cap

```rust
fn set_stroke_start_cap(self: &Self, value: CompositionStrokeCap)
```



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

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

### stroke_thickness

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

The thickness of the stroke (default 1).

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

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

### set_stroke_thickness

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



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

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