Skip to main content

PlaneViewMut

Struct PlaneViewMut 

Source
pub struct PlaneViewMut<'a> { /* private fields */ }
Expand description

Full re-export of zenpixels core types (zero module name collisions!). Validated mutable borrowed view of one plane.

Implementations§

Source§

impl<'a> PlaneViewMut<'a>

Source

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.

Source

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.

Source

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).

Source

pub const fn format(&self) -> PlaneFormat

Plane specification.

Source

pub const fn width(&self) -> u32

Plane width in elements.

Source

pub const fn height(&self) -> u32

Plane height in rows.

Source

pub const fn stride_bytes(&self) -> usize

Row stride in bytes.

Source

pub fn data(&self) -> &[u8] ⓘ

Immutable strided backing byte slice.

Source

pub fn data_mut(&mut self) -> &mut [u8] ⓘ

Mutable strided backing byte slice.

Source

pub fn into_data_mut(self) -> &'a mut [u8] ⓘ

Consume this mutable view and return the underlying strided backing slice tied to 'a.

Source

pub fn row(&self, y: u32) -> &[u8] ⓘ

Immutable active bytes of row y.

Source

pub fn row_mut(&mut self, y: u32) -> &mut [u8] ⓘ

Mutable active bytes of row y.

Source

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)).

Source

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)).

Source

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().

Source

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.

Source

pub fn as_view(&self) -> PlaneView<'_>

Borrow as an immutable PlaneView.

Source

pub fn into_view(self) -> PlaneView<'a>

Downgrade into an immutable PlaneView<'a> retaining 'a.

Source

pub fn crop_mut( &mut self, rect: PixelRect, ) -> Result<PlaneViewMut<'_>, At<BufferError>>

Zero-copy mutable rectangular crop of this single plane.

Source

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.

Source

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.

Source

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<'_>

Source

pub fn hash_with(&self, inclusions: HashInclusions) -> u64

Compute a portable, endian- and stride-independent XXH3 fingerprint of this mutable plane.

Trait Implementations§

Source§

impl<'a> Debug for PlaneViewMut<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> !UnwindSafe for PlaneViewMut<'a>

§

impl<'a> Freeze for PlaneViewMut<'a>

§

impl<'a> RefUnwindSafe for PlaneViewMut<'a>

§

impl<'a> Send for PlaneViewMut<'a>

§

impl<'a> Sync for PlaneViewMut<'a>

§

impl<'a> Unpin for PlaneViewMut<'a>

§

impl<'a> UnsafeUnpin for PlaneViewMut<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.