pub trait PlatformHeadlessRenderer {
// Required methods
fn render_scene_to_image(
&mut self,
scene: &Scene,
size: Size<DevicePixels>,
) -> Result<RgbaImage>;
fn render_scene(
&mut self,
scene: &Scene,
size: Size<DevicePixels>,
) -> Result<()>;
fn sprite_atlas(&self) -> Arc<dyn PlatformAtlas> ⓘ;
}Expand description
Renders scenes offscreen for windows that have no display, such as in tests and benchmarks.
Required Methods§
Sourcefn render_scene_to_image(
&mut self,
scene: &Scene,
size: Size<DevicePixels>,
) -> Result<RgbaImage>
fn render_scene_to_image( &mut self, scene: &Scene, size: Size<DevicePixels>, ) -> Result<RgbaImage>
Renders scene at size and returns the pixels as an RGBA image.
Sourcefn render_scene(
&mut self,
scene: &Scene,
size: Size<DevicePixels>,
) -> Result<()>
fn render_scene( &mut self, scene: &Scene, size: Size<DevicePixels>, ) -> Result<()>
Render a scene to an offscreen target without reading the result back.
This is the headless analogue of presenting a frame: it performs the same CPU-side scene encoding and GPU submission as drawing to a real window, but doesn’t block on GPU completion or copy pixels back.
Sourcefn sprite_atlas(&self) -> Arc<dyn PlatformAtlas> ⓘ
fn sprite_atlas(&self) -> Arc<dyn PlatformAtlas> ⓘ
Returns the sprite atlas used by this renderer.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".