pub struct Image<T, const CHANNELS: usize> { /* private fields */ }Expand description
An owning, densely packed, interleaved image.
Implementations§
Source§impl<T, const CHANNELS: usize> Image<T, CHANNELS>
impl<T, const CHANNELS: usize> Image<T, CHANNELS>
Sourcepub fn try_new(
width: usize,
height: usize,
data: Vec<T>,
) -> Result<Self, ImageError>
pub fn try_new( width: usize, height: usize, data: Vec<T>, ) -> Result<Self, ImageError>
Creates an image from densely packed, interleaved scalar elements.
Sourcepub fn try_new_with_metadata(
width: usize,
height: usize,
data: Vec<T>,
metadata: ImageMetadata,
) -> Result<Self, ImageError>
pub fn try_new_with_metadata( width: usize, height: usize, data: Vec<T>, metadata: ImageMetadata, ) -> Result<Self, ImageError>
Creates a packed image and validates its semantic metadata.
Sourcepub const fn row_stride(&self) -> usize
pub const fn row_stride(&self) -> usize
Returns the packed row stride in scalar elements.
Sourcepub const fn layout(&self) -> ImageLayout
pub const fn layout(&self) -> ImageLayout
Returns physical channel layout.
Sourcepub const fn metadata(&self) -> ImageMetadata
pub const fn metadata(&self) -> ImageMetadata
Returns semantic image metadata.
Sourcepub fn set_metadata(
&mut self,
metadata: ImageMetadata,
) -> Result<(), ImageError>
pub fn set_metadata( &mut self, metadata: ImageMetadata, ) -> Result<(), ImageError>
Replaces semantic metadata after validating the channel count.
Sourcepub fn as_mut_slice(&mut self) -> &mut [T]
pub fn as_mut_slice(&mut self) -> &mut [T]
Returns mutable packed scalar storage.
Sourcepub fn view_mut(&mut self) -> ImageViewMut<'_, T, CHANNELS>
pub fn view_mut(&mut self) -> ImageViewMut<'_, T, CHANNELS>
Borrows this image as a mutable zero-copy view.
Sourcepub fn get(&self, x: usize, y: usize) -> Option<&[T; CHANNELS]>
pub fn get(&self, x: usize, y: usize) -> Option<&[T; CHANNELS]>
Returns one pixel, or None outside image bounds.
Source§impl<T: Clone, const CHANNELS: usize> Image<T, CHANNELS>
impl<T: Clone, const CHANNELS: usize> Image<T, CHANNELS>
Sourcepub fn from_pixel(
width: usize,
height: usize,
pixel: [T; CHANNELS],
) -> Result<Self, ImageError>
pub fn from_pixel( width: usize, height: usize, pixel: [T; CHANNELS], ) -> Result<Self, ImageError>
Creates a densely packed image filled with one pixel value.
Trait Implementations§
Source§impl<T: PartialEq, const CHANNELS: usize> PartialEq for Image<T, CHANNELS>
impl<T: PartialEq, const CHANNELS: usize> PartialEq for Image<T, CHANNELS>
impl<T: Eq, const CHANNELS: usize> Eq for Image<T, CHANNELS>
impl<T, const CHANNELS: usize> StructuralPartialEq for Image<T, CHANNELS>
Auto Trait Implementations§
impl<T, const CHANNELS: usize> Freeze for Image<T, CHANNELS>
impl<T, const CHANNELS: usize> RefUnwindSafe for Image<T, CHANNELS>where
T: RefUnwindSafe,
impl<T, const CHANNELS: usize> Send for Image<T, CHANNELS>where
T: Send,
impl<T, const CHANNELS: usize> Sync for Image<T, CHANNELS>where
T: Sync,
impl<T, const CHANNELS: usize> Unpin for Image<T, CHANNELS>where
T: Unpin,
impl<T, const CHANNELS: usize> UnsafeUnpin for Image<T, CHANNELS>
impl<T, const CHANNELS: usize> UnwindSafe for Image<T, CHANNELS>where
T: UnwindSafe,
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