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 ChannelDescription
s, one description for each channel.
pixels: Pixels
Your custom pixel storage
Implementations§
source§impl<SampleStorage, Channels> SpecificChannels<SampleStorage, Channels>
impl<SampleStorage, Channels> SpecificChannels<SampleStorage, Channels>
sourcepub fn new(channels: Channels, source_samples: SampleStorage) -> Selfwhere
SampleStorage: GetPixel,
SampleStorage::Pixel: IntoRecursive,
Channels: Sync + Clone + IntoRecursive,
<Channels as IntoRecursive>::Recursive: WritableChannelsDescription<<SampleStorage::Pixel as IntoRecursive>::Recursive>,
pub fn new(channels: Channels, source_samples: SampleStorage) -> Selfwhere
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<(), ()>
impl SpecificChannels<(), ()>
sourcepub fn build() -> SpecificChannelsBuilder<NoneMore, NoneMore>
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)>
impl<SampleStorage> SpecificChannels<SampleStorage, (ChannelDescription, ChannelDescription, ChannelDescription, ChannelDescription)>
sourcepub fn rgba<R, G, B, A>(source_samples: SampleStorage) -> Selfwhere
R: IntoSample,
G: IntoSample,
B: IntoSample,
A: IntoSample,
SampleStorage: GetPixel<Pixel = (R, G, B, A)>,
pub fn rgba<R, G, B, A>(source_samples: SampleStorage) -> Selfwhere
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)>
impl<SampleStorage> SpecificChannels<SampleStorage, (ChannelDescription, ChannelDescription, ChannelDescription)>
sourcepub fn rgb<R, G, B>(source_samples: SampleStorage) -> Self
pub fn rgb<R, G, B>(source_samples: SampleStorage) -> Self
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>
impl<Pixels: Clone, ChannelsDescription: Clone> Clone for SpecificChannels<Pixels, ChannelsDescription>
source§fn clone(&self) -> SpecificChannels<Pixels, ChannelsDescription>
fn clone(&self) -> SpecificChannels<Pixels, ChannelsDescription>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl<Pixels: Debug, ChannelsDescription: Debug> Debug for SpecificChannels<Pixels, ChannelsDescription>
impl<Pixels: Debug, ChannelsDescription: Debug> Debug for SpecificChannels<Pixels, ChannelsDescription>
source§impl<Pixels: PartialEq, ChannelsDescription: PartialEq> PartialEq for SpecificChannels<Pixels, ChannelsDescription>
impl<Pixels: PartialEq, ChannelsDescription: PartialEq> PartialEq for SpecificChannels<Pixels, ChannelsDescription>
source§fn eq(&self, other: &SpecificChannels<Pixels, ChannelsDescription>) -> bool
fn eq(&self, other: &SpecificChannels<Pixels, ChannelsDescription>) -> bool
self
and other
values to be equal, and is used
by ==
.