pub struct Texture { /* private fields */ }Expand description
Packed RGBA8 texture value reusable by Render, Presenter, Image, and UI.
Two backings are currently admitted:
- Buffer-backed: uploaded from host bytes or a Matrix; supports
read_rgba8. - Render-target-backed: a non-owning alias of a
Rendererslot’s color image; valid only while the originatingRenderFrameis live. Readback usesRenderFrame::consume_readback, notread_rgba8.
Implementations§
Source§impl Texture
impl Texture
Sourcepub fn read_rgba8(&self) -> Result<Vec<u8>>
pub fn read_rgba8(&self) -> Result<Vec<u8>>
Read packed row-major RGBA8 pixels to host memory.
Only available for buffer-backed textures. Render-target-backed textures
must use RenderFrame::consume_readback instead.
§Errors
Returns an error when submission, completion, mapping, or cache invalidation fails, or when called on a render-target-backed Texture.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Texture
impl !Send for Texture
impl !Sync for Texture
impl !UnwindSafe for Texture
impl Forget for Texture
impl Freeze for Texture
impl Move for Texture
impl Unpin for Texture
impl UnsafeUnpin for Texture
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