pub struct RetainedFramebuffer { /* private fields */ }Expand description
Pixel memory that outlives the frames drawn into it.
A platform without a native surface to lock (a script-driven canvas, a
test harness) keeps one of these per render target: each frame locks it,
the renderer draws, and unlocking hands the pixels to blit.
Implementations§
Source§impl RetainedFramebuffer
impl RetainedFramebuffer
Sourcepub fn new(
size: PixelSize,
format: PixelFormat,
alpha_format: AlphaFormat,
) -> Rc<Self>
pub fn new( size: PixelSize, format: PixelFormat, alpha_format: AlphaFormat, ) -> Rc<Self>
Creates a framebuffer whose rows are exactly as long as their pixels.
§Panics
Panics when a pixel of format does not occupy whole bytes or when
size is empty.
Sourcepub fn with_row_bytes(
size: PixelSize,
format: PixelFormat,
alpha_format: AlphaFormat,
row_bytes: i32,
) -> Rc<Self>
pub fn with_row_bytes( size: PixelSize, format: PixelFormat, alpha_format: AlphaFormat, row_bytes: i32, ) -> Rc<Self>
Creates a framebuffer with the given row length.
§Panics
Panics when size is empty or row_bytes is too small for a row of
pixels.
Sourcepub fn format(&self) -> PixelFormat
pub fn format(&self) -> PixelFormat
The pixel format.
Sourcepub fn alpha_format(&self) -> AlphaFormat
pub fn alpha_format(&self) -> AlphaFormat
The alpha format.
Sourcepub fn lock(
self: &Rc<Self>,
dpi: Vector,
blit: impl Fn(&Rc<RetainedFramebuffer>) + 'static,
) -> Rc<dyn ILockedFramebuffer>
pub fn lock( self: &Rc<Self>, dpi: Vector, blit: impl Fn(&Rc<RetainedFramebuffer>) + 'static, ) -> Rc<dyn ILockedFramebuffer>
Locks the framebuffer for one frame. blit runs whenever the
returned framebuffer is disposed and receives this framebuffer.
§Panics
Panics when the framebuffer has been disposed.
Auto Trait Implementations§
impl !Freeze for RetainedFramebuffer
impl !RefUnwindSafe for RetainedFramebuffer
impl !Send for RetainedFramebuffer
impl !Sync for RetainedFramebuffer
impl !UnwindSafe for RetainedFramebuffer
impl Unpin for RetainedFramebuffer
impl UnsafeUnpin for RetainedFramebuffer
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
Source§impl<T> ClassDefaults for Twhere
T: ?Sized,
impl<T> ClassDefaults for Twhere
T: ?Sized,
Source§fn static_constructor()
fn static_constructor()
The static constructor of a type: work done once per thread, after
the properties of the type are registered and before its first
instance exists (class handlers,
affects_render, metadata
overrides). Read more