pub struct CodePlane<'a> { /* private fields */ }Expand description
Full re-export of zenpixels core types (zero module name collisions!).
Integer codes of one component in a borrowed plane, without normalization or color claims.
Code depth and bit placement come from SampleEncoding; padding bits are
ignored on read. Nothing is copied or allocated.
Implementations§
Source§impl CodePlane<'_>
impl CodePlane<'_>
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 plane.
Source§impl<'a> CodePlane<'a>
impl<'a> CodePlane<'a>
Sourcepub fn from_u8(
data: &'a [u8],
width_pixels: usize,
height: usize,
stride_words: usize,
encoding: SampleEncoding,
) -> Result<CodePlane<'a>, CodePlaneError>
pub fn from_u8( data: &'a [u8], width_pixels: usize, height: usize, stride_words: usize, encoding: SampleEncoding, ) -> Result<CodePlane<'a>, CodePlaneError>
Borrow a single-component u8 plane (stride_words >= width_pixels).
Sourcepub fn component_from_u8(
data: &'a [u8],
layout: InterleavedCodeLayout,
encoding: SampleEncoding,
) -> Result<CodePlane<'a>, CodePlaneError>
pub fn component_from_u8( data: &'a [u8], layout: InterleavedCodeLayout, encoding: SampleEncoding, ) -> Result<CodePlane<'a>, CodePlaneError>
Borrow one component of an interleaved u8 plane described by layout.
Sourcepub fn from_u16(
data: &'a [u16],
width_pixels: usize,
height: usize,
stride_words: usize,
encoding: SampleEncoding,
) -> Result<CodePlane<'a>, CodePlaneError>
pub fn from_u16( data: &'a [u16], width_pixels: usize, height: usize, stride_words: usize, encoding: SampleEncoding, ) -> Result<CodePlane<'a>, CodePlaneError>
Borrow a single-component u16 plane (stride_words >= width_pixels).
Sourcepub fn component_from_u16(
data: &'a [u16],
layout: InterleavedCodeLayout,
encoding: SampleEncoding,
) -> Result<CodePlane<'a>, CodePlaneError>
pub fn component_from_u16( data: &'a [u16], layout: InterleavedCodeLayout, encoding: SampleEncoding, ) -> Result<CodePlane<'a>, CodePlaneError>
Borrow one component of an interleaved u16 plane described by layout.
Sourcepub fn from_plane_view(
plane: PlaneView<'a>,
component_index: usize,
encoding: SampleEncoding,
) -> Result<CodePlane<'a>, CodePlaneError>
pub fn from_plane_view( plane: PlaneView<'a>, component_index: usize, encoding: SampleEncoding, ) -> Result<CodePlane<'a>, CodePlaneError>
Borrow component component_index from a validated PlaneView<'a> zero-copy.
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.
Padding bits are ignored. Validates bounds before writing; on error codes is unchanged.