Enum FlatSamples

pub enum FlatSamples

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

impl FlatSamples

fn len(&self) -> usize

The number of samples in the image. Should be the width times the height. Might vary when subsampling is used.

fn values_as_f32(&self) -> impl '_ + 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.

fn values(&self) -> impl '_ + 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.

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

impl Clone for FlatSamples

fn clone(&self) -> Self

impl Debug for FlatSamples

fn fmt(&self, formatter: &mut Formatter<'_>) -> Result

impl PartialEq for FlatSamples

fn eq(&self, other: &Self) -> bool

impl StructuralPartialEq for FlatSamples

impl ValidateResult for FlatSamples

fn validate_result(&self, other: &Self, options: ValidationOptions, location: impl Fn() -> String) -> ValidationResult

impl<'samples> WritableLevel<'samples> for FlatSamples

type Writer = FlatSamplesWriter<'samples>;
fn sample_type(&self) -> SampleType
fn create_level_writer(&'samples self, size: Vec2<usize>) -> Self::Writer

impl<'samples> WritableSamples<'samples> for FlatSamples

type Writer = FlatSamplesWriter<'samples>;
fn sample_type(&self) -> SampleType
fn infer_level_modes(&self) -> (LevelMode, RoundingMode)
fn create_samples_writer(&'samples self, header: &Header) -> Self::Writer

Auto Trait Implementations

impl Freeze for FlatSamples

impl RefUnwindSafe for FlatSamples

impl Send for FlatSamples

impl Sync for FlatSamples

impl Unpin for FlatSamples

impl UnsafeUnpin for FlatSamples

impl UnwindSafe for FlatSamples

Blanket Implementations

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for FlatSamples where ST: ?Sized, DT: ?Sized,

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for FlatSamples where ST: ?Sized, DT: ?Sized,

impl<T> Any for FlatSamples where T: 'static + ?Sized,

impl<T> Borrow<T> for FlatSamples where T: ?Sized,

impl<T> BorrowMut<T> for FlatSamples where T: ?Sized,

impl<T> CloneToUninit for FlatSamples where T: Clone,

impl<T> From<T> for FlatSamples

impl<T> Pointable for FlatSamples

impl<T> Read<Exclusive, BecauseExclusive> for FlatSamples where T: ?Sized,

impl<T> ToOwned for FlatSamples where T: Clone,

impl<T, U> Into<U> for FlatSamples where U: From<T>,

impl<T, U> TryFrom<U> for FlatSamples where U: Into<T>,

impl<T, U> TryInto<U> for FlatSamples where U: TryFrom<T>,