pub struct ImageViewMut<'a> { /* private fields */ }Expand description
A borrowed mutable slice of image data.
Implementations§
Source§impl<'a> ImageViewMut<'a>
impl<'a> ImageViewMut<'a>
Sourcepub fn new(data: &'a mut [u8], size: Size, color: ColorFormat) -> Option<Self>
pub fn new(data: &'a mut [u8], size: Size, color: ColorFormat) -> Option<Self>
Creates a new contiguous image view from the given data, size, and color format.
The data must be the correct size for the given size and color format.
If data.len() != size.pixels() * color.bytes_per_pixel(),
then None is returned.
Sourcepub fn new_with(
data: &'a mut [u8],
row_pitch: usize,
size: Size,
color: ColorFormat,
) -> Option<Self>
pub fn new_with( data: &'a mut [u8], row_pitch: usize, size: Size, color: ColorFormat, ) -> Option<Self>
Creates a new image view from the given data, row pitch, size, and color format.
The data and row pitch must be the correct size for the given size and
color format. If row_pitch < width * color.bytes_per_pixel() or the
data length is too short, then None will be returned.
Note: The data slice will be truncated to the exact addressable length based on row pitch and size.
pub fn data(&mut self) -> &mut [u8] ⓘ
pub fn size(&self) -> Size
pub fn width(&self) -> u32
pub fn height(&self) -> u32
pub fn color(&self) -> ColorFormat
pub fn row_pitch(&self) -> usize
Sourcepub fn is_contiguous(&self) -> bool
pub fn is_contiguous(&self) -> bool
Returns true if the data is contiguous in memory.
Auto Trait Implementations§
impl<'a> Freeze for ImageViewMut<'a>
impl<'a> RefUnwindSafe for ImageViewMut<'a>
impl<'a> Send for ImageViewMut<'a>
impl<'a> Sync for ImageViewMut<'a>
impl<'a> Unpin for ImageViewMut<'a>
impl<'a> !UnwindSafe for ImageViewMut<'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