Struct framing::Chunky
[−]
[src]
pub struct Chunky<T, V = Vec<u8>> { /* fields omitted */ }
A chunky frame.
In this format, each pixel is stored contiguously, and the entire image is stored in row-major order. For example, this means that an RGBA image would store the RGBA values of the top-left pixel, then each of the RGBA values of the pixel immediately to the right, and so on, moving down through each row.
Methods
impl<T, V> Chunky<T, V>
[src]
fn from_bytes(width: usize, height: usize, bytes: V) -> Self where
T: AsBytes,
V: AsRef<[u8]>,
T: AsBytes,
V: AsRef<[u8]>,
Creates a new frame backed by the provided byte source.
Panics
Panics if the length of the buffer is not
width * height * bytes_per_pixel
.
fn bytes(&self) -> &V
Returns a read-only view into the frame's byte source.
fn into_bytes(self) -> V
Recovers the byte source.
fn bytes_mut(&mut self) -> &mut [u8] where
V: AsMut<[u8]>,
V: AsMut<[u8]>,
Returns a mutable view into the frame's byte source.
fn copy_from<U>(&mut self, frame: U) where
T: AsBytes,
U: Image<Pixel = T> + Sync,
V: AsMut<[u8]>,
T: AsBytes,
U: Image<Pixel = T> + Sync,
V: AsMut<[u8]>,
Set the frame's contents to that of the given frame.
Panics
Panics if the width and height of the given frame are not exactly the same as the width and height of the chunky frame.
impl<T> Chunky<T> where
T: AsBytes,
[src]
T: AsBytes,
fn new<U>(frame: U) -> Self where
U: Image<Pixel = T> + Sync,
U: Image<Pixel = T> + Sync,
Creates a new frame using the given frame to fill the buffer.
It is guaranteed that the mapping will be called exactly once for
each of the integers in the range [0, width) * [0, height)
.
Trait Implementations
impl<T: Clone, V: Clone> Clone for Chunky<T, V>
[src]
fn clone(&self) -> Chunky<T, V>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl<T: Debug, V: Debug> Debug for Chunky<T, V>
[src]
impl<T, V> Image for Chunky<T, V> where
T: AsBytes,
V: AsRef<[u8]>,
[src]
T: AsBytes,
V: AsRef<[u8]>,
type Pixel = T
The kind of pixel that the frame is made of.
fn width(&self) -> usize
The width of the frame in pixels.
fn height(&self) -> usize
The height of the frame in pixels.
unsafe fn pixel(&self, x: usize, y: usize) -> Self::Pixel
Gets the pixel at the specified zero-indexed coordinates. Read more