pub struct ImageBuffer {
pub width: usize,
pub height: usize,
pub data: Vec<u8>,
}Expand description
An owned, heap-allocated grayscale image buffer (u8, row-major).
ImageBuffer is the owning counterpart of ImageView. It is used
internally by PyramidBuffers to hold the downsampled pyramid
levels and can be borrowed as an ImageView via
ImageBuffer::as_view.
Fields§
§width: usizeImage width in pixels.
height: usizeImage height in pixels.
data: Vec<u8>Pixel data in row-major order, zero-initialized at construction.
Row y starts at byte y * width.
Implementations§
Source§impl ImageBuffer
impl ImageBuffer
Sourcepub fn new(width: usize, height: usize) -> Self
pub fn new(width: usize, height: usize) -> Self
Allocate a zero-filled buffer with the given dimensions.
Uses usize::saturating_mul, so multiplication never wraps.
Extremely large dimensions may still request an impractically
large allocation.
Trait Implementations§
Source§impl Clone for ImageBuffer
impl Clone for ImageBuffer
Source§fn clone(&self) -> ImageBuffer
fn clone(&self) -> ImageBuffer
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for ImageBuffer
impl RefUnwindSafe for ImageBuffer
impl Send for ImageBuffer
impl Sync for ImageBuffer
impl Unpin for ImageBuffer
impl UnsafeUnpin for ImageBuffer
impl UnwindSafe for ImageBuffer
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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