Struct ChannelDescription
pub struct ChannelDescription { pub name: Text, pub sample_type: SampleType, pub quantize_linearly: bool, pub sampling: Vec2<usize> }
A single channel in an layer. Does not contain the actual pixel data, but instead merely describes it.
Fields
name: TextOne of "R", "G", or "B" most of the time.
sample_type: SampleTypeU32, F16 or F32.
quantize_linearly: boolThis attribute only tells lossy compression methods whether this value should be quantized exponentially or linearly.
Should be
falsefor red, green, or blue channels. Should betruefor hue, chroma, saturation, or alpha channels.sampling: Vec2<usize>How many of the samples are skipped compared to the other channels in this layer.
Can be used for chroma subsampling for manual lossy data compression. Values other than 1 are allowed only in flat, scan-line based images. If an image is deep or tiled, x and y sampling rates for all of its channels must be 1.
Implementations
impl ChannelDescription
fn guess_quantization_linearity(name: &Text) -> boolChoose whether to compress samples linearly or not, based on the channel name. Luminance-based channels will be compressed differently than linear data such as alpha.
fn named(name: impl Into<Text>, sample_type: SampleType) -> SelfCreate a new channel with the specified properties and a sampling rate of (1,1). Automatically chooses the linearity for compression based on the channel name.
fn new(name: impl Into<Text>, sample_type: SampleType, quantize_linearly: bool) -> SelfCreate a new channel with the specified properties and a sampling rate of (1,1).
fn subsampled_pixels(&self, dimensions: Vec2<usize>) -> usizeThe count of pixels this channel contains, respecting subsampling.
fn subsampled_resolution(&self, dimensions: Vec2<usize>) -> Vec2<usize>The resolution pf this channel, respecting subsampling.
fn byte_size(&self) -> usizeNumber of bytes this would consume in an exr file.
fn write<W: Write>(&self, write: &mut W) -> UnitResultWithout validation, write this instance to the byte stream.
fn read<R: Read>(read: &mut R) -> Result<Self>Read the value without validating.
fn validate(&self, allow_sampling: bool, data_window: IntegerBounds, strict: bool) -> UnitResultValidate this instance.
Trait Implementations
impl Clone for ChannelDescription
fn clone(&self) -> Self
impl Debug for ChannelDescription
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl Eq for ChannelDescription
impl Hash for ChannelDescription
fn hash<__H: Hasher>(&self, state: &mut __H)
impl PartialEq for ChannelDescription
fn eq(&self, other: &Self) -> bool
impl StructuralPartialEq for ChannelDescription
Auto Trait Implementations
impl Freeze for ChannelDescription
impl RefUnwindSafe for ChannelDescription
impl Send for ChannelDescription
impl Sync for ChannelDescription
impl Unpin for ChannelDescription
impl UnsafeUnpin for ChannelDescription
impl UnwindSafe for ChannelDescription
Blanket Implementations
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for ChannelDescription
where
ST: ?Sized,
DT: ?Sized,
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for ChannelDescription
where
ST: ?Sized,
DT: ?Sized,
impl<T> Any for ChannelDescription
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for ChannelDescription
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for ChannelDescription
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> CloneToUninit for ChannelDescription
where
T: Clone,
unsafe fn clone_to_uninit(&self, dest: *mut u8)
impl<T> From<T> for ChannelDescription
fn from(t: T) -> TReturns the argument unchanged.
impl<T> Pointable for ChannelDescription
const ALIGN: usize = _;type Init = T;unsafe fn init(init: <T as Pointable>::Init) -> usizeunsafe fn deref<'a>(ptr: usize) -> &'a Tunsafe fn deref_mut<'a>(ptr: usize) -> &'a mut Tunsafe fn drop(ptr: usize)
impl<T> Read<Exclusive, BecauseExclusive> for ChannelDescription
where
T: ?Sized,
impl<T> ToOwned for ChannelDescription
where
T: Clone,
type Owned = T;fn to_owned(&self) -> Tfn clone_into(&self, target: &mut T)
impl<T, U> Into<U> for ChannelDescription
where
U: From<T>,
fn into(self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom<U> for ChannelDescription
where
U: Into<T>,
type Error = never;fn try_from(value: U) -> Result<T, never>
impl<T, U> TryInto<U> for ChannelDescription
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>