pub struct PlaneViewMut<'a> { /* private fields */ }Expand description
Validated mutable borrowed view of one plane.
Implementations§
Source§impl<'a> PlaneViewMut<'a>
impl<'a> PlaneViewMut<'a>
Sourcepub fn new(
data: &'a mut [u8],
width: u32,
height: u32,
stride_bytes: usize,
format: PlaneFormat,
) -> Result<PlaneViewMut<'a>, At<BufferError>>
pub fn new( data: &'a mut [u8], width: u32, height: u32, stride_bytes: usize, format: PlaneFormat, ) -> Result<PlaneViewMut<'a>, At<BufferError>>
Construct a validated mutable borrowed plane view.
Sourcepub fn from_samples<S>(
samples: &'a mut [S],
width: u32,
height: u32,
format: PlaneFormat,
) -> Result<PlaneViewMut<'a>, At<BufferError>>where
S: StorageSample,
pub fn from_samples<S>(
samples: &'a mut [S],
width: u32,
height: u32,
format: PlaneFormat,
) -> Result<PlaneViewMut<'a>, At<BufferError>>where
S: StorageSample,
Construct a validated mutable borrowed plane view from a tightly packed typed sample
slice (&mut [u8], &mut [u16], &mut [f32], etc.) zero-copy.
Row stride is derived automatically as width * format.components() samples (e.g. width
for luma Y, width * 2 for semi-planar CbCr). For padded row strides, use
from_samples_strided.
Sourcepub fn from_samples_strided<S>(
samples: &'a mut [S],
width: u32,
height: u32,
stride: SampleStride,
format: PlaneFormat,
) -> Result<PlaneViewMut<'a>, At<BufferError>>where
S: StorageSample,
pub fn from_samples_strided<S>(
samples: &'a mut [S],
width: u32,
height: u32,
stride: SampleStride,
format: PlaneFormat,
) -> Result<PlaneViewMut<'a>, At<BufferError>>where
S: StorageSample,
Construct a validated mutable borrowed plane view from a strided typed sample slice
(&mut [u8], &mut [u16], &mut [f32], etc.) zero-copy with an explicit
SampleStride measured in S elements (NOT bytes).
Sourcepub const fn format(&self) -> PlaneFormat
pub const fn format(&self) -> PlaneFormat
Plane specification.
Sourcepub const fn stride_bytes(&self) -> usize
pub const fn stride_bytes(&self) -> usize
Row stride in bytes.
Sourcepub fn into_data_mut(self) -> &'a mut [u8] ⓘ
pub fn into_data_mut(self) -> &'a mut [u8] ⓘ
Consume this mutable view and return the underlying strided backing slice tied to 'a.
Sourcepub fn row_as<S>(&self, y: u32) -> Result<&[S], At<BufferError>>where
S: StorageSample,
pub fn row_as<S>(&self, y: u32) -> Result<&[S], At<BufferError>>where
S: StorageSample,
Zero-copy typed slice view of row y (e.g. plane.row_as::<u16>(y)).
Sourcepub fn row_as_mut<S>(&mut self, y: u32) -> Result<&mut [S], At<BufferError>>where
S: StorageSample,
pub fn row_as_mut<S>(&mut self, y: u32) -> Result<&mut [S], At<BufferError>>where
S: StorageSample,
Zero-copy mutable typed slice view of row y (e.g. plane.row_as_mut::<u16>(y)).
Sourcepub fn into_code_plane_mut(
self,
component: usize,
) -> Result<CodePlaneMut<'a>, CodePlaneError>
pub fn into_code_plane_mut( self, component: usize, ) -> Result<CodePlaneMut<'a>, CodePlaneError>
Convert component of this mutable plane into a zero-copy CodePlaneMut<'a> using
the SampleEncoding implied by self.format().
Sourcepub fn into_code_plane_mut_with(
self,
component: usize,
encoding: SampleEncoding,
) -> Result<CodePlaneMut<'a>, CodePlaneError>
pub fn into_code_plane_mut_with( self, component: usize, encoding: SampleEncoding, ) -> Result<CodePlaneMut<'a>, CodePlaneError>
Convert component of this mutable plane into a zero-copy CodePlaneMut<'a> with an
explicit SampleEncoding.
Sourcepub fn into_view(self) -> PlaneView<'a>
pub fn into_view(self) -> PlaneView<'a>
Downgrade into an immutable PlaneView<'a> retaining 'a.
Sourcepub fn crop_mut(
&mut self,
rect: PixelRect,
) -> Result<PlaneViewMut<'_>, At<BufferError>>
pub fn crop_mut( &mut self, rect: PixelRect, ) -> Result<PlaneViewMut<'_>, At<BufferError>>
Zero-copy mutable rectangular crop of this single plane.
Sourcepub fn into_crop(
self,
rect: PixelRect,
) -> Result<PlaneViewMut<'a>, At<BufferError>>
pub fn into_crop( self, rect: PixelRect, ) -> Result<PlaneViewMut<'a>, At<BufferError>>
Consume this mutable plane view and narrow it to a rectangular crop retaining 'a.
Sourcepub fn sub_rows_mut(
&mut self,
start_y: u32,
row_count: u32,
) -> Result<PlaneViewMut<'_>, At<BufferError>>
pub fn sub_rows_mut( &mut self, start_y: u32, row_count: u32, ) -> Result<PlaneViewMut<'_>, At<BufferError>>
Zero-copy mutable full-width horizontal strip of this single plane.
Sourcepub fn into_sub_rows(
self,
start_y: u32,
row_count: u32,
) -> Result<PlaneViewMut<'a>, At<BufferError>>
pub fn into_sub_rows( self, start_y: u32, row_count: u32, ) -> Result<PlaneViewMut<'a>, At<BufferError>>
Consume this mutable plane view and narrow it to a full-width horizontal strip retaining 'a.
Source§impl PlaneViewMut<'_>
impl PlaneViewMut<'_>
Sourcepub fn hash_with(&self, inclusions: HashInclusions) -> u64
pub fn hash_with(&self, inclusions: HashInclusions) -> u64
Compute a portable, endian- and stride-independent XXH3 fingerprint of this mutable plane.