Enum image_canvas::color::ColorChannelModel
source · [−]#[non_exhaustive]
pub enum ColorChannelModel {
Rgb,
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.
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
Trait Implementations
sourceimpl Clone for ColorChannelModel
impl Clone for ColorChannelModel
sourcefn clone(&self) -> ColorChannelModel
fn clone(&self) -> ColorChannelModel
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for ColorChannelModel
impl Debug for ColorChannelModel
impl Copy for ColorChannelModel
impl Eq for ColorChannelModel
impl StructuralEq for ColorChannelModel
impl StructuralPartialEq for ColorChannelModel
Auto Trait Implementations
impl RefUnwindSafe for ColorChannelModel
impl Send for ColorChannelModel
impl Sync for ColorChannelModel
impl Unpin for ColorChannelModel
impl UnwindSafe for ColorChannelModel
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more