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<Self, ImageBitmapError>
pub fn new( width: u32, height: u32, opaque: bool, handle: impl Any + Send + Sync, ) -> Result<Self, 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.