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

pub struct ImageBuffer { /* fields omitted */ }

Image buffer parametrized by its pixel type

Implementations

impl ImageBuffer[src]

pub fn empty(typ: StorageType) -> Self[src]

Returns an empty image buffer

Arguments

  • typ - Storage type

Example

use ffimage::packed::dynamic::{ImageBuffer, StorageType};

let buf = ImageBuffer::empty(StorageType::U8);

pub fn new(width: u32, height: u32, channels: u32, typ: StorageType) -> Self[src]

Returns an image buffer with unknown pixel type

Arguments

  • width - Width in pixels
  • height - Height in pixels
  • channels - Number of channels
  • typ - Storage type

Example

use ffimage::packed::dynamic::{ImageBuffer, StorageType};

let buf = ImageBuffer::new(2, 2, 3, StorageType::U8);

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

Returns an image buffer with unknown pixel type

Arguments

  • width - Width in pixels
  • height - Height in pixels
  • typ - Storage type
  • raw - Raw memory region owned by the instance

Example

use ffimage::packed::dynamic::ImageBuffer;

let mem: Vec<u8> = vec![0; 12];
let buf = ImageBuffer::from_raw(2, 2, mem);

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

Returns the raw memory

pub fn raw_mut(&mut self) -> &mut MemoryBuffer[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

pub fn resize(&mut self, width: u32, height: u32, channels: u32)[src]

pub fn as_view(&self) -> ImageView[src]

Trait Implementations

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

Auto Trait Implementations

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.