[−][src]Struct ffimage::packed::dynamic::ImageBuffer
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 pixelsheight
- Height in pixelschannels
- Number of channelstyp
- 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]
width: u32,
height: u32,
raw: Vec<T>
) -> Option<Self>
Returns an image buffer with unknown pixel type
Arguments
width
- Width in pixelsheight
- Height in pixelstyp
- Storage typeraw
- 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
impl RefUnwindSafe for ImageBuffer
impl Send for ImageBuffer
impl Sync for ImageBuffer
impl Unpin for ImageBuffer
impl UnwindSafe for ImageBuffer
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,