pub struct Renderer { /* private fields */ }Implementations§
Source§impl Renderer
impl Renderer
pub fn new(engine: Engine, settings: Settings) -> Self
Sourcepub fn draw(
&mut self,
clear_color: Option<Color>,
target: &TextureView,
viewport: &Viewport,
) -> CommandEncoder
pub fn draw( &mut self, clear_color: Option<Color>, target: &TextureView, viewport: &Viewport, ) -> CommandEncoder
Record commands that draw the current primitives to the target texture view.
You must call finish and recall when submitting
the resulting wgpu::CommandEncoder.
pub fn present( &mut self, clear_color: Option<Color>, _format: TextureFormat, frame: &TextureView, viewport: &Viewport, ) -> SubmissionIndex
Sourcepub fn screenshot(
&mut self,
viewport: &Viewport,
background_color: Color,
) -> Vec<u8> ⓘ
pub fn screenshot( &mut self, viewport: &Viewport, background_color: Color, ) -> Vec<u8> ⓘ
Renders the current surface to an offscreen buffer.
Returns RGBA bytes of the texture data.
Sourcepub fn finish(&mut self)
pub fn finish(&mut self)
Prepares currently mapped buffers for use in a submission.
Usually, this method is only needed if you are calling Renderer::draw directly,
instead of relying on Renderer::present.
You must call this method before submitting the resulting wgpu::CommandEncoder
of Renderer::draw to a wgpu::Queue.
Sourcepub fn recall(&mut self)
pub fn recall(&mut self)
Recalls all of the closed buffers back to be reused.
Usually, this method is only needed if you are calling Renderer::draw directly,
instead of relying on Renderer::present to a wgpu::Queue.
You must call this method after submitting the resulting wgpu::CommandEncoder
of Renderer::draw to a wgpu::Queue.
Trait Implementations§
Source§impl Default for Renderer
impl Default for Renderer
Source§type Compositor = Compositor
type Compositor = Compositor
Source§impl Headless for Renderer
impl Headless for Renderer
Source§impl Renderer for Renderer
impl Renderer for Renderer
Source§fn start_layer(&mut self, bounds: Rectangle)
fn start_layer(&mut self, bounds: Rectangle)
Source§fn start_transformation(&mut self, transformation: Transformation)
fn start_transformation(&mut self, transformation: Transformation)
Transformation.Source§fn end_transformation(&mut self)
fn end_transformation(&mut self)
Source§fn fill_quad(&mut self, quad: Quad, background: impl Into<Background>)
fn fill_quad(&mut self, quad: Quad, background: impl Into<Background>)
Quad with the provided Background.Source§fn allocate_image(
&mut self,
_handle: &Handle,
_callback: impl FnOnce(Result<Allocation, Error>) + Send + 'static,
)
fn allocate_image( &mut self, _handle: &Handle, _callback: impl FnOnce(Result<Allocation, Error>) + Send + 'static, )
image::Allocation for the given image::Handle and calls the given callback with it.Source§fn reset(&mut self, new_bounds: Rectangle)
fn reset(&mut self, new_bounds: Rectangle)
Renderer to start drawing in the new_bounds from scratch.Source§fn with_layer(&mut self, bounds: Rectangle, f: impl FnOnce(&mut Self))
fn with_layer(&mut self, bounds: Rectangle, f: impl FnOnce(&mut Self))
Source§fn with_transformation(
&mut self,
transformation: Transformation,
f: impl FnOnce(&mut Self),
)
fn with_transformation( &mut self, transformation: Transformation, f: impl FnOnce(&mut Self), )
Transformation to the primitives recorded in the given closure.Source§fn with_translation(&mut self, translation: Vector, f: impl FnOnce(&mut Self))
fn with_translation(&mut self, translation: Vector, f: impl FnOnce(&mut Self))
Source§impl Renderer for Renderer
impl Renderer for Renderer
Source§const CHECKMARK_ICON: char = '\u{f00c}'
const CHECKMARK_ICON: char = '\u{f00c}'
char representing a ✔ icon in the ICON_FONT.Source§const ARROW_DOWN_ICON: char = '\u{e800}'
const ARROW_DOWN_ICON: char = '\u{e800}'
char representing a ▼ icon in the built-in ICON_FONT.Source§const ICED_LOGO: char = '\u{e801}'
const ICED_LOGO: char = '\u{e801}'
Source§const SCROLL_UP_ICON: char = '\u{e802}'
const SCROLL_UP_ICON: char = '\u{e802}'
char representing a ^ icon in the built-in ICON_FONT.Source§const SCROLL_DOWN_ICON: char = '\u{e803}'
const SCROLL_DOWN_ICON: char = '\u{e803}'
char representing a v icon in the built-in ICON_FONT.Source§const SCROLL_LEFT_ICON: char = '\u{e804}'
const SCROLL_LEFT_ICON: char = '\u{e804}'
char representing a < icon in the built-in ICON_FONT.Source§const SCROLL_RIGHT_ICON: char = '\u{e805}'
const SCROLL_RIGHT_ICON: char = '\u{e805}'
char representing a > icon in the built-in ICON_FONT.Source§fn default_font(&self) -> Self::Font
fn default_font(&self) -> Self::Font
Self::Font.Source§fn default_size(&self) -> Pixels
fn default_size(&self) -> Pixels
Text.Source§fn fill_paragraph(
&mut self,
text: &Self::Paragraph,
position: Point,
color: Color,
clip_bounds: Rectangle,
)
fn fill_paragraph( &mut self, text: &Self::Paragraph, position: Point, color: Color, clip_bounds: Rectangle, )
Source§impl Renderer for Renderer
Available on crate feature image only.
impl Renderer for Renderer
image only.Source§type Handle = Handle
type Handle = Handle
HandleSource§fn load_image(&self, handle: &Self::Handle) -> Result<Allocation, Error>
fn load_image(&self, handle: &Self::Handle) -> Result<Allocation, Error>
Allocation to it. Read moreSource§impl Renderer for Renderer
Available on crate feature geometry only.
impl Renderer for Renderer
geometry only.Source§fn draw_geometry(&mut self, geometry: Self::Geometry)
fn draw_geometry(&mut self, geometry: Self::Geometry)
Self::Geometry.