Skip to main content

CodePlaneMut

Struct CodePlaneMut 

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

Full re-export of zenpixels core types (zero module name collisions!). Mutable view of one integer component in a borrowed plane, without normalization or color claims.

Code depth and bit placement come from SampleEncoding. By default, padding bits outside (mask << bit_shift) are zeroed on write; call preserving_other_bits to preserve surrounding bits when packing shared words.

Implementations§

Source§

impl CodePlaneMut<'_>

Source

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

Compute a portable XXH3 fingerprint of the unpacked integer codes in this mutable plane.

Source§

impl<'a> CodePlaneMut<'a>

Source

pub fn from_u8_mut( data: &'a mut [u8], width_pixels: usize, height: usize, stride_words: usize, encoding: SampleEncoding, ) -> Result<CodePlaneMut<'a>, CodePlaneError>

Borrow a single-component mutable u8 plane (stride_words >= width_pixels).

Source

pub fn component_from_u8_mut( data: &'a mut [u8], layout: InterleavedCodeLayout, encoding: SampleEncoding, ) -> Result<CodePlaneMut<'a>, CodePlaneError>

Borrow one component of an interleaved mutable u8 plane described by layout.

Source

pub fn from_u16_mut( data: &'a mut [u16], width_pixels: usize, height: usize, stride_words: usize, encoding: SampleEncoding, ) -> Result<CodePlaneMut<'a>, CodePlaneError>

Borrow a single-component mutable u16 plane (stride_words >= width_pixels).

Source

pub fn component_from_u16_mut( data: &'a mut [u16], layout: InterleavedCodeLayout, encoding: SampleEncoding, ) -> Result<CodePlaneMut<'a>, CodePlaneError>

Borrow one component of an interleaved mutable u16 plane described by layout.

Source

pub fn from_plane_view_mut( plane: PlaneViewMut<'a>, component_index: usize, encoding: SampleEncoding, ) -> Result<CodePlaneMut<'a>, CodePlaneError>

Borrow component component_index mutably from a validated PlaneViewMut<'a> zero-copy.

Source

pub const fn preserving_other_bits(self) -> CodePlaneMut<'a>

Preserve bits outside (mask << bit_shift) in each written sample word instead of zeroing padding bits.

Source

pub const fn width(&self) -> usize

Active samples per row.

Source

pub const fn height(&self) -> usize

Number of active rows.

Source

pub const fn encoding(&self) -> SampleEncoding

Storage width, code depth, and bit placement.

Source

pub fn as_ref(&self) -> CodePlane<'_>

Borrow as a read-only CodePlane.

Source

pub fn code(&self, x: usize, y: usize) -> Option<u16>

Extract one code, ignoring padding bits; outside the active plane returns None.

Source

pub fn read_codes( &self, x: usize, y: usize, codes: &mut [u16], ) -> Result<(), CodePlaneError>

Extract codes.len() consecutive codes of row y starting at column x.

Source

pub fn set_code( &mut self, x: usize, y: usize, code: u16, ) -> Result<(), CodePlaneError>

Write one code at (x, y). Validated before mutating.

Source

pub fn write_codes( &mut self, x: usize, y: usize, codes: &[u16], ) -> Result<(), CodePlaneError>

Write codes.len() consecutive codes on row y starting at column x.

Validates bounds and code range (<= (1 << code_bits) - 1) before writing anything.

Trait Implementations§

Source§

impl<'a> Debug for CodePlaneMut<'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 CodePlaneMut<'a>

§

impl<'a> Freeze for CodePlaneMut<'a>

§

impl<'a> RefUnwindSafe for CodePlaneMut<'a>

§

impl<'a> Send for CodePlaneMut<'a>

§

impl<'a> Sync for CodePlaneMut<'a>

§

impl<'a> Unpin for CodePlaneMut<'a>

§

impl<'a> UnsafeUnpin for CodePlaneMut<'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.