pub struct PixelRows<'p> {
pub layout: PixelLayout,
pub data: &'p [u8],
pub width: u32,
pub height: u32,
pub stride: usize,
}Expand description
Strided rows of packed pixels, the input of Picture::import and of the
simple functions.
stride counts elements of the slice’s type, which for data: &[u8] are
bytes: at least width * layout.bytes_per_pixel(), at most i32::MAX.
data holds at least (height - 1) * stride + width * bytes_per_pixel
bytes; the bytes between rows are not read.
§Examples
use webp::api::encode::{PixelLayout, PixelRows};
// 3 by 2 BGR pixels with rows padded to 12 bytes.
let data = [0_u8; 12 + 9];
let rows = PixelRows { layout: PixelLayout::Bgr, data: &data, width: 3, height: 2, stride: 12 };
assert_eq!(rows.stride, 12);Fields§
§layout: PixelLayoutThe order of the channels.
data: &'p [u8]The rows, top to bottom.
width: u32The pixels of a row, 1 to 16383.
height: u32The rows, 1 to 16383.
stride: usizeThe distance from the start of a row to the next, in bytes.
Trait Implementations§
Auto Trait Implementations§
impl<'p> Forget for PixelRows<'p>
impl<'p> Freeze for PixelRows<'p>
impl<'p> Move for PixelRows<'p>
impl<'p> RefUnwindSafe for PixelRows<'p>
impl<'p> Send for PixelRows<'p>
impl<'p> Sync for PixelRows<'p>
impl<'p> Unpin for PixelRows<'p>
impl<'p> UnsafeUnpin for PixelRows<'p>
impl<'p> UnwindSafe for PixelRows<'p>
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