Merge pull request #1845 from bungoboingo/feat/offscreen-rendering
Feat: Offscreen Rendering & Screenshots
This commit is contained in:
commit
f6966268bb
15 changed files with 921 additions and 24 deletions
|
|
@ -59,6 +59,19 @@ pub trait Compositor: Sized {
|
|||
background_color: Color,
|
||||
overlay: &[T],
|
||||
) -> Result<(), SurfaceError>;
|
||||
|
||||
/// Screenshots the current [`Renderer`] primitives to an offscreen texture, and returns the bytes of
|
||||
/// the texture ordered as `RGBA` in the sRGB color space.
|
||||
///
|
||||
/// [`Renderer`]: Self::Renderer;
|
||||
fn screenshot<T: AsRef<str>>(
|
||||
&mut self,
|
||||
renderer: &mut Self::Renderer,
|
||||
surface: &mut Self::Surface,
|
||||
viewport: &Viewport,
|
||||
background_color: Color,
|
||||
overlay: &[T],
|
||||
) -> Vec<u8>;
|
||||
}
|
||||
|
||||
/// Result of an unsuccessful call to [`Compositor::present`].
|
||||
|
|
@ -82,7 +95,7 @@ pub enum SurfaceError {
|
|||
OutOfMemory,
|
||||
}
|
||||
|
||||
/// Contains informations about the graphics (e.g. graphics adapter, graphics backend).
|
||||
/// Contains information about the graphics (e.g. graphics adapter, graphics backend).
|
||||
#[derive(Debug)]
|
||||
pub struct Information {
|
||||
/// Contains the graphics adapter.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue