Skip to main content

PlanarImage

Struct PlanarImage 

Source
pub struct PlanarImage<T, const CHANNELS: usize> { /* private fields */ }
Expand description

An owning, densely packed planar image.

Storage order is all values for channel 0, followed by channel 1, and so on.

Implementations§

Source§

impl<T, const CHANNELS: usize> PlanarImage<T, CHANNELS>

Source

pub fn try_new( width: usize, height: usize, data: Vec<T>, ) -> Result<Self, ImageError>

Creates an image from densely packed planar scalar elements.

Source

pub fn try_new_with_metadata( width: usize, height: usize, data: Vec<T>, metadata: ImageMetadata, ) -> Result<Self, ImageError>

Creates a planar image with validated semantic metadata.

Source

pub const fn width(&self) -> usize

Returns image width in pixels.

Source

pub const fn height(&self) -> usize

Returns image height in pixels.

Source

pub const fn layout(&self) -> ImageLayout

Returns physical channel layout.

Source

pub const fn row_stride(&self) -> usize

Returns packed row stride within each plane.

Source

pub const fn plane_stride(&self) -> usize

Returns the scalar distance between channel-plane origins.

Source

pub const fn metadata(&self) -> ImageMetadata

Returns semantic image metadata.

Source

pub fn set_metadata( &mut self, metadata: ImageMetadata, ) -> Result<(), ImageError>

Replaces semantic metadata after validating the channel count.

Source

pub fn as_slice(&self) -> &[T]

Returns planar scalar storage.

Source

pub fn as_mut_slice(&mut self) -> &mut [T]

Returns mutable planar scalar storage.

Source

pub fn view(&self) -> PlanarImageView<'_, T, CHANNELS>

Borrows this image as a planar view.

Source

pub fn get(&self, channel: usize, x: usize, y: usize) -> Option<&T>

Returns one channel value, or None outside image bounds.

Source

pub fn get_mut(&mut self, channel: usize, x: usize, y: usize) -> Option<&mut T>

Returns one mutable channel value, or None outside image bounds.

Source

pub fn into_vec(self) -> Vec<T>

Consumes the image and returns planar scalar storage.

Trait Implementations§

Source§

impl<T: Clone, const CHANNELS: usize> Clone for PlanarImage<T, CHANNELS>

Source§

fn clone(&self) -> PlanarImage<T, CHANNELS>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: Debug, const CHANNELS: usize> Debug for PlanarImage<T, CHANNELS>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T: PartialEq, const CHANNELS: usize> PartialEq for PlanarImage<T, CHANNELS>

Source§

fn eq(&self, other: &PlanarImage<T, CHANNELS>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T: Eq, const CHANNELS: usize> Eq for PlanarImage<T, CHANNELS>

Source§

impl<T, const CHANNELS: usize> StructuralPartialEq for PlanarImage<T, CHANNELS>

Auto Trait Implementations§

§

impl<T, const CHANNELS: usize> Freeze for PlanarImage<T, CHANNELS>

§

impl<T, const CHANNELS: usize> RefUnwindSafe for PlanarImage<T, CHANNELS>
where T: RefUnwindSafe,

§

impl<T, const CHANNELS: usize> Send for PlanarImage<T, CHANNELS>
where T: Send,

§

impl<T, const CHANNELS: usize> Sync for PlanarImage<T, CHANNELS>
where T: Sync,

§

impl<T, const CHANNELS: usize> Unpin for PlanarImage<T, CHANNELS>
where T: Unpin,

§

impl<T, const CHANNELS: usize> UnsafeUnpin for PlanarImage<T, CHANNELS>

§

impl<T, const CHANNELS: usize> UnwindSafe for PlanarImage<T, CHANNELS>
where T: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.