pub struct ExternalFrames { /* private fields */ }Expand description
Frames that another thread renders with Cranpose’s device, such as a game engine that runs its own loop, for a composition to show.
The thread renders through a FrameWriter into textures that this ring
owns and publishes each frame once the queue has its work. The composition
takes the newest published frame with Self::next_frame. Neither side
waits for the other: a writer that renders faster than the composition
draws loses its older frames, and a slower one leaves the last frame shown.
A texture goes back to the writer only when the composition shows a newer frame and no bitmap of the texture is left, so no draw of it is still on its way to the queue. Work the writer submits after that runs after every Cranpose frame that sampled the texture.
Implementations§
Source§impl ExternalFrames
impl ExternalFrames
Sourcepub fn new(
gpu: &GpuContext,
format: TextureFormat,
usage: TextureUsages,
opaque: bool,
) -> Self
pub fn new( gpu: &GpuContext, format: TextureFormat, usage: TextureUsages, opaque: bool, ) -> Self
Frames in textures of format that can also be used as usage, such
as RENDER_ATTACHMENT. opaque promises that every pixel the writer
renders has full alpha.
Sourcepub fn writer(&self) -> FrameWriter
pub fn writer(&self) -> FrameWriter
The end that renders the frames.
Sourcepub fn set_size(&self, width: u32, height: u32)
pub fn set_size(&self, width: u32, height: u32)
Asks for frames of width by height pixels from the next
FrameWriter::begin on. The frame shown stays until one of the new
size is published.
Sourcepub fn next_frame(&self) -> Option<ImageBitmap>
pub fn next_frame(&self) -> Option<ImageBitmap>
The newest frame published since the last call, or None when there
is none. The bitmap’s id is new for every frame.
Auto Trait Implementations§
impl Freeze for ExternalFrames
impl RefUnwindSafe for ExternalFrames
impl Send for ExternalFrames
impl Sync for ExternalFrames
impl Unpin for ExternalFrames
impl UnsafeUnpin for ExternalFrames
impl UnwindSafe for ExternalFrames
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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.