Skip to main content

CompositionSpriteShape

Struct CompositionSpriteShape 

Source
pub struct CompositionSpriteShape(/* private fields */);
Expand description

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.

Implementations§

Source§

impl CompositionSpriteShape

Source

pub fn from_shape( shape: &Rc<CompositionShape>, ) -> Option<CompositionSpriteShape>

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

Source

pub fn shape(&self) -> &Rc<CompositionShape>

The shape as a CompositionShape.

Source

pub fn fill_brush(&self) -> Option<Rc<CompositionBrush>>

The brush the geometry is filled with.

Source

pub fn set_fill_brush(&self, value: Option<Rc<CompositionBrush>>)

Source

pub fn geometry(&self) -> Option<Rc<CompositionGeometry>>

The geometry the shape draws.

Source

pub fn set_geometry(&self, value: Option<Rc<CompositionGeometry>>)

Source

pub fn is_stroke_non_scaling(&self) -> bool

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

Source

pub fn set_is_stroke_non_scaling(&self, value: bool)

Source

pub fn stroke_brush(&self) -> Option<Rc<CompositionBrush>>

The brush the outline is stroked with.

Source

pub fn set_stroke_brush(&self, value: Option<Rc<CompositionBrush>>)

Source

pub fn stroke_dash_array(&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

pub fn set_stroke_dash_array(&self, value: Vec<f32>)

Source

pub fn stroke_dash_cap(&self) -> CompositionStrokeCap

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

Source

pub fn set_stroke_dash_cap(&self, value: CompositionStrokeCap)

Source

pub fn stroke_dash_offset(&self) -> f32

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

Source

pub fn set_stroke_dash_offset(&self, value: f32)

Source

pub fn stroke_end_cap(&self) -> CompositionStrokeCap

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

Source

pub fn set_stroke_end_cap(&self, value: CompositionStrokeCap)

Source

pub fn stroke_line_join(&self) -> CompositionStrokeLineJoin

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

Source

pub fn set_stroke_line_join(&self, value: CompositionStrokeLineJoin)

Source

pub fn stroke_miter_limit(&self) -> f32

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

Source

pub fn set_stroke_miter_limit(&self, value: f32)

Source

pub fn stroke_start_cap(&self) -> CompositionStrokeCap

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

Source

pub fn set_stroke_start_cap(&self, value: CompositionStrokeCap)

Source

pub fn stroke_thickness(&self) -> f32

The thickness of the stroke (default 1).

Source

pub fn set_stroke_thickness(&self, value: f32)

Trait Implementations§

Source§

impl Clone for CompositionSpriteShape

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Deref for CompositionSpriteShape

Source§

type Target = Rc<CompositionShape>

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Rc<CompositionShape>

Dereferences the value.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> ClassDefaults for T
where T: ?Sized,

Source§

fn static_constructor()

The static constructor of a type: work done once per thread, after the properties of the type are registered and before its first instance exists (class handlers, affects_render, metadata overrides). Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.