pub struct Compositor { /* private fields */ }Expand description
The compositor collects widget layers and resolves overlapping regions.
Implementations§
Source§impl Compositor
impl Compositor
Sourcepub fn new(width: u16, height: u16) -> Self
pub fn new(width: u16, height: u16) -> Self
Creates a new compositor with the given screen dimensions.
Sourcepub fn add_widget(
&mut self,
widget_id: u64,
region: Rect,
z_index: i32,
lines: Vec<Vec<Segment>>,
)
pub fn add_widget( &mut self, widget_id: u64, region: Rect, z_index: i32, lines: Vec<Vec<Segment>>, )
Convenience method that creates and adds a layer.
Creates a new layer from the given parameters and adds it to the stack.
Sourcepub fn layer_count(&self) -> usize
pub fn layer_count(&self) -> usize
Returns the number of layers in the compositor.
Sourcepub fn screen_size(&self) -> Size
pub fn screen_size(&self) -> Size
Returns the screen size.
Sourcepub fn resize(&mut self, width: u16, height: u16)
pub fn resize(&mut self, width: u16, height: u16)
Resizes the compositor screen dimensions.
Clears all layers since they may no longer be valid for the new size.
Sourcepub fn compose(&self, buf: &mut ScreenBuffer)
pub fn compose(&self, buf: &mut ScreenBuffer)
Compose all layers and write the result to the screen buffer.
Processes each row by calling compose_line to resolve overlapping
layers, then writes the resulting segments as cells to the buffer.
Auto Trait Implementations§
impl Freeze for Compositor
impl RefUnwindSafe for Compositor
impl Send for Compositor
impl Sync for Compositor
impl Unpin for Compositor
impl UnwindSafe for Compositor
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