pub struct FrameBuffer<'a> { /* private fields */ }Expand description
Implementationsยง
Sourceยงimpl<'a> FrameBuffer<'a>
impl<'a> FrameBuffer<'a>
Sourcepub fn new(
raw_buffer: &'a mut [u8],
buffer: &'a mut Vec<u8>,
width: u32,
height: u32,
row_pitch: u32,
depth_pitch: u32,
color_format: ColorFormat,
) -> Self
pub fn new( raw_buffer: &'a mut [u8], buffer: &'a mut Vec<u8>, width: u32, height: u32, row_pitch: u32, depth_pitch: u32, color_format: ColorFormat, ) -> Self
Create a new Frame Buffer.
ยงArguments
raw_buffer- A mutable reference to the raw pixel data buffer.buffer- A mutable reference to the buffer used for copying pixel data without padding.width- The width of the frame buffer.height- The height of the frame buffer.row_pitch- The row pitch of the frame buffer.depth_pitch- The depth pitch of the frame buffer.color_format- The color format of the frame buffer.
ยงReturns
A new FrameBuffer instance.
Sourcepub const fn depth_pitch(&self) -> u32
pub const fn depth_pitch(&self) -> u32
Get the depth pitch of the frame buffer.
Sourcepub const fn has_padding(&self) -> bool
pub const fn has_padding(&self) -> bool
Check if the buffer has padding.
Sourcepub fn as_raw_buffer(&mut self) -> &mut [u8] โ
pub fn as_raw_buffer(&mut self) -> &mut [u8] โ
Get the raw pixel data with possible padding.
Sourcepub fn as_nopadding_buffer(&mut self) -> Result<&mut [u8], Error>
pub fn as_nopadding_buffer(&mut self) -> Result<&mut [u8], Error>
Get the raw pixel data without padding.
ยงReturns
A mutable reference to the buffer containing pixel data without padding.
Sourcepub fn save_as_image<T: AsRef<Path>>(
&mut self,
path: T,
format: ImageFormat,
) -> Result<(), Error>
pub fn save_as_image<T: AsRef<Path>>( &mut self, path: T, format: ImageFormat, ) -> Result<(), Error>
Auto Trait Implementationsยง
impl<'a> Freeze for FrameBuffer<'a>
impl<'a> RefUnwindSafe for FrameBuffer<'a>
impl<'a> Send for FrameBuffer<'a>
impl<'a> Sync for FrameBuffer<'a>
impl<'a> Unpin for FrameBuffer<'a>
impl<'a> !UnwindSafe for FrameBuffer<'a>
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> 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>
Converts
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>
Converts
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