Struct exr::image::SpecificChannels

source ·
pub struct SpecificChannels<Pixels, ChannelsDescription> {
    pub channels: ChannelsDescription,
    pub pixels: Pixels,
}
Expand description

A grid of pixels. The pixels are written to your custom pixel storage. PixelStorage can be anything, from a flat Vec<f16> to Vec<Vec<AnySample>>, as desired. In order to write this image to a file, your PixelStorage must implement GetPixel.

Fields§

§channels: ChannelsDescription

A description of the channels in the file, as opposed to the channels in memory. Should always be a tuple containing ChannelDescriptions, one description for each channel.

§pixels: Pixels

Your custom pixel storage

Implementations§

source§

impl<SampleStorage, Channels> SpecificChannels<SampleStorage, Channels>

source

pub fn new(channels: Channels, source_samples: SampleStorage) -> Self
where SampleStorage: GetPixel, SampleStorage::Pixel: IntoRecursive, Channels: Sync + Clone + IntoRecursive, <Channels as IntoRecursive>::Recursive: WritableChannelsDescription<<SampleStorage::Pixel as IntoRecursive>::Recursive>,

Create some pixels with channel information. The Channels must be a tuple containing either ChannelDescription or Option<ChannelDescription>. The length of the tuple dictates the number of channels in the sample storage.

source§

impl SpecificChannels<(), ()>

source

pub fn build() -> SpecificChannelsBuilder<NoneMore, NoneMore>

Start building some specific channels. On the result of this function, call with_named_channel as many times as desired, and then call with_pixels to define the colors.

source§

impl<SampleStorage> SpecificChannels<SampleStorage, (ChannelDescription, ChannelDescription, ChannelDescription, ChannelDescription)>

source

pub fn rgba<R, G, B, A>(source_samples: SampleStorage) -> Self
where R: IntoSample, G: IntoSample, B: IntoSample, A: IntoSample, SampleStorage: GetPixel<Pixel = (R, G, B, A)>,

Create an image with red, green, blue, and alpha channels. You can pass a closure that returns a color for each pixel (Fn(Vec2<usize>) -> (R,G,B,A)), or you can pass your own image if it implements GetPixel<Pixel=(R,G,B,A)>. Each of R, G, B and A can be either f16, f32, u32, or Sample.

source§

impl<SampleStorage> SpecificChannels<SampleStorage, (ChannelDescription, ChannelDescription, ChannelDescription)>

source

pub fn rgb<R, G, B>(source_samples: SampleStorage) -> Self
where R: IntoSample, G: IntoSample, B: IntoSample, SampleStorage: GetPixel<Pixel = (R, G, B)>,

Create an image with red, green, and blue channels. You can pass a closure that returns a color for each pixel (Fn(Vec2<usize>) -> (R,G,B)), or you can pass your own image if it implements GetPixel<Pixel=(R,G,B)>. Each of R, G and B can be either f16, f32, u32, or Sample.

Trait Implementations§

source§

impl<Pixels: Clone, ChannelsDescription: Clone> Clone for SpecificChannels<Pixels, ChannelsDescription>

source§

fn clone(&self) -> SpecificChannels<Pixels, ChannelsDescription>

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<Pixels: Debug, ChannelsDescription: Debug> Debug for SpecificChannels<Pixels, ChannelsDescription>

source§

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

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

impl<Pixels: PartialEq, ChannelsDescription: PartialEq> PartialEq for SpecificChannels<Pixels, ChannelsDescription>

source§

fn eq(&self, other: &SpecificChannels<Pixels, ChannelsDescription>) -> 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<Pxs, Chans> ValidateResult for SpecificChannels<Pxs, Chans>
where Pxs: ValidateResult, Chans: Eq,

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<'c, Channels, Storage> WritableChannels<'c> for SpecificChannels<Storage, Channels>
where Storage: 'c + GetPixel, Storage::Pixel: IntoRecursive, Channels: 'c + Sync + Clone + IntoRecursive, <Channels as IntoRecursive>::Recursive: WritableChannelsDescription<<Storage::Pixel as IntoRecursive>::Recursive>,

source§

fn infer_channel_list(&self) -> ChannelList

Generate the file meta data for this list of channel
source§

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

Generate the file meta data of whether and how resolution levels should be stored in the file
§

type Writer = SpecificChannelsWriter<'c, <<Channels as IntoRecursive>::Recursive as WritableChannelsDescription<<<Storage as GetPixel>::Pixel as IntoRecursive>::Recursive>>::RecursiveWriter, Storage, Channels>

The type of temporary writer
source§

fn create_writer(&'c self, header: &Header) -> Self::Writer

Create a temporary writer for this list of channels
source§

impl<Pixels: Eq, ChannelsDescription: Eq> Eq for SpecificChannels<Pixels, ChannelsDescription>

source§

impl<Pixels, ChannelsDescription> StructuralPartialEq for SpecificChannels<Pixels, ChannelsDescription>

Auto Trait Implementations§

§

impl<Pixels, ChannelsDescription> Freeze for SpecificChannels<Pixels, ChannelsDescription>
where ChannelsDescription: Freeze, Pixels: Freeze,

§

impl<Pixels, ChannelsDescription> RefUnwindSafe for SpecificChannels<Pixels, ChannelsDescription>
where ChannelsDescription: RefUnwindSafe, Pixels: RefUnwindSafe,

§

impl<Pixels, ChannelsDescription> Send for SpecificChannels<Pixels, ChannelsDescription>
where ChannelsDescription: Send, Pixels: Send,

§

impl<Pixels, ChannelsDescription> Sync for SpecificChannels<Pixels, ChannelsDescription>
where ChannelsDescription: Sync, Pixels: Sync,

§

impl<Pixels, ChannelsDescription> Unpin for SpecificChannels<Pixels, ChannelsDescription>
where ChannelsDescription: Unpin, Pixels: Unpin,

§

impl<Pixels, ChannelsDescription> UnwindSafe for SpecificChannels<Pixels, ChannelsDescription>
where ChannelsDescription: UnwindSafe, Pixels: UnwindSafe,

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where 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 T
where 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 T
where 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 T
where 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 T
where 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.