#[non_exhaustive]pub enum ColorChannelModel {
Rgb,
Luma,
Yuv,
Lab,
Lch,
Cmyk,
Hsv,
Hsl,
}
Expand description
How to interpret channels as physical quantities.
Each color model consists of a set of color channels, each of which may occur or be omitted in buffers using that model. Each model defines one canonical channel order. This is the order they appear in within ‘shader units’ when pixels are decoded from texels.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Rgb
An additive model consisting of a redish, greenish, blueish channel.
Not all models have truly red, green, or blue channels. More specifically we refer to any color representation that uses three observer functions (weight functions on the visible portion of the spectrum of light) and represents color as the simplex defined from mixing them.
The most common, or nearly universal in computer imagery, choice is a linear combination of the three CIE XYZ standard observers at 2° center of vision.
Example: sRGB, CIE XYZ.
Luma
A lightness model without any color representations.
This is a one-dimensional color where all representable colors fall on the line segment between full darkness and the whitepoint. Any Rgb and Yuv can be reduced to this.
Yuv
A lightness, and two color difference components.
Also sometimes called YUV but that is easily confused is the specific color model called ‘YUV’, a common analog encoding for several PAL systems (now outdated). Don’t confuse with CIE Yuv (1960) or CIE Luv* which is different thing entirely. Yes, confusing.
Based on an Rgb color spaces, with a linear transform to express the color in terms of a total luminance and the difference of blue, red luminance relative to the total one. The linear transform is most often applied to non-linear (aka. gamma pre-corrected, or electric) R’G’B’ values but sometimes (Rec.709) such correct is applied after transformation. Coefficients differ between systems.
As can be read from the terms, the intensity is given as a photometric definition in terms of luminance and not as a perceptual ‘lightness’ which differentiates it from Lab/Lch as defined below.
Lab
A lightness, and two chroma components.
Differs from xyY spaces by a non-linear transform, commonly with the goal of generating perceptually uniform values. Example: CIE Lab.
The uniformity permits a perceptual distance metric as Euclidean distance, although this proves imprecise under in-depth investigation. Good for a decent estimate though.
Lch
A lightness and two chroma components as polar coordinates.
Polar transform of a Lab model. Example: Oklab
Cmyk
A subtractive model consisting of fours inks defining absorbed colors.
Example: ISO 2846 (Euroskala)
Hsv
HSV (Hue, saturation, value).
On closer inspection, a model that is neither physical nor perceptual nor based on correctness merits and its use should be strongly reconsidered in favor of a proper Lab-like color model. Please stop, please. https://en.wikipedia.org/wiki/HSL_and_HSV#Disadvantages
Hsl
HSL (Hue, saturation, lightness).
Careful, lightness means neither luminance nor perceptual lightness and is a mere arithmetic mean of color values. Some recommend using Luma (based on primary weights) instead but neglect to mention a specific standard. Really research what definition was used when the pixel color was computed. Good luck.
On closer inspection, a model that is neither physical nor perceptual nor based on correctness merits and its use should be strongly reconsidered in favor of a proper Lab-like color model. Please stop, please. https://en.wikipedia.org/wiki/HSL_and_HSV#Disadvantages
Implementations§
Source§impl ColorChannelModel
impl ColorChannelModel
pub const fn contains(self, channel: ColorChannel) -> bool
Trait Implementations§
Source§impl Clone for ColorChannelModel
impl Clone for ColorChannelModel
Source§fn clone(&self) -> ColorChannelModel
fn clone(&self) -> ColorChannelModel
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
source
. Read more