pub struct ExternalTexture { /* private fields */ }Expand description
A GPU texture that another renderer, such as a game engine, draws into, shown through Cranpose’s image primitives.
The handle belongs to the renderer that draws the scene: the wgpu
renderer draws a wgpu::TextureView and samples it as stored, so an sRGB
texture needs a non-sRGB view. Software renderers draw it transparent.
Draw frame with the number of the texture’s current
content. Image ids include that number, so every cache keyed by an image
id draws the new content once the number changes.
Implementations§
Source§impl ExternalTexture
impl ExternalTexture
Sourcepub fn new(
width: u32,
height: u32,
opaque: bool,
handle: impl Any + Send + Sync,
) -> Result<ExternalTexture, ImageBitmapError>
pub fn new( width: u32, height: u32, opaque: bool, handle: impl Any + Send + Sync, ) -> Result<ExternalTexture, ImageBitmapError>
Wraps a renderer’s texture handle of width by height pixels.
opaque promises that every pixel the texture holds has full alpha.
Sourcepub fn frame(&self, frame: u64) -> ImageBitmap
pub fn frame(&self, frame: u64) -> ImageBitmap
The bitmap that draws content number frame of this texture.
Sourcepub fn bitmaps_alive(&self) -> bool
pub fn bitmaps_alive(&self) -> bool
Whether a bitmap from frame, or another clone of this
texture, is still alive. A renderer draws the texture only through such
a bitmap, so once none is alive, no draw of it is waiting for the GPU
queue.
Trait Implementations§
Source§impl Clone for ExternalTexture
impl Clone for ExternalTexture
Source§fn clone(&self) -> ExternalTexture
fn clone(&self) -> ExternalTexture
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for ExternalTexture
impl RefUnwindSafe for ExternalTexture
impl Send for ExternalTexture
impl Sync for ExternalTexture
impl Unpin for ExternalTexture
impl UnsafeUnpin for ExternalTexture
impl UnwindSafe for ExternalTexture
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ErasedDestructor for Twhere
T: 'static,
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