Struct GainImage

Source
pub struct GainImage<'a, T: Clone + Copy + Default + Debug, const N: usize> {
    pub data: Cow<'a, [T]>,
    pub width: usize,
    pub height: usize,
    pub stride: usize,
}
Expand description

Immutable image store

Fields§

§data: Cow<'a, [T]>§width: usize§height: usize§stride: usize

Image stride, items per row, might be 0

Implementations§

Source§

impl<'a, T: Clone + Copy + Default + Debug, const N: usize> GainImage<'a, T, N>

Source

pub fn alloc(width: usize, height: usize) -> Self

Allocates default image layout for given N channels count

Source

pub fn borrow(arr: &'a [T], width: usize, height: usize) -> Self

Borrows existing data Stride will be default width * N

Source

pub fn size_matches( &self, other: &GainImage<'_, T, N>, ) -> Result<(), ForgeError>

Checks if it is matches the size of the other image

Source

pub fn size_matches_arb<const G: usize>( &self, other: &GainImage<'_, T, G>, ) -> Result<(), ForgeError>

Checks if it is matches the size of the other image

Source

pub fn size_matches_mut( &self, other: &GainImageMut<'_, T, N>, ) -> Result<(), ForgeError>

Checks if it is matches the size of the other image

Source

pub fn check_layout_channels(&self, cn: usize) -> Result<(), ForgeError>

Checks if layout matches necessary requirements by using external channels count

Source

pub fn row_stride(&self) -> usize

Returns row stride

Source

pub fn check_layout(&self) -> Result<(), ForgeError>

Source§

impl<const N: usize> GainImage<'_, u8, N>

Source

pub fn expand_to_u16(&self, target_bit_depth: usize) -> GainImageMut<'_, u16, N>

Auto Trait Implementations§

§

impl<'a, T, const N: usize> Freeze for GainImage<'a, T, N>

§

impl<'a, T, const N: usize> RefUnwindSafe for GainImage<'a, T, N>
where T: RefUnwindSafe,

§

impl<'a, T, const N: usize> Send for GainImage<'a, T, N>
where T: Sync + Send,

§

impl<'a, T, const N: usize> Sync for GainImage<'a, T, N>
where T: Sync,

§

impl<'a, T, const N: usize> Unpin for GainImage<'a, T, N>
where T: Unpin,

§

impl<'a, T, const N: usize> UnwindSafe for GainImage<'a, T, N>

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> 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, 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.