Enum exr::image::FlatSamples
source · pub enum FlatSamples {
F16(Vec<f16>),
F32(Vec<f32>),
U32(Vec<u32>),
}
Expand description
A vector of non-deep values (one value per pixel per channel).
Stores row after row in a single vector.
The precision of all values is either f16
, f32
or u32
.
Since this is close to the pixel layout in the byte file,
this will most likely be the fastest storage.
Using a different storage, for example SpecificChannels
,
will probably be slower.
Variants§
F16(Vec<f16>)
A vector of non-deep f16
values.
F32(Vec<f32>)
A vector of non-deep f32
values.
U32(Vec<u32>)
A vector of non-deep u32
values.
Implementations§
source§impl FlatSamples
impl FlatSamples
sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
The number of samples in the image. Should be the width times the height. Might vary when subsampling is used.
sourcepub fn values_as_f32<'s>(&'s self) -> impl 's + Iterator<Item = f32>
pub fn values_as_f32<'s>(&'s self) -> impl 's + Iterator<Item = f32>
Views all samples in this storage as f32. Matches the underlying sample type again for every sample, match yourself if performance is critical! Does not allocate.
sourcepub fn values<'s>(&'s self) -> impl 's + Iterator<Item = Sample>
pub fn values<'s>(&'s self) -> impl 's + Iterator<Item = Sample>
All samples in this storage as iterator. Matches the underlying sample type again for every sample, match yourself if performance is critical! Does not allocate.
sourcepub fn value_by_flat_index(&self, index: usize) -> Sample
pub fn value_by_flat_index(&self, index: usize) -> Sample
Lookup a single value, by flat index.
The flat index can be obtained using Vec2::flatten_for_width
which computes the index in a flattened array of pixel rows.
Trait Implementations§
source§impl Clone for FlatSamples
impl Clone for FlatSamples
source§fn clone(&self) -> FlatSamples
fn clone(&self) -> FlatSamples
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for FlatSamples
impl Debug for FlatSamples
source§impl PartialEq for FlatSamples
impl PartialEq for FlatSamples
source§fn eq(&self, other: &FlatSamples) -> bool
fn eq(&self, other: &FlatSamples) -> bool
self
and other
values to be equal, and is used
by ==
.