#[non_exhaustive]pub struct MultiPlaneImage { /* private fields */ }Expand description
A multi-plane image where each plane is an independent pixel buffer.
Combines a PlaneLayout (metadata describing plane count, semantics,
subsampling, and relationship) with actual pixel buffers. Each buffer
corresponds to one plane in the layout.
§Examples
use zenpixels::{MultiPlaneImage, PlaneLayout, ChannelType, PixelBuffer, PixelDescriptor};
let layout = PlaneLayout::ycbcr_444(ChannelType::U8);
let y = PixelBuffer::new(1920, 1080, PixelDescriptor::GRAY8);
let cb = PixelBuffer::new(1920, 1080, PixelDescriptor::GRAY8);
let cr = PixelBuffer::new(1920, 1080, PixelDescriptor::GRAY8);
let img = MultiPlaneImage::new(layout, vec![y, cb, cr]);
assert_eq!(img.plane_count(), 3);
assert!(img.layout().is_ycbcr());Implementations§
Source§impl MultiPlaneImage
impl MultiPlaneImage
Sourcepub fn new(layout: PlaneLayout, buffers: Vec<PixelBuffer>) -> MultiPlaneImage
pub fn new(layout: PlaneLayout, buffers: Vec<PixelBuffer>) -> MultiPlaneImage
Create a new multi-plane image from a layout and corresponding buffers.
§Panics
Debug-asserts that the number of buffers matches the planar plane count.
Sourcepub fn with_origin(self, ctx: Arc<ColorContext>) -> MultiPlaneImage
pub fn with_origin(self, ctx: Arc<ColorContext>) -> MultiPlaneImage
Attach a color context.
Sourcepub fn layout(&self) -> &PlaneLayout
pub fn layout(&self) -> &PlaneLayout
The layout describing this image’s plane organization.
Sourcepub fn plane_count(&self) -> usize
pub fn plane_count(&self) -> usize
Number of planes.
Sourcepub fn buffer(&self, idx: usize) -> Option<&PixelBuffer>
pub fn buffer(&self, idx: usize) -> Option<&PixelBuffer>
Access a single buffer by index.
Sourcepub fn buffer_mut(&mut self, idx: usize) -> Option<&mut PixelBuffer>
pub fn buffer_mut(&mut self, idx: usize) -> Option<&mut PixelBuffer>
Access a single buffer mutably by index.
Sourcepub fn buffers(&self) -> &[PixelBuffer]
pub fn buffers(&self) -> &[PixelBuffer]
Access all buffers.
Sourcepub fn buffers_mut(&mut self) -> &mut [PixelBuffer]
pub fn buffers_mut(&mut self) -> &mut [PixelBuffer]
Access all buffers mutably.
Sourcepub fn origin(&self) -> Option<&Arc<ColorContext>>
pub fn origin(&self) -> Option<&Arc<ColorContext>>
The optional color context shared across all planes.
Auto Trait Implementations§
impl Freeze for MultiPlaneImage
impl RefUnwindSafe for MultiPlaneImage
impl Send for MultiPlaneImage
impl Sync for MultiPlaneImage
impl Unpin for MultiPlaneImage
impl UnsafeUnpin for MultiPlaneImage
impl UnwindSafe for MultiPlaneImage
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