Struct ImageMutRef

Source
pub struct ImageMutRef<'a, C> { /* private fields */ }
Expand description

Mutable reference to an image or another mutable reference

Implementations§

Source§

impl<'a, P> ImageMutRef<'a, P>

Source

pub fn new(shape: Shape, data: &'a mut [P]) -> Self

Trait Implementations§

Source§

impl<C> Debug for ImageMutRef<'_, C>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<P> Image for ImageMutRef<'_, P>

Source§

type Pixel = P

Pixel type
Source§

fn shape(&self) -> Shape

Shape of the image
Source§

fn data(&self) -> &[Self::Pixel]

Data containing image
Source§

fn size(&self) -> Size

Image size
Source§

fn width(&self) -> usize

Image width
Source§

fn height(&self) -> usize

Image height
Source§

fn get(&self, row: usize, col: usize) -> Option<&Self::Pixel>

Get pixel at the specified row and column
Source§

fn view( &self, row_min: usize, row_max: usize, col_min: usize, col_max: usize, ) -> ImageRef<'_, Self::Pixel>

Create sub-image bounded by constraints, _max values are not inclusive.
Source§

fn as_ref(&self) -> ImageRef<'_, Self::Pixel>

Create immutable view to the image of the concrete type of ImageRef
Source§

fn iter(&self) -> ImageIter<'_, Self::Pixel>

Iterate over pixels
Source§

fn write_rgba<W>(&self, out: W) -> Result<(), Error>
where W: Write, Self::Pixel: Color, Self: Sized,

Write raw RGBA data
Source§

fn write_ppm<W>(&self, out: W) -> Result<(), Error>
where W: Write, Self::Pixel: Color, Self: Sized,

Write image in PPM format
Source§

fn write_bmp<W>(&self, out: W) -> Result<(), Error>
where W: Write, Self::Pixel: Color, Self: Sized,

Write image in BMP format
Source§

impl<P> ImageMut for ImageMutRef<'_, P>

Source§

fn data_mut(&mut self) -> &mut [Self::Pixel]

Get a mutable slice of image data
Source§

fn get_mut(&mut self, row: usize, col: usize) -> Option<&mut Self::Pixel>

Get a mutable reference to the specified pixel
Source§

fn view_mut( &mut self, row_min: usize, row_max: usize, col_min: usize, col_max: usize, ) -> ImageMutRef<'_, Self::Pixel>

Create mutable sub-image bounded by constraints, _max values are not inclusive.
Source§

fn as_mut(&mut self) -> ImageMutRef<'_, Self::Pixel>

Create concrete type reference to the image
Source§

fn clear(&mut self)
where Self::Pixel: Default,

Fill image with the default pixel value
Source§

fn iter_mut(&mut self) -> ImageMutIter<'_, Self::Pixel>

Create iterator over mutable references to all the pixel of the image

Auto Trait Implementations§

§

impl<'a, C> Freeze for ImageMutRef<'a, C>

§

impl<'a, C> RefUnwindSafe for ImageMutRef<'a, C>
where C: RefUnwindSafe,

§

impl<'a, C> Send for ImageMutRef<'a, C>
where C: Send,

§

impl<'a, C> Sync for ImageMutRef<'a, C>
where C: Sync,

§

impl<'a, C> Unpin for ImageMutRef<'a, C>

§

impl<'a, C> !UnwindSafe for ImageMutRef<'a, C>

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.