Expand description
Image implementation using Vec<T>
to store data
Implementations§
source§impl<T: Type, C: Color> ImageBuf<T, C>
impl<T: Type, C: Color> ImageBuf<T, C>
sourcepub fn new_like(&self) -> Self
pub fn new_like(&self) -> Self
Create a new image with the same type, shape and color as an existing image
sourcepub fn new_like_with_type<U: Type>(&self) -> ImageBuf<U, C>
pub fn new_like_with_type<U: Type>(&self) -> ImageBuf<U, C>
Create a new image with the given type and the same shape and color
sourcepub fn new_like_with_color<D: Color>(&self) -> ImageBuf<T, D>
pub fn new_like_with_color<D: Color>(&self) -> ImageBuf<T, D>
Create a new image with the given color and the same shape and type
Trait Implementations§
source§impl<'de, T, C: Color> Deserialize<'de> for ImageBuf<T, C>where
T: Deserialize<'de> + Type,
impl<'de, T, C: Color> Deserialize<'de> for ImageBuf<T, C>where
T: Deserialize<'de> + Type,
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl<T: Type, C: Color> Image<T, C> for ImageBuf<T, C>
impl<T: Type, C: Color> Image<T, C> for ImageBuf<T, C>
fn width(&self) -> usize
fn height(&self) -> usize
fn channels(&self) -> usize
source§fn total_bytes(&self) -> usize
fn total_bytes(&self) -> usize
Get the total number of bytes needed to store the image data
source§fn 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)
source§fn empty_pixel(&self) -> Vec<T>
fn empty_pixel(&self) -> Vec<T>
Create a new, empty pixel with each component set to 0
source§fn 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)
source§fn 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)
source§fn 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
source§fn get_pixel_f<'a, P: PixelMut<'a, f64, 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)
Load data from the pixel at (x, y) into px and convert to normalized f64
source§fn 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) to px
source§fn set_pixel_f<'a, P: Pixel<'a, f64, 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)
Set data at (x, y) to px after denormalizing
source§fn 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
source§fn 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
source§fn as_image_ref(&mut self) -> ImageRef<'_, T, C>
fn as_image_ref(&mut self) -> ImageRef<'_, T, C>
Convert Image to ImageRef
source§fn to_image_ptr<'a>(self) -> ImagePtr<'a, T, C>
fn to_image_ptr<'a>(self) -> ImagePtr<'a, T, C>
Consume and convert Image to ImagePtr
source§fn 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
source§fn for_each2<F: Sync + Send + Fn((usize, usize), &mut [T], &[T]), I: Image<T, C>>(
&mut self,
other: &I,
f: F
)
fn for_each2<F: Sync + Send + Fn((usize, usize), &mut [T], &[T]), I: Image<T, C>>(
&mut self,
other: &I,
f: F
)
Iterate over each pixel
source§fn 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)