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§
Sourcefn draw(self: Box<Self>, ctx: &mut WgpuDrawContext<'_>)
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
impl<'b> CotisRenderer<Box<dyn WgpuDrawable + 'b>> for CotisWgpuRenderer
fn draw_frame( &mut self, render_commands: impl Iterator<Item = Box<dyn WgpuDrawable + 'b>>, )
Source§impl<'b> CotisRendererAsync<Box<dyn WgpuDrawable + 'b>> for CotisWgpuRenderer
impl<'b> CotisRendererAsync<Box<dyn WgpuDrawable + 'b>> for CotisWgpuRenderer
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.
impl WgpuDrawable for ClipEnd
Deactivates the text scissor region opened by ClipStart.
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.
impl<'a, ExtraData> WgpuDrawable for Border<'a, ExtraData>
Draws a rounded border outline at the command’s bounding box.
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.
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.
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.
impl<'a, ExtraData> WgpuDrawable for Rectangle<'a, ExtraData>
Draws a filled rounded rectangle at the command’s bounding box.
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.
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.
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.
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.
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.
impl<T: WgpuDrawable, L: IsRenderList + WgpuDrawable> WgpuDrawable for RenderTList<T, L>
Draws a nested RenderTList command and its tail list recursively.
fn draw(self: Box<Self>, ctx: &mut WgpuDrawContext<'_>)
Source§impl<T: WgpuDrawable> WgpuDrawable for RenderTList<T, ()>
Draws a single-command RenderTList (empty tail).
impl<T: WgpuDrawable> WgpuDrawable for RenderTList<T, ()>
Draws a single-command RenderTList (empty tail).