Skip to main content

WgpuDrawable

Trait WgpuDrawable 

Source
pub trait WgpuDrawable {
    // Required method
    fn draw(self: Box<Self>, ctx: &mut WgpuDrawContext<'_>);
}
Expand description

A render command that can be executed against the wgpu backend.

Commands are consumed as Box<Self> and executed during frame presentation. See crate::default_drawables for built-in implementations of standard cotis-defaults command types.

Required Methods§

Source

fn draw(self: Box<Self>, ctx: &mut WgpuDrawContext<'_>)

Executes this command against the given draw context.

Decrement ctx.depth after drawing if z-ordering relative to other commands matters.

Trait Implementations§

Source§

impl<'b> CotisRenderer<Box<dyn WgpuDrawable + 'b>> for CotisWgpuRenderer

Source§

fn draw_frame( &mut self, render_commands: impl Iterator<Item = Box<dyn WgpuDrawable + 'b>>, )

Source§

impl<'b> CotisRendererAsync<Box<dyn WgpuDrawable + 'b>> for CotisWgpuRenderer

Source§

async fn draw_frame( &mut self, render_commands: impl Iterator<Item = Box<dyn WgpuDrawable + 'b>>, )

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl WgpuDrawable for ClipEnd

Deactivates the text scissor region opened by ClipStart.

Source§

fn draw(self: Box<Self>, ctx: &mut WgpuDrawContext<'_>)

Source§

impl<'a, ExtraData> WgpuDrawable for Border<'a, ExtraData>

Draws a rounded border outline at the command’s bounding box.

Source§

fn draw(self: Box<Self>, ctx: &mut WgpuDrawContext<'_>)

Source§

impl<'a, ExtraData> WgpuDrawable for ClipStart<'a, ExtraData>

Activates a text scissor region for subsequent Text commands.

Scissor affects glyphon text bounds only, not the geometry shader.

Source§

fn draw(self: Box<Self>, ctx: &mut WgpuDrawContext<'_>)

Source§

impl<'a, ExtraData> WgpuDrawable for Rectangle<'a, ExtraData>

Draws a filled rounded rectangle at the command’s bounding box.

Source§

fn draw(self: Box<Self>, ctx: &mut WgpuDrawContext<'_>)

Source§

impl<'a, ExtraData> WgpuDrawable for Text<'a, ExtraData>

Queues glyphon text at the command’s bounding box origin.

Font size and line height are multiplied by ctx.dpi_scale. font_id from the layout pipe is not used — all text renders with glyphon Family::SansSerif.

Source§

fn draw(self: Box<Self>, ctx: &mut WgpuDrawContext<'_>)

Source§

impl<'a, ImageElementData, ExtraData> WgpuDrawable for Image<'a, ImageElementData, ExtraData>

Draws a filled rectangle placeholder for an image command.

Texture loading is not implemented; only background_color is rendered.

Source§

fn draw(self: Box<Self>, ctx: &mut WgpuDrawContext<'_>)

Source§

impl<T: WgpuDrawable, L: IsRenderList + WgpuDrawable> WgpuDrawable for RenderTList<T, L>

Draws a nested RenderTList command and its tail list recursively.

Source§

fn draw(self: Box<Self>, ctx: &mut WgpuDrawContext<'_>)

Source§

impl<T: WgpuDrawable> WgpuDrawable for RenderTList<T, ()>

Draws a single-command RenderTList (empty tail).

Source§

fn draw(self: Box<Self>, ctx: &mut WgpuDrawContext<'_>)

Implementors§