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

source

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.

source

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.

source

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.

source

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

source§

fn clone(&self) -> FlatSamples

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for FlatSamples

source§

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

Formats the value using the given formatter. Read more
source§

impl PartialEq<FlatSamples> for FlatSamples

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl ValidateResult for FlatSamples

source§

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

Compare self with the other. Exceptional behaviour: Read more
source§

fn assert_equals_result(&self, result: &Self)

Compare self with the other. Panics if not equal. Read more
source§

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

source§

fn sample_type(&self) -> SampleType

Generate the file meta data regarding the number type of these samples
§

type Writer = FlatSamplesWriter<'samples>

The type of the temporary writer for this single level of samples
source§

fn create_level_writer(&'samples self, size: Vec2<usize>) -> Self::Writer

Create a temporary writer for this single level of samples
source§

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

source§

fn sample_type(&self) -> SampleType

Generate the file meta data regarding the number type of this storage
source§

fn infer_level_modes(&self) -> (LevelMode, RoundingMode)

Generate the file meta data regarding resolution levels
§

type Writer = FlatSamplesWriter<'samples>

The type of the temporary writer for this sample storage
source§

fn create_samples_writer(&'samples self, header: &Header) -> Self::Writer

Create a temporary writer for this sample storage
source§

impl StructuralPartialEq for FlatSamples

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

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

source§

impl<T> Pointable for T

source§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

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

Performs the conversion.