pub struct Frame { /* private fields */ }Expand description
A single captured frame in BGRA8 layout, row-major, stride = width * 4.
Implementations§
Source§impl Frame
impl Frame
pub fn new( width: u32, height: u32, data: Vec<u8>, ) -> Result<Frame, CaptureError>
Sourcepub fn solid(width: u32, height: u32, bgra: [u8; 4]) -> Frame
pub fn solid(width: u32, height: u32, bgra: [u8; 4]) -> Frame
A frame filled with one BGRA color. Handy for tests and fakes.
§Panics
Panics if width * height * 4 overflows the allocator’s capacity limits.
Sourcepub fn from_fn(
width: u32,
height: u32,
f: impl FnMut(u32, u32) -> [u8; 4],
) -> Frame
pub fn from_fn( width: u32, height: u32, f: impl FnMut(u32, u32) -> [u8; 4], ) -> Frame
Build a frame by evaluating f(x, y) -> BGRA for every pixel.
Handy for synthetic test imagery and demos.
§Panics
Panics if width * height * 4 overflows the allocator’s capacity
limits (same policy as Frame::solid).
pub fn width(&self) -> u32
pub fn height(&self) -> u32
pub fn data(&self) -> &[u8] ⓘ
pub fn timestamp(&self) -> SystemTime
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Frame
impl RefUnwindSafe for Frame
impl Send for Frame
impl Sync for Frame
impl Unpin for Frame
impl UnsafeUnpin for Frame
impl UnwindSafe for Frame
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