pub struct PixelBuffer { /* private fields */ }Expand description
PixelBuffer owns decoded CPU samples and their row layout.
Uploading consumes the allocation, normalizing channels and alpha in place before transfer, so a decoder hands over whatever layout it produced without an extra copy.
Implementations§
Source§impl PixelBuffer
impl PixelBuffer
Sourcepub fn new(
layout: PixelLayout,
pixels: Vec<u8>,
) -> Result<PixelBuffer, ImageError>
pub fn new( layout: PixelLayout, pixels: Vec<u8>, ) -> Result<PixelBuffer, ImageError>
new takes ownership of an existing CPU allocation without copying its contents.
Sourcepub fn layout(&self) -> PixelLayout
pub fn layout(&self) -> PixelLayout
layout returns the dimensions and stride the samples follow.
Sourcepub fn into_bytes(self) -> Vec<u8> ⓘ
pub fn into_bytes(self) -> Vec<u8> ⓘ
into_bytes returns the samples’ allocation, rows layout().row_bytes apart.
Auto Trait Implementations§
impl Forget for PixelBuffer
impl Freeze for PixelBuffer
impl Move for PixelBuffer
impl RefUnwindSafe for PixelBuffer
impl Send for PixelBufferwhere
RawVecInner: Send,
impl Sync for PixelBufferwhere
RawVecInner: Sync,
impl Unpin for PixelBuffer
impl UnsafeUnpin for PixelBuffer
impl UnwindSafe for PixelBufferwhere
RawVecInner: UnwindSafe,
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