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<'_>
impl CodePlaneMut<'_>
Sourcepub fn hash_with(&self, inclusions: HashInclusions) -> u64
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>
impl<'a> CodePlaneMut<'a>
Sourcepub fn from_u8_mut(
data: &'a mut [u8],
width_pixels: usize,
height: usize,
stride_words: usize,
encoding: SampleEncoding,
) -> Result<CodePlaneMut<'a>, CodePlaneError>
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).
Sourcepub fn component_from_u8_mut(
data: &'a mut [u8],
layout: InterleavedCodeLayout,
encoding: SampleEncoding,
) -> Result<CodePlaneMut<'a>, CodePlaneError>
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.
Sourcepub fn from_u16_mut(
data: &'a mut [u16],
width_pixels: usize,
height: usize,
stride_words: usize,
encoding: SampleEncoding,
) -> Result<CodePlaneMut<'a>, CodePlaneError>
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).
Sourcepub fn component_from_u16_mut(
data: &'a mut [u16],
layout: InterleavedCodeLayout,
encoding: SampleEncoding,
) -> Result<CodePlaneMut<'a>, CodePlaneError>
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.
Sourcepub fn from_plane_view_mut(
plane: PlaneViewMut<'a>,
component_index: usize,
encoding: SampleEncoding,
) -> Result<CodePlaneMut<'a>, CodePlaneError>
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.
Sourcepub const fn preserving_other_bits(self) -> CodePlaneMut<'a>
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.
Sourcepub const fn encoding(&self) -> SampleEncoding
pub const fn encoding(&self) -> SampleEncoding
Storage width, code depth, and bit placement.
Sourcepub fn code(&self, x: usize, y: usize) -> Option<u16>
pub fn code(&self, x: usize, y: usize) -> Option<u16>
Extract one code, ignoring padding bits; outside the active plane returns None.
Sourcepub fn read_codes(
&self,
x: usize,
y: usize,
codes: &mut [u16],
) -> Result<(), CodePlaneError>
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.
Sourcepub fn set_code(
&mut self,
x: usize,
y: usize,
code: u16,
) -> Result<(), CodePlaneError>
pub fn set_code( &mut self, x: usize, y: usize, code: u16, ) -> Result<(), CodePlaneError>
Write one code at (x, y). Validated before mutating.
Sourcepub fn write_codes(
&mut self,
x: usize,
y: usize,
codes: &[u16],
) -> Result<(), CodePlaneError>
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.