pub struct YuvaPlanes<'a> {
pub y: &'a mut [u8],
pub y_stride: usize,
pub u: &'a mut [u8],
pub v: &'a mut [u8],
pub uv_stride: usize,
pub a: Option<&'a mut [u8]>,
pub a_stride: usize,
}Expand description
The caller’s Y, U, V and optional alpha planes, an Output for
ColorMode::Yuv and ColorMode::Yuva.
Every stride counts bytes. The Y and A planes have height rows of
width samples, the U and V planes (height + 1) / 2 rows of
(width + 1) / 2 samples; each stride is at least its row length and at
most i32::MAX, and each plane holds at least
(rows - 1) * stride + row length bytes. a is given exactly for
ColorMode::Yuva; a_stride is ignored without it.
§Examples
use webp::api::decode::{decode_into, ColorMode, Config, Output, YuvaPlanes};
// A 5 by 3 image: chroma planes of 3 by 2, rows padded to 8 bytes.
let (mut y, mut u, mut v) = (vec![0_u8; 8 * 3], vec![0_u8; 8 * 2], vec![0_u8; 8 * 2]);
let planes = YuvaPlanes {
y: &mut y, y_stride: 8,
u: &mut u, v: &mut v, uv_stride: 8,
a: None, a_stride: 0,
};
decode_into(&file, &Config::new(ColorMode::Yuv), Output::Planes(planes))?;
assert!(y[..5].iter().all(|&luma| (16..=235).contains(&luma)));Fields§
§y: &'a mut [u8]The luma plane.
y_stride: usizeThe distance between luma rows, in bytes.
u: &'a mut [u8]The U (Cb) chroma plane.
v: &'a mut [u8]The V (Cr) chroma plane.
uv_stride: usizeThe distance between rows of both chroma planes, in bytes.
a: Option<&'a mut [u8]>The alpha plane, straight alpha, for ColorMode::Yuva.
a_stride: usizeThe distance between alpha rows, in bytes.
Trait Implementations§
Auto Trait Implementations§
impl<'a> !UnwindSafe for YuvaPlanes<'a>
impl<'a> Forget for YuvaPlanes<'a>
impl<'a> Freeze for YuvaPlanes<'a>
impl<'a> Move for YuvaPlanes<'a>
impl<'a> RefUnwindSafe for YuvaPlanes<'a>
impl<'a> Send for YuvaPlanes<'a>
impl<'a> Sync for YuvaPlanes<'a>
impl<'a> Unpin for YuvaPlanes<'a>
impl<'a> UnsafeUnpin for YuvaPlanes<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more