pub struct GridCompositor { /* private fields */ }Expand description
Grid compositor managing block ownership.
The compositor ensures:
- No two blocks claim the same cell
- Blocks are rendered in z-order
- Dirty regions are tracked for efficient redraw
Implementations§
Source§impl GridCompositor
impl GridCompositor
Sourcepub fn new(template: GridTemplate) -> Self
pub fn new(template: GridTemplate) -> Self
Create a new compositor with the given template.
Sourcepub fn template(&self) -> &GridTemplate
pub fn template(&self) -> &GridTemplate
Get the grid template.
Sourcepub fn register(
&mut self,
block: ComputeBlock,
) -> Result<usize, CompositorError>
pub fn register( &mut self, block: ComputeBlock, ) -> Result<usize, CompositorError>
Register a block, claiming grid cells.
Returns the block index on success, or an error if:
- The block area is out of grid bounds
- The block overlaps with an existing block
Sourcepub fn unregister(
&mut self,
name: &str,
) -> Result<ComputeBlock, CompositorError>
pub fn unregister( &mut self, name: &str, ) -> Result<ComputeBlock, CompositorError>
Unregister a block by name, freeing its cells.
Sourcepub fn get(&self, name: &str) -> Option<&ComputeBlock>
pub fn get(&self, name: &str) -> Option<&ComputeBlock>
Get a block by name.
Sourcepub fn get_mut(&mut self, name: &str) -> Option<&mut ComputeBlock>
pub fn get_mut(&mut self, name: &str) -> Option<&mut ComputeBlock>
Get a mutable block by name.
Sourcepub fn bounds(&self, name: &str, total_area: Rect) -> Option<Rect>
pub fn bounds(&self, name: &str, total_area: Rect) -> Option<Rect>
Get computed bounds for a block.
Sourcepub fn blocks(&self) -> &[ComputeBlock]
pub fn blocks(&self) -> &[ComputeBlock]
Get all registered blocks.
Sourcepub fn mark_dirty(&mut self, rect: Rect)
pub fn mark_dirty(&mut self, rect: Rect)
Mark a region as dirty (needs redraw).
Sourcepub fn take_dirty(&mut self) -> Vec<Rect>
pub fn take_dirty(&mut self) -> Vec<Rect>
Clear dirty rectangles and return them.
Sourcepub fn render_order(&self) -> Vec<&ComputeBlock>
pub fn render_order(&self) -> Vec<&ComputeBlock>
Get blocks sorted by z-index for rendering.
Trait Implementations§
Source§impl Clone for GridCompositor
impl Clone for GridCompositor
Source§fn clone(&self) -> GridCompositor
fn clone(&self) -> GridCompositor
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for GridCompositor
impl RefUnwindSafe for GridCompositor
impl Send for GridCompositor
impl Sync for GridCompositor
impl Unpin for GridCompositor
impl UnwindSafe for GridCompositor
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