Trait DrawCommand

Source
pub trait DrawCommand:
    AsAny
    + Send
    + Sync {
    // Provided method
    fn barrier(&self) -> Option<BarrierRequirement> { ... }
}
Expand description

Trait for graphics rendering commands that can be processed by draw pipelines.

Implement this trait for structs that represent graphics operations such as shape drawing, text rendering, image display, or custom visual effects.

§Example

use tessera_ui::{BarrierRequirement, DrawCommand};

struct RectangleCommand {
    color: [f32; 4],
    corner_radius: f32,
}

impl DrawCommand for RectangleCommand {
    // Most commands don't need barriers
    fn barrier(&self) -> Option<BarrierRequirement> {
        None
    }
}

Provided Methods§

Source

fn barrier(&self) -> Option<BarrierRequirement>

Specifies barrier requirements for this draw operation.

Return Some(BarrierRequirement::SampleBackground) if your command needs to sample from previously rendered content (e.g., for blur effects or other post-processing operations).

§Returns
  • None for standard rendering operations (default)
  • Some(BarrierRequirement::SampleBackground) for operations that sample previous content

Implementors§