pub struct Frame { /* private fields */ }Expand description
Represents the current frame of a render target.
Returned by Context::get_next_frame.
Implementations§
Source§impl Frame
impl Frame
pub fn view(&self) -> TextureView
pub fn copy_to_buffer( &self, device: &Device, queue: &Queue, width: u32, height: u32, ) -> CopiedTextureBuffer
pub fn get_size(&self) -> UVec2
Sourcepub fn read_image(&self) -> Result<RgbaImage, TextureError>
pub fn read_image(&self) -> Result<RgbaImage, TextureError>
Read the current frame buffer into an image.
This should be called after rendering, before presentation. Good for getting headless screen grabs.
The resulting image will be in the color space of the frame.
§Note
This operation can take a long time, depending on how big the screen is.
Sourcepub fn read_srgb_image(&self) -> Result<RgbaImage, TextureError>
pub fn read_srgb_image(&self) -> Result<RgbaImage, TextureError>
Read the frame into an image.
This should be called after rendering, before presentation. Good for getting headless screen grabs.
The resulting image will be in a sRGB color space.
§Note
This operation can take a long time, depending on how big the screen is.
Sourcepub fn read_linear_image(&self) -> Result<RgbaImage, TextureError>
pub fn read_linear_image(&self) -> Result<RgbaImage, TextureError>
Read the frame into an image.
This should be called after rendering, before presentation. Good for getting headless screen grabs.
The resulting image will be in a linear color space.
§Note
This operation can take a long time, depending on how big the screen is.
Auto Trait Implementations§
impl Freeze for Frame
impl !RefUnwindSafe for Frame
impl Send for Frame
impl Sync for Frame
impl Unpin for Frame
impl !UnwindSafe for Frame
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more