[][src]Struct ffimage::packed::generic::ImageViewMut

pub struct ImageViewMut<'a, T: Pixel> { /* fields omitted */ }

Implementations

impl<'a, T: Pixel> ImageViewMut<'a, T>[src]

pub fn new(raw: &'a mut [T::T], width: u32, height: u32) -> Option<Self>[src]

Returns a flat image buffer with pixel accessors

'Flat' means that the backing memory of the image is not allocated by the struct. Thus, this struct allows for reusing existing (mutable) buffers and still having images defined by their pixel types.

Arguments

  • raw - Raw memory region
  • width - Width in pixels
  • height - Height in pixels

Example

use ffimage::color::rgb::*;
use ffimage::core::GenericImage;
use ffimage::packed::generic::ImageViewMut;

let mut mem = vec![0; 3];
let mut buf = ImageViewMut::<Rgb<u8>>::new(&mut mem, 1, 1)
    .expect("Memory region too small");
let pix = Rgb::<u8>::new([255, 255, 255]);
buf.set_pixel(0, 0, &pix).unwrap();

pub fn raw(&self) -> &[T::T][src]

pub fn raw_mut(&mut self) -> &mut [T::T][src]

pub fn stride(&self) -> usize[src]

Returns the length of one pixel row in bytes

Trait Implementations

impl<'a, T: Pixel, '_> From<&'_ ImageViewMut<'a, T>> for ImageBuffer<T>[src]

impl<'a, T: Pixel + 'a> GenericImage<'a> for ImageViewMut<'a, T>[src]

impl<'a, T: Pixel + 'a> GenericImageView<'a> for ImageViewMut<'a, T>[src]

type T = T

Pixel type

type SubImage = SubImageView<'a, Self>

Type of sub images

impl<'a, T: Pixel> Index<usize> for ImageViewMut<'a, T>[src]

type Output = [T]

The returned type after indexing.

impl<'a, T: Pixel> IndexMut<usize> for ImageViewMut<'a, T>[src]

impl<'a, T: Pixel> IntoIterator for &'a ImageViewMut<'a, T>[src]

type Item = &'a T

The type of the elements being iterated over.

type IntoIter = PixelIter<'a, ImageViewMut<'a, T>>

Which kind of iterator are we turning this into?

impl<'a, T: Pixel> IntoIterator for &'a mut ImageViewMut<'a, T>[src]

type Item = &'a mut T

The type of the elements being iterated over.

type IntoIter = PixelIterMut<'a, ImageViewMut<'a, T>>

Which kind of iterator are we turning this into?

impl<'a, SP, DP> TryConvert<ImageBuffer<DP>> for ImageViewMut<'a, SP> where
    SP: Pixel,
    DP: Pixel,
    SP: TryConvertSlice<DP>, 
[src]

type Error = ()

impl<'a, 'b, SP, DP> TryConvert<ImageViewMut<'b, DP>> for ImageView<'a, SP> where
    SP: Pixel,
    DP: Pixel,
    SP: TryConvertSlice<DP>, 
[src]

type Error = ()

impl<'a, 'b, SP, DP> TryConvert<ImageViewMut<'b, DP>> for ImageViewMut<'a, SP> where
    SP: Pixel,
    DP: Pixel,
    SP: TryConvertSlice<DP>, 
[src]

type Error = ()

impl<'b, SP, DP> TryConvert<ImageViewMut<'b, DP>> for ImageBuffer<SP> where
    SP: Pixel,
    DP: Pixel,
    SP: TryConvertSlice<DP>, 
[src]

type Error = ()

Auto Trait Implementations

impl<'a, T> RefUnwindSafe for ImageViewMut<'a, T> where
    <T as Pixel>::T: RefUnwindSafe

impl<'a, T> Send for ImageViewMut<'a, T> where
    <T as Pixel>::T: Send

impl<'a, T> Sync for ImageViewMut<'a, T> where
    <T as Pixel>::T: Sync

impl<'a, T> Unpin for ImageViewMut<'a, T>

impl<'a, T> !UnwindSafe for ImageViewMut<'a, T>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.