Trait exr::image::read::specific_channels::ReadSpecificChannel[][src]

pub trait ReadSpecificChannel: Sized + CheckDuplicates {
    type RecursivePixelReader: RecursivePixelReader;
    fn create_recursive_reader(
        &self,
        channels: &ChannelList
    ) -> Result<Self::RecursivePixelReader>; fn required<Sample>(
        self,
        channel_name: impl Into<Text>
    ) -> ReadRequiredChannel<Self, Sample> { ... }
fn optional<Sample>(
        self,
        channel_name: impl Into<Text>,
        default_sample: Sample
    ) -> ReadOptionalChannel<Self, Sample> { ... }
fn collect_pixels<Pixel, PixelStorage, CreatePixels, SetPixel>(
        self,
        create_pixels: CreatePixels,
        set_pixel: SetPixel
    ) -> CollectPixels<Self, Pixel, PixelStorage, CreatePixels, SetPixel>
    where
        <Self::RecursivePixelReader as RecursivePixelReader>::RecursivePixel: IntoTuple<Pixel>,
        <Self::RecursivePixelReader as RecursivePixelReader>::RecursiveChannelDescriptions: IntoNonRecursive,
        CreatePixels: Fn(Vec2<usize>, &<<Self::RecursivePixelReader as RecursivePixelReader>::RecursiveChannelDescriptions as IntoNonRecursive>::NonRecursive) -> PixelStorage,
        SetPixel: Fn(&mut PixelStorage, Vec2<usize>, Pixel)
, { ... } }
Expand description

Can be attached one more channel reader. Call required or optional on this object to declare another channel to be read from the file. Call collect_pixels at last to define how the previously declared pixels should be stored.

Associated Types

type RecursivePixelReader: RecursivePixelReader[src]

A separate internal reader for the pixels. Will be of type Recursive<_, SampleReader<_>>, depending on the pixels of the specific channel combination.

Required methods

fn create_recursive_reader(
    &self,
    channels: &ChannelList
) -> Result<Self::RecursivePixelReader>
[src]

Create a separate internal reader for the pixels of the specific channel combination.

Provided methods

fn required<Sample>(
    self,
    channel_name: impl Into<Text>
) -> ReadRequiredChannel<Self, Sample>
[src]

Plan to read an additional channel from the image, with the specified name. If the channel cannot be found in the image when the image is read, the image will not be loaded. The generic parameter can usually be inferred from the closure in collect_pixels.

fn optional<Sample>(
    self,
    channel_name: impl Into<Text>,
    default_sample: Sample
) -> ReadOptionalChannel<Self, Sample>
[src]

Plan to read an additional channel from the image, with the specified name. If the file does not contain this channel, the specified default sample will be returned instead. You can check whether the channel has been loaded by checking the presence of the optional channel description before instantiating your own image. The generic parameter can usually be inferred from the closure in collect_pixels.

fn collect_pixels<Pixel, PixelStorage, CreatePixels, SetPixel>(
    self,
    create_pixels: CreatePixels,
    set_pixel: SetPixel
) -> CollectPixels<Self, Pixel, PixelStorage, CreatePixels, SetPixel> where
    <Self::RecursivePixelReader as RecursivePixelReader>::RecursivePixel: IntoTuple<Pixel>,
    <Self::RecursivePixelReader as RecursivePixelReader>::RecursiveChannelDescriptions: IntoNonRecursive,
    CreatePixels: Fn(Vec2<usize>, &<<Self::RecursivePixelReader as RecursivePixelReader>::RecursiveChannelDescriptions as IntoNonRecursive>::NonRecursive) -> PixelStorage,
    SetPixel: Fn(&mut PixelStorage, Vec2<usize>, Pixel), 
[src]

Using two closures, define how to store the pixels. The first closure creates an image, and the second closure inserts a single pixel. The type of the pixel can be defined by the second closure; it must be a tuple containing f16, f32, u32 or Sample values. See the examples for more information.

Implementors

impl ReadSpecificChannel for NoneMore[src]

impl<DefaultSample, ReadChannels> ReadSpecificChannel for ReadOptionalChannel<ReadChannels, DefaultSample> where
    ReadChannels: ReadSpecificChannel,
    DefaultSample: FromNativeSample + 'static, 
[src]

type RecursivePixelReader = Recursive<ReadChannels::RecursivePixelReader, OptionalSampleReader<DefaultSample>>

fn create_recursive_reader(
    &self,
    channels: &ChannelList
) -> Result<Self::RecursivePixelReader>
[src]

impl<Sample, ReadChannels> ReadSpecificChannel for ReadRequiredChannel<ReadChannels, Sample> where
    ReadChannels: ReadSpecificChannel,
    Sample: FromNativeSample + 'static, 
[src]

type RecursivePixelReader = Recursive<ReadChannels::RecursivePixelReader, SampleReader<Sample>>

fn create_recursive_reader(
    &self,
    channels: &ChannelList
) -> Result<Self::RecursivePixelReader>
[src]