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
impl Layer
pub fn new( name: String, w: u32, h: u32, event_handler: Option<Box<dyn EventHandler>>, ) -> Self
pub fn init_buffers(&mut self, device: &Device)
pub fn set_color(&mut self, r: f32, g: f32, b: f32)
pub fn set_text(&mut self, text: &str, device: &Device, queue: &Queue)
Sourcepub fn set_image(&mut self, path: String)
pub fn set_image(&mut self, path: String)
Set image path (for backward compatibility - actual texture loading requires wgpu context)
Sourcepub fn load_image_texture(&mut self, device: &Device, queue: &Queue)
pub fn load_image_texture(&mut self, device: &Device, queue: &Queue)
Load image with wgpu context
pub fn set_layout(&mut self, layout: Option<Box<dyn Layout>>)
pub fn set_animation(&mut self, animation: Option<Animation>)
pub fn set_style(&mut self, style: Style)
pub fn set_visible(&mut self, visible: bool)
pub fn animate(&mut self)
pub fn select_next_sub_layer(&mut self)
pub fn select_prev_sub_layer(&mut self)
pub fn set_focus(&mut self, focused: bool)
pub fn handle_input(&mut self, key: Key)
pub fn layout_sub_layers( &mut self, parent_layer: Option<&Layer>, stretch: &mut Option<Stretch>, )
pub fn update_layout(&mut self, stretch: &mut Option<Stretch>)
pub fn finalize_layout(&mut self)
pub fn model_matrix(&self) -> Matrix4<f32>
pub fn render( &mut self, parent_model_matrix: Option<&Matrix4<f32>>, projection: &Matrix4<f32>, )
pub fn add_sub_layer(&mut self, layer: Layer)
Sourcepub fn set_position(&mut self, x: i32, y: i32)
pub fn set_position(&mut self, x: i32, y: i32)
Set position (CoreAnimation-style API)
Sourcepub fn set_bounds(&mut self, width: u32, height: u32)
pub fn set_bounds(&mut self, width: u32, height: u32)
Set bounds (CoreAnimation-style API)
Sourcepub fn set_opacity(&mut self, opacity: f32)
pub fn set_opacity(&mut self, opacity: f32)
Set opacity (CoreAnimation-style API)
Sourcepub fn set_background_color(&mut self, r: f32, g: f32, b: f32)
pub fn set_background_color(&mut self, r: f32, g: f32, b: f32)
Set background color (CoreAnimation-style API)
Sourcepub fn background_color(&self) -> (f32, f32, f32)
pub fn background_color(&self) -> (f32, f32, f32)
Get background color (CoreAnimation-style API)
Sourcepub fn add_animation(&mut self, animation: Animation, key: Option<&str>)
pub fn add_animation(&mut self, animation: Animation, key: Option<&str>)
Add an animation for a specific key (CoreAnimation-style API)
Sourcepub fn remove_all_animations(&mut self)
pub fn remove_all_animations(&mut self)
Remove all animations (CoreAnimation-style API)
Sourcepub fn remove_animation(&mut self, key: &str)
pub fn remove_animation(&mut self, key: &str)
Remove animation for a specific key (CoreAnimation-style API)
Sourcepub fn add_sublayer(&mut self, layer: Layer)
pub fn add_sublayer(&mut self, layer: Layer)
Add a sublayer (CoreAnimation-style API, alias for add_sub_layer)
Sourcepub fn sublayers_mut(&mut self) -> &mut Vec<Layer>
pub fn sublayers_mut(&mut self) -> &mut Vec<Layer>
Get mutable sublayers (CoreAnimation-style API)
Sourcepub fn create_uniform_buffer(
&self,
device: &Device,
transform: &Matrix4<f32>,
projection: &Matrix4<f32>,
) -> Buffer
pub fn create_uniform_buffer( &self, device: &Device, transform: &Matrix4<f32>, projection: &Matrix4<f32>, ) -> Buffer
Create uniform buffer with transform matrix and color
Sourcepub fn get_or_create_bind_group(
&mut self,
device: &Device,
layout: &BindGroupLayout,
sampler: &Sampler,
default_texture_view: &TextureView,
) -> &BindGroup
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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