pub trait Image<T: Type, C: Color>: Sized + Sync + Send {
Show 22 methods
fn shape(&self) -> (usize, usize, usize);
fn data(&self) -> &[T] ⓘ;
fn data_mut(&mut self) -> &mut [T] ⓘ;
fn width(&self) -> usize { ... }
fn height(&self) -> usize { ... }
fn channels(&self) -> usize { ... }
fn index(&self, x: usize, y: usize, c: usize) -> usize { ... }
fn empty_pixel(&self) -> Vec<T> { ... }
fn at_mut(&mut self, x: usize, y: usize) -> &mut [T] ⓘ { ... }
fn at(&self, x: usize, y: usize) -> &[T] ⓘ { ... }
fn get_pixel<'a, P: PixelMut<'a, T, C>>(&self, x: usize, y: usize, px: &mut P) { ... }
fn set_pixel<'a, P: Pixel<'a, T, C>>(&mut self, x: usize, y: usize, px: &P) { ... }
fn get_f(&self, x: usize, y: usize, c: usize) -> f64 { ... }
fn set_f(&mut self, x: usize, y: usize, c: usize, f: f64) { ... }
fn get(&self, x: usize, y: usize, c: usize) -> T { ... }
fn set(&mut self, x: usize, y: usize, c: usize, t: T) { ... }
fn convert_type<U: Type, I: Image<U, C>>(&self, dest: &mut I) { ... }
fn as_image_ref(&mut self) -> ImageRef<'_, T, C> { ... }
fn for_each<F: Sync + Send + Fn((usize, usize), &mut [T])>(&mut self, f: F) { ... }
fn crop(
&self,
x: usize,
y: usize,
width: usize,
height: usize
) -> ImageBuf<T, C> { ... }
fn clone(&self) -> ImageBuf<T, C> { ... }
fn hash(&self) -> u64 { ... }
}
Expand description
The Image trait defines many methods for interaction with images in a generic manner
Required Methods§
Provided Methods§
fn width(&self) -> usize
fn height(&self) -> usize
fn channels(&self) -> usize
sourcefn index(&self, x: usize, y: usize, c: usize) -> usize
fn index(&self, x: usize, y: usize, c: usize) -> usize
Get the offset of the component at (x, y, c)
sourcefn empty_pixel(&self) -> Vec<T>
fn empty_pixel(&self) -> Vec<T>
Create a new, empty pixel with each component set to 0
sourcefn at_mut(&mut self, x: usize, y: usize) -> &mut [T] ⓘ
fn at_mut(&mut self, x: usize, y: usize) -> &mut [T] ⓘ
Get a vector of mutable references to each component at (x, y)
sourcefn at(&self, x: usize, y: usize) -> &[T] ⓘ
fn at(&self, x: usize, y: usize) -> &[T] ⓘ
Get a vector of immutable references to each component at (x, y)
sourcefn get_pixel<'a, P: PixelMut<'a, T, C>>(&self, x: usize, y: usize, px: &mut P)
fn get_pixel<'a, P: PixelMut<'a, T, C>>(&self, x: usize, y: usize, px: &mut P)
Load data from the pixel at (x, y) into px
sourcefn set_pixel<'a, P: Pixel<'a, T, C>>(&mut self, x: usize, y: usize, px: &P)
fn set_pixel<'a, P: Pixel<'a, T, C>>(&mut self, x: usize, y: usize, px: &P)
Set data at (x, y) from px
sourcefn get_f(&self, x: usize, y: usize, c: usize) -> f64
fn get_f(&self, x: usize, y: usize, c: usize) -> f64
Get a single component at (x, y, c) as a noramlized f64 value
sourcefn set_f(&mut self, x: usize, y: usize, c: usize, f: f64)
fn set_f(&mut self, x: usize, y: usize, c: usize, f: f64)
Set the component at (x, y, c) using a normalized f64 value
sourcefn convert_type<U: Type, I: Image<U, C>>(&self, dest: &mut I)
fn convert_type<U: Type, I: Image<U, C>>(&self, dest: &mut I)
Convert from type T to type U
sourcefn as_image_ref(&mut self) -> ImageRef<'_, T, C>
fn as_image_ref(&mut self) -> ImageRef<'_, T, C>
Convert Image to ImageRef
sourcefn for_each<F: Sync + Send + Fn((usize, usize), &mut [T])>(&mut self, f: F)
fn for_each<F: Sync + Send + Fn((usize, usize), &mut [T])>(&mut self, f: F)
Iterate over each pixel
sourcefn crop(&self, x: usize, y: usize, width: usize, height: usize) -> ImageBuf<T, C>
fn crop(&self, x: usize, y: usize, width: usize, height: usize) -> ImageBuf<T, C>
Create a new image from the region specified by (x, y, width, height)