#[non_exhaustive]pub enum ColorSpace {
Show 13 variants
RGB,
RGBA,
YCbCr,
Luma,
LumaA,
YCCK,
CMYK,
BGR,
BGRA,
Unknown,
ARGB,
HSL,
HSV,
}
Expand description
All possible image colorspaces Some of them aren’t yet supported exist here.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
RGB
Red, Green , Blue
RGBA
Red, Green, Blue, Alpha
YCbCr
YUV colorspace
Luma
Grayscale colorspace
LumaA
Grayscale with alpha colorspace
YCCK
CMYK
Cyan , Magenta, Yellow, Black
BGR
Blue, Green, Red
BGRA
Blue, Green, Red, Alpha
Unknown
The colorspace is unknown
ARGB
Alpha Red Green Blue
HSL
Hue,Saturation,Lightness Conversion from RGB to HSL and back matches that of Python colorsys module Color type is expected to be in floating point
HSV
Hue, Saturation,Value
Conversion from RGB to HSV and back matches that of Python colorsys module Color type is expected to be in floating point
Implementations§
Source§impl ColorSpace
impl ColorSpace
Sourcepub const fn num_components(&self) -> usize
pub const fn num_components(&self) -> usize
Number of color channels present for a certain colorspace
E.g. RGB returns 3 since it contains R,G and B colors to make up a pixel
pub const fn has_alpha(&self) -> bool
pub const fn is_grayscale(&self) -> bool
Sourcepub const fn alpha_position(&self) -> Option<usize>
pub const fn alpha_position(&self) -> Option<usize>
Returns the position of the alpha pixel in a pixel
That is for an array of color components say [0,1,2,3]
if the image has an alpha channel
and is in RGBA format, this will return Some(3)
, indicating alpha is found in the third index
but if the image is in ARGB
format, it will return Some(0)
indicating alpha is found in
index 0
If an image doesn’t have an alpha channel returns None
Trait Implementations§
Source§impl Clone for ColorSpace
impl Clone for ColorSpace
Source§fn clone(&self) -> ColorSpace
fn clone(&self) -> ColorSpace
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more