pub struct SampleParts { /* private fields */ }
Expand description
Describes which values are present in a texel.
This is some set of channels that describe the color point precisely, given a color space.
Depending on the chosen color there may be multiple ways in which case this names which of the
canonical encodings to use. For example, CIELAB
may be represented as Lab
(Lightness,
red/green, blue/yellow) or LCh
(Lightness, Chroma, Hue; the polar cooordinate form of the
previous).
FIXME(color): describe YUV, ASTC and BC block formats? Other? We surely can handle planar data properly?
Implementations§
Source§impl SampleParts
impl SampleParts
Sourcepub const A: SampleParts
pub const A: SampleParts
A pure alpha part.
Sourcepub const R: SampleParts
pub const R: SampleParts
A pure red part.
pub const G: SampleParts
pub const B: SampleParts
pub const Luma: SampleParts
pub const LumaA: SampleParts
pub const Rgb: SampleParts
pub const RgbA: SampleParts
pub const ARgb: SampleParts
pub const Bgr: SampleParts
pub const BgrA: SampleParts
pub const ABgr: SampleParts
pub const Yuv: SampleParts
pub const YuvA: SampleParts
pub const Lab: SampleParts
pub const LabA: SampleParts
pub const Lch: SampleParts
pub const LchA: SampleParts
Source§impl SampleParts
impl SampleParts
Sourcepub fn new(
parts: [Option<ColorChannel>; 4],
model: ColorChannelModel,
) -> Option<Self>
pub fn new( parts: [Option<ColorChannel>; 4], model: ColorChannelModel, ) -> Option<Self>
Create from up to four color channels.
This is suitable for describing the channels of a single pixel, and relating it to the bit parts in the corresponding texel.
The order of parts will be remembered. All color channels must belong to a common color representation.
Sourcepub fn with_channel(&self, ch: ColorChannel) -> Option<Self>
pub fn with_channel(&self, ch: ColorChannel) -> Option<Self>
Extract a single channel.
The channel is extract as if part of the ColorChannelModel used in the construction of these sample parts.
Sourcepub fn contains(&self, ch: ColorChannel) -> bool
pub fn contains(&self, ch: ColorChannel) -> bool
Test if these parts contain the provided channel.
Sourcepub fn color_channels(&self) -> [Option<ColorChannel>; 4]
pub fn color_channels(&self) -> [Option<ColorChannel>; 4]
Get an array of up to four color channel present.
Sourcepub fn with_yuv_422(
parts: [Option<ColorChannel>; 3],
model: ColorChannelModel,
) -> Option<Self>
pub fn with_yuv_422( parts: [Option<ColorChannel>; 3], model: ColorChannelModel, ) -> Option<Self>
Create parts that describe 4:2:2 subsampled color channels.
These parts represent a 1x2 block, with 4 channels total.
Sourcepub fn with_yuv_411(
parts: [Option<ColorChannel>; 3],
model: ColorChannelModel,
) -> Option<Self>
pub fn with_yuv_411( parts: [Option<ColorChannel>; 3], model: ColorChannelModel, ) -> Option<Self>
Create parts that describe 4:1:1 subsampled color channels.
These parts represent a 1x4 block, with 6 channels total.
pub fn num_components(self) -> u8
pub fn has_alpha(self) -> bool
Trait Implementations§
Source§impl Clone for SampleParts
impl Clone for SampleParts
Source§fn clone(&self) -> SampleParts
fn clone(&self) -> SampleParts
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
source
. Read more