Struct SpecificChannels

pub struct SpecificChannels<Pixels, ChannelsDescription> { pub channels: ChannelsDescription, pub pixels: Pixels }

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

impl SpecificChannels<(), ()>

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.

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

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.

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

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.

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

const 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.

Trait Implementations

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>,

type Writer = SpecificChannelsWriter<'c, <<Channels as IntoRecursive>::Recursive as WritableChannelsDescription<<<Storage as GetPixel>::Pixel as IntoRecursive>::Recursive>>::RecursiveWriter, Storage, Channels>;
fn infer_channel_list(&self) -> ChannelList
fn infer_level_modes(&self) -> (LevelMode, RoundingMode)
fn create_writer(&'c self, header: &Header) -> Self::Writer

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

fn clone(&self) -> Self

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

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

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

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

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

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

impl<Pxs, Chans> ValidateResult for SpecificChannels<Pxs, Chans> where Pxs: ValidateResult, Chans: Eq,

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

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

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

Blanket Implementations

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for SpecificChannels<Pixels, ChannelsDescription> where ST: ?Sized, DT: ?Sized,

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for SpecificChannels<Pixels, ChannelsDescription> where ST: ?Sized, DT: ?Sized,

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

fn type_id(&self) -> TypeId

impl<T> Borrow<T> for SpecificChannels<Pixels, ChannelsDescription> where T: ?Sized,

fn borrow(&self) -> &T

impl<T> BorrowMut<T> for SpecificChannels<Pixels, ChannelsDescription> where T: ?Sized,

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

impl<T> CloneToUninit for SpecificChannels<Pixels, ChannelsDescription> where T: Clone,

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

impl<T> From<T> for SpecificChannels<Pixels, ChannelsDescription>

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> Pointable for SpecificChannels<Pixels, ChannelsDescription>

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 SpecificChannels<Pixels, ChannelsDescription> where T: ?Sized,

impl<T> ToOwned for SpecificChannels<Pixels, ChannelsDescription> where T: Clone,

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

impl<T, U> Into<U> for SpecificChannels<Pixels, ChannelsDescription> 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 SpecificChannels<Pixels, ChannelsDescription> where U: Into<T>,

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

impl<T, U> TryInto<U> for SpecificChannels<Pixels, ChannelsDescription> where U: TryFrom<T>,

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