[][src]Struct ffimage::packed::dynamic::ImageView

pub struct ImageView<'a> { /* fields omitted */ }

Image view parametrized by its pixel type

Implementations

impl<'a> ImageView<'a>[src]

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

Returns an image view with unknown pixel type

Arguments

  • raw - Raw memory region to interpret as typed image
  • width - Width in pixels
  • height - Height in pixels

Example

use ffimage::packed::dynamic::ImageView;

let mem = vec![0; 12];
let view = ImageView::new(&mem, 2, 2);

pub fn with_stride<T: 'static>(
    raw: &'a [T],
    width: u32,
    height: u32,
    stride: usize
) -> Option<Self>
[src]

Returns an image view with unknown pixel type

Arguments

  • raw - Raw memory region to interpret as typed image
  • width - Width in pixels
  • height - Height in pixels
  • stride - Length of a pixel row in bytes

Example

use ffimage::packed::dynamic::ImageView;

let mem: Vec<u8> = vec![0; 12];
let view = ImageView::with_stride(&mem, 2, 2, 6)
    .expect("Memory region too small");

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

Returns the raw memory

pub fn width(&self) -> u32[src]

Returns the width in pixels

pub fn height(&self) -> u32[src]

Returns the height in pixels

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

Returns the length of one image row in bytes

Trait Implementations

impl<'a, '_> From<&'_ ImageView<'a>> for ImageBuffer[src]

impl<'a, T, '_> TryFrom<&'_ ImageView<'a>> for GenericImageView<'a, T> where
    T: Pixel<T = u8>, 
[src]

type Error = ()

The type returned in the event of a conversion error.

Auto Trait Implementations

impl<'a> RefUnwindSafe for ImageView<'a>

impl<'a> Send for ImageView<'a>

impl<'a> Sync for ImageView<'a>

impl<'a> Unpin for ImageView<'a>

impl<'a> UnwindSafe for ImageView<'a>

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.