Skip to main content

SpriteVisual

Struct SpriteVisual 

Source
pub struct SpriteVisual { /* private fields */ }
Expand description

Visual that paints its bounds with a Brush and can host child visuals.

Implementations§

Source§

impl SpriteVisual

Source

pub fn set_brush(&self, brush: &impl Brush)

Sets the brush that fills the visual’s bounds.

Methods from Deref<Target = ContainerVisual>§

Source

pub fn children(&self) -> VisualCollection

Returns the collection of child visuals.

Methods from Deref<Target = Visual>§

Source

pub fn set_offset(&self, x: f32, y: f32, z: f32)

Sets the visual’s offset from its parent, in DIPs.

Source

pub fn offset(&self) -> Vector3

Returns the visual’s offset from its parent.

Source

pub fn set_size(&self, width: f32, height: f32)

Sets the visual’s size, in DIPs.

Source

pub fn size(&self) -> Vector2

Returns the visual’s size.

Source

pub fn set_opacity(&self, opacity: f32)

Sets the visual’s opacity in the range 0.0..=1.0.

Source

pub fn opacity(&self) -> f32

Returns the visual’s opacity.

Source

pub fn set_visible(&self, visible: bool)

Sets whether the visual (and its subtree) is rendered.

Source

pub fn is_visible(&self) -> bool

Returns whether the visual is visible.

Source

pub fn set_scale(&self, scale: Vector3)

Sets the visual’s scale factor about its center point.

Source

pub fn scale(&self) -> Vector3

Returns the visual’s current scale factor.

Source

pub fn set_center_point(&self, point: Vector3)

Sets the point, in DIPs, about which rotation and scaling are applied.

Source

pub fn set_anchor_point(&self, point: Vector2)

Sets the normalized anchor point (0.0..=1.0 per axis) that the visual’s offset positions.

Source

pub fn set_border_mode(&self, mode: BorderMode)

Sets how the visual’s edges are rendered.

Source

pub fn parent(&self) -> Option<ContainerVisual>

Returns the visual’s parent container, if it has one.

Source

pub fn set_relative_size_adjustment(&self, adjustment: Vector2)

Sets the visual’s size as a fraction of its parent’s size (per axis).

Source

pub fn set_relative_offset_adjustment(&self, adjustment: Vector3)

Sets an offset expressed as a fraction of the parent’s size (per axis).

Source

pub fn set_parent_for_transform(&self, parent: &Self)

Sets the visual whose coordinate space this visual’s transform is relative to.

Source

pub fn compositor(&self) -> Compositor

Returns the compositor that created this visual.

Source

pub fn start_animation(&self, property: &str, animation: &impl Animation)

Starts an animation on the named property (for example "Scale").

Source

pub fn set_implicit_animations( &self, animations: Option<&ImplicitAnimationCollection>, )

Attaches (or, with None, clears) the ImplicitAnimationCollection that animates this visual’s properties automatically when they change.

Trait Implementations§

Source§

impl Clone for SpriteVisual

Source§

fn clone(&self) -> SpriteVisual

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 SpriteVisual

Source§

type Target = ContainerVisual

The resulting type after dereferencing.
Source§

fn deref(&self) -> &ContainerVisual

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> 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.