pub struct PlanarImageView<'a, T, const CHANNELS: usize> { /* private fields */ }Expand description
A read-only, zero-copy planar image view with explicit strides.
Implementations§
Source§impl<'a, T, const CHANNELS: usize> PlanarImageView<'a, T, CHANNELS>
impl<'a, T, const CHANNELS: usize> PlanarImageView<'a, T, CHANNELS>
Sourcepub fn new(
width: usize,
height: usize,
row_stride: usize,
plane_stride: usize,
data: &'a [T],
) -> Result<Self, ImageError>
pub fn new( width: usize, height: usize, row_stride: usize, plane_stride: usize, data: &'a [T], ) -> Result<Self, ImageError>
Creates a planar view. Strides are measured in scalar elements.
Sourcepub fn new_with_metadata(
width: usize,
height: usize,
row_stride: usize,
plane_stride: usize,
data: &'a [T],
metadata: ImageMetadata,
) -> Result<Self, ImageError>
pub fn new_with_metadata( width: usize, height: usize, row_stride: usize, plane_stride: usize, data: &'a [T], metadata: ImageMetadata, ) -> Result<Self, ImageError>
Creates a planar view with validated semantic metadata.
Sourcepub const fn row_stride(self) -> usize
pub const fn row_stride(self) -> usize
Returns row stride within a plane.
Sourcepub const fn plane_stride(self) -> usize
pub const fn plane_stride(self) -> usize
Returns scalar distance between channel-plane origins.
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 get(self, channel: usize, x: usize, y: usize) -> Option<&'a T>
pub fn get(self, channel: usize, x: usize, y: usize) -> Option<&'a T>
Returns one channel value, or None outside image bounds.
Sourcepub fn pixel(self, x: usize, y: usize) -> Option<[T; CHANNELS]>where
T: Copy,
pub fn pixel(self, x: usize, y: usize) -> Option<[T; CHANNELS]>where
T: Copy,
Copies one pixel from its channel planes.
Sourcepub fn subview(self, region: ImageRegion) -> Result<Self, ImageError>
pub fn subview(self, region: ImageRegion) -> Result<Self, ImageError>
Creates a checked zero-copy planar subview.
Trait Implementations§
Source§impl<'a, T: Clone, const CHANNELS: usize> Clone for PlanarImageView<'a, T, CHANNELS>
impl<'a, T: Clone, const CHANNELS: usize> Clone for PlanarImageView<'a, T, CHANNELS>
Source§fn clone(&self) -> PlanarImageView<'a, T, CHANNELS>
fn clone(&self) -> PlanarImageView<'a, T, CHANNELS>
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 moreimpl<'a, T: Copy, const CHANNELS: usize> Copy for PlanarImageView<'a, T, CHANNELS>
Auto Trait Implementations§
impl<'a, T, const CHANNELS: usize> Freeze for PlanarImageView<'a, T, CHANNELS>
impl<'a, T, const CHANNELS: usize> RefUnwindSafe for PlanarImageView<'a, T, CHANNELS>where
T: RefUnwindSafe,
impl<'a, T, const CHANNELS: usize> Send for PlanarImageView<'a, T, CHANNELS>where
T: Sync,
impl<'a, T, const CHANNELS: usize> Sync for PlanarImageView<'a, T, CHANNELS>where
T: Sync,
impl<'a, T, const CHANNELS: usize> Unpin for PlanarImageView<'a, T, CHANNELS>
impl<'a, T, const CHANNELS: usize> UnsafeUnpin for PlanarImageView<'a, T, CHANNELS>
impl<'a, T, const CHANNELS: usize> UnwindSafe for PlanarImageView<'a, T, CHANNELS>where
T: RefUnwindSafe,
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