pub struct Renderer { /* private fields */ }Expand description
Holds the GPU state bound to a surface and presents the frames.
Implementations§
Source§impl Renderer
impl Renderer
Sourcepub async fn new(
target: impl Into<SurfaceTarget<'static>>,
width: u32,
height: u32,
) -> Result<Self>
pub async fn new( target: impl Into<SurfaceTarget<'static>>, width: u32, height: u32, ) -> Result<Self>
Initialises the GPU context for a given surface.
target is typically an Arc<Window> supplied by the platform layer.
width and height must both be > 0.
Sourcepub fn resize(&mut self, width: u32, height: u32)
pub fn resize(&mut self, width: u32, height: u32)
Reconfigures the surface after the window is resized. The painters’ viewports
are set every frame by Painters::render.
Sourcepub fn reconfigure(&mut self)
pub fn reconfigure(&mut self)
Reapplies the current configuration, after a lost or outdated surface.
Sourcepub fn render(&mut self, scene: &Scene) -> RenderOutcome
pub fn render(&mut self, scene: &Scene) -> RenderOutcome
Draws the scene — rectangles, images, paths, text, layers — and presents it.
Auto Trait Implementations§
impl !Freeze for Renderer
impl !RefUnwindSafe for Renderer
impl !UnwindSafe for Renderer
impl Send for Renderer
impl Sync for Renderer
impl Unpin for Renderer
impl UnsafeUnpin for Renderer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more