Trait image2::image::Image

source ·
pub trait Image<T: Type, C: Color>: Sized + Sync + Send {
Show 29 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 len(&self) -> usize { ... } fn total_bytes(&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 get_pixel_f<'a, P: PixelMut<'a, f64, 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 set_pixel_f<'a, P: Pixel<'a, f64, 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 to_image_ptr<'a>(self) -> ImagePtr<'a, T, C> { ... } fn for_each<F: Sync + Send + Fn((usize, usize), &mut [T])>(&mut self, f: F) { ... } fn for_each2<F: Sync + Send + Fn((usize, usize), &mut [T], &[T]), I: Image<T, C>>(
        &mut self,
        other: &I,
        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) -> Hash { ... } fn diff<I: Image<T, C>>(&self, other: &I) -> Diff { ... }
}
Expand description

The Image trait defines many methods for interaction with images in a generic manner

Required Methods§

Returns the width, height and channels of an image

An immutable reference to the underlying image data

A mutable reference to the underlying image data

Provided Methods§

Get the number of total elements in an image

Get the total number of bytes needed to store the image data

Get the offset of the component at (x, y, c)

Create a new, empty pixel with each component set to 0

Get a vector of mutable references to each component at (x, y)

Get a vector of immutable references to each component at (x, y)

Load data from the pixel at (x, y) into px

Load data from the pixel at (x, y) into px and convert to normalized f64

Set data at (x, y) to px

Set data at (x, y) to px after denormalizing

Get a single component at (x, y, c) as a noramlized f64 value

Set the component at (x, y, c) using a normalized f64 value

Get a single component at (x, y, c)

Set a single component at (x, y, c)

Convert from type T to type U

Convert Image to ImageRef

Consume and convert Image to ImagePtr

Iterate over each pixel

Iterate over each pixel

Create a new image from the region specified by (x, y, width, height)

Implementors§