/// Draws text into a specified target, with a given transform and optional clipping rectangle.
///
/// Call this as least times as possible, batching text into arrays of [TextDraw] as much as is practicable.
Draws text into a specified target, with a given transform and optional clipping rectangle.
Call this as least times as possible, batching text into arrays of [TextDraw] as much as is practicable.
Draws text into a specified target with a given transform and optional clipping rectangle . Call this as least times as possible batching text into arrays of [ TextDraw ] as much as is practicable .
pub fn draw(
        &mut self,
        cx: &Context,
        font: &mut FontBrush,
        draws: &[TextDraw],
        frame: &mut Frame,
        target: &wgpu::TextureView,
        depth_stencil: wgpu::RenderPassDepthStencilAttachment,
        transform: glam::Mat4,
        clip: Option<Rect>,
    ) -> Result<()> {
        for draw in draws {
            self.queue(font, draw);
        }
        let transform = transform.to_cols_array();
        if let Some(clip) = clip {
            font.brush
                .draw_queued_with_transform_and_scissoring(
                    &cx.device,
                    &mut self.staging_belt,
                    &mut frame.cmd,
                    target,
                    depth_stencil,
                    transform,
                    wgpu_glyph::Region {
                        x: clip.origin.x as _,
                        y: clip.origin.y as _,
                        width: clip.size.x as _,
                        height: clip.size.y as _,
                    },
                )
                .map_err(|s| Error::TextDraw(s))?;
        } else {
            font.brush
                .draw_queued_with_transform(
                    &cx.device,
                    &mut self.staging_belt,
                    &mut frame.cmd,
                    target,
                    depth_stencil,
                    transform,
                )
                .map_err(|s| Error::TextDraw(s))?;
        }
        Ok(())
    }
pub fn draw ( & mut self , cx : & Context , font : & mut FontBrush , draws : & [ TextDraw ] , frame : & mut Frame , target : & wgpu :: TextureView , depth_stencil : wgpu :: RenderPassDepthStencilAttachment , transform : glam :: Mat4 , clip : Option < Rect > , ) -> Result < ( ) > { for draw in draws { self . queue ( font , draw ) ; } let transform = transform . to_cols_array ( ) ; if let Some ( clip ) = clip { font . brush . draw_queued_with_transform_and_scissoring ( & cx . device , & mut self . staging_belt , & mut frame . cmd , target , depth_stencil , transform , wgpu_glyph :: Region { x : clip . origin . x as _ , y : clip . origin . y as _ , width : clip . size . x as _ , height : clip . size . y as _ , } , ) . map_err ( | s | Error :: TextDraw ( s ) ) ? ; } else { font . brush . draw_queued_with_transform ( & cx . device , & mut self . staging_belt , & mut frame . cmd , target , depth_stencil , transform , ) . map_err ( | s | Error :: TextDraw ( s ) ) ? ; } Ok ( ( ) ) }
Draws text into a specified target, with a given transform and optional clipping rectangle.
Draws text into a specified target with a given transform and optional clipping rectangle .
&mut self
cx
&Context
font
&mut FontBrush
draws
&[TextDraw]
frame
&mut Frame
target
&wgpu::TextureView
depth_stencil
wgpu::RenderPassDepthStencilAttachment
transform
glam::Mat4
clip
Option<Rect>