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