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,

fn type_id(&self) -> TypeId

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

fn borrow(&self) -> &T

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

fn borrow_mut(&mut self) -> &mut T

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

unsafe fn clone_to_uninit(&self, dest: *mut u8)

impl<T> From<T> for FlatSamples

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> Pointable for FlatSamples

const ALIGN: usize = _;
type Init = T;
unsafe fn init(init: <T as Pointable>::Init) -> usize
unsafe fn deref<'a>(ptr: usize) -> &'a T
unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T
unsafe fn drop(ptr: usize)

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

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

type Owned = T;
fn to_owned(&self) -> T
fn clone_into(&self, target: &mut T)

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

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

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

type Error = never;
fn try_from(value: U) -> Result<T, never>

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

type Error = <U as TryFrom<T>>::Error;
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>