Skip to main content

Layer

Struct Layer 

Source
pub struct Layer {
Show 20 fields pub name: String, pub x: i32, pub y: i32, pub z: f32, pub width: u32, pub height: u32, pub anchor_x: f32, pub anchor_y: f32, pub scale_x: f32, pub scale_y: f32, pub rotation: i32, pub visible: bool, pub opacity: f32, pub image_path: String, pub sub_layer_list: Vec<Layer>, pub animated: bool, pub animation: Option<Animation>, pub needs_update: bool, pub node: Option<Node>, pub style: Option<Style>, /* private fields */
}

Fields§

§name: String§x: i32§y: i32§z: f32§width: u32§height: u32§anchor_x: f32§anchor_y: f32§scale_x: f32§scale_y: f32§rotation: i32§visible: bool§opacity: f32§image_path: String§sub_layer_list: Vec<Layer>§animated: bool§animation: Option<Animation>§needs_update: bool§node: Option<Node>§style: Option<Style>

Implementations§

Source§

impl Layer

Source

pub fn new( name: String, w: u32, h: u32, event_handler: Option<Box<dyn EventHandler>>, ) -> Self

Source

pub fn init_buffers(&mut self, device: &Device)

Source

pub fn set_color(&mut self, r: f32, g: f32, b: f32)

Source

pub fn set_text(&mut self, text: &str, device: &Device, queue: &Queue)

Source

pub fn set_image(&mut self, path: String)

Set image path (for backward compatibility - actual texture loading requires wgpu context)

Source

pub fn load_image_texture(&mut self, device: &Device, queue: &Queue)

Load image with wgpu context

Source

pub fn set_layout(&mut self, layout: Option<Box<dyn Layout>>)

Source

pub fn set_animation(&mut self, animation: Option<Animation>)

Source

pub fn set_style(&mut self, style: Style)

Source

pub fn set_visible(&mut self, visible: bool)

Source

pub fn animate(&mut self)

Source

pub fn select_next_sub_layer(&mut self)

Source

pub fn select_prev_sub_layer(&mut self)

Source

pub fn set_focus(&mut self, focused: bool)

Source

pub fn handle_input(&mut self, key: Key)

Source

pub fn layout_sub_layers( &mut self, parent_layer: Option<&Layer>, stretch: &mut Option<Stretch>, )

Source

pub fn update_layout(&mut self, stretch: &mut Option<Stretch>)

Source

pub fn finalize_layout(&mut self)

Source

pub fn model_matrix(&self) -> Matrix4<f32>

Source

pub fn render( &mut self, parent_model_matrix: Option<&Matrix4<f32>>, projection: &Matrix4<f32>, )

Source

pub fn add_sub_layer(&mut self, layer: Layer)

Source

pub fn set_position(&mut self, x: i32, y: i32)

Set position (CoreAnimation-style API)

Source

pub fn position(&self) -> (i32, i32)

Get position as tuple (CoreAnimation-style API)

Source

pub fn set_bounds(&mut self, width: u32, height: u32)

Set bounds (CoreAnimation-style API)

Source

pub fn bounds(&self) -> (u32, u32)

Get bounds as tuple (CoreAnimation-style API)

Source

pub fn set_opacity(&mut self, opacity: f32)

Set opacity (CoreAnimation-style API)

Source

pub fn set_background_color(&mut self, r: f32, g: f32, b: f32)

Set background color (CoreAnimation-style API)

Source

pub fn background_color(&self) -> (f32, f32, f32)

Get background color (CoreAnimation-style API)

Source

pub fn add_animation(&mut self, animation: Animation, key: Option<&str>)

Add an animation for a specific key (CoreAnimation-style API)

Source

pub fn remove_all_animations(&mut self)

Remove all animations (CoreAnimation-style API)

Source

pub fn remove_animation(&mut self, key: &str)

Remove animation for a specific key (CoreAnimation-style API)

Source

pub fn add_sublayer(&mut self, layer: Layer)

Add a sublayer (CoreAnimation-style API, alias for add_sub_layer)

Source

pub fn sublayers(&self) -> &Vec<Layer>

Get sublayers (CoreAnimation-style API)

Source

pub fn sublayers_mut(&mut self) -> &mut Vec<Layer>

Get mutable sublayers (CoreAnimation-style API)

Source

pub fn create_uniform_buffer( &self, device: &Device, transform: &Matrix4<f32>, projection: &Matrix4<f32>, ) -> Buffer

Create uniform buffer with transform matrix and color

Source

pub fn get_or_create_bind_group( &mut self, device: &Device, layout: &BindGroupLayout, sampler: &Sampler, default_texture_view: &TextureView, ) -> &BindGroup

Get or create texture bind group

Auto Trait Implementations§

§

impl !Freeze for Layer

§

impl !RefUnwindSafe for Layer

§

impl !Send for Layer

§

impl !Sync for Layer

§

impl Unpin for Layer

§

impl !UnwindSafe for Layer

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> Downcast<T> for T

Source§

fn downcast(&self) -> &T

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<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>