pub struct PlaneView<'a> { /* private fields */ }Expand description
One plane borrowed from a mapping. The stride is in bytes, as in zenpixels; rows exclude padding. Construction checks the geometry, not the samples.
Implementations§
Source§impl<'a> PlaneView<'a>
impl<'a> PlaneView<'a>
Sourcepub fn new(
samples: PlaneSamples<'a>,
width: usize,
height: usize,
stride_bytes: usize,
encoding: SampleEncoding,
) -> Result<PlaneView<'a>, PlaneError>
pub fn new( samples: PlaneSamples<'a>, width: usize, height: usize, stride_bytes: usize, encoding: SampleEncoding, ) -> Result<PlaneView<'a>, PlaneError>
A width x height plane over samples with rows stride_bytes
apart.
§Errors
A PlaneError when the storage does not fit the geometry.
Sourcepub fn stride_bytes(&self) -> usize
pub fn stride_bytes(&self) -> usize
Distance between rows, in bytes.
Sourcepub fn encoding(&self) -> SampleEncoding
pub fn encoding(&self) -> SampleEncoding
The sample encoding.
Sourcepub fn as_strided_samples(&self) -> PlaneSamples<'a>
pub fn as_strided_samples(&self) -> PlaneSamples<'a>
Borrow the strided storage through the last active sample, including padding between rows but excluding trailing allocation space.
Empty geometry returns an empty slice. This does not copy, normalize,
shift or mask samples: consumers must honor Self::encoding and
Self::stride_bytes. Padding has no sample meaning. The borrow is
bounded by the native mapping guard, just like Self::row.
Sourcepub fn row(&self, y: usize) -> Option<PlaneSamples<'a>>
pub fn row(&self, y: usize) -> Option<PlaneSamples<'a>>
Row y, without padding. A zero-width row is empty regardless of stride.