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: usizeImage stride, items per row, might be 0
Implementations§
Source§impl<'a, T: Clone + Copy + Default + Debug, const N: usize> GainImage<'a, T, N>
impl<'a, T: Clone + Copy + Default + Debug, const N: usize> GainImage<'a, T, N>
Sourcepub fn alloc(width: usize, height: usize) -> Self
pub fn alloc(width: usize, height: usize) -> Self
Allocates default image layout for given N channels count
Sourcepub fn borrow(arr: &'a [T], width: usize, height: usize) -> Self
pub fn borrow(arr: &'a [T], width: usize, height: usize) -> Self
Borrows existing data
Stride will be default width * N
Sourcepub fn size_matches(
&self,
other: &GainImage<'_, T, N>,
) -> Result<(), ForgeError>
pub fn size_matches( &self, other: &GainImage<'_, T, N>, ) -> Result<(), ForgeError>
Checks if it is matches the size of the other image
Sourcepub fn size_matches_arb<const G: usize>(
&self,
other: &GainImage<'_, T, G>,
) -> Result<(), ForgeError>
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
Sourcepub fn size_matches_mut(
&self,
other: &GainImageMut<'_, T, N>,
) -> Result<(), ForgeError>
pub fn size_matches_mut( &self, other: &GainImageMut<'_, T, N>, ) -> Result<(), ForgeError>
Checks if it is matches the size of the other image
Sourcepub fn check_layout_channels(&self, cn: usize) -> Result<(), ForgeError>
pub fn check_layout_channels(&self, cn: usize) -> Result<(), ForgeError>
Checks if layout matches necessary requirements by using external channels count
Sourcepub fn row_stride(&self) -> usize
pub fn row_stride(&self) -> usize
Returns row stride
pub fn check_layout(&self) -> Result<(), ForgeError>
Source§impl<const N: usize> GainImage<'_, u8, N>
impl<const N: usize> GainImage<'_, u8, N>
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>
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>where
T: RefUnwindSafe + 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