Enum ColorSpace
#[non_exhaustive]
pub enum ColorSpace
All possible image colorspaces Some of them aren't yet supported exist here.
Variants
-
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
-
MultiBand(NonZeroU32) Multiple arbitrary image channels.
This introduces limited support for multi-band/multichannel images that can have n channels.
The library contains optimized and well-supported routines for up to 4 image channels as is more common out there, but some pipelines may require multi-band image support.
For operations, multi-band images are assumed to be n-channel images with no alpha to allow for generic processing, without necessarily caring for the underlying interpretation
Implementations
impl ColorSpace
const fn num_components(&self) -> usizeNumber 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
const fn has_alpha(&self) -> boolconst fn is_grayscale(&self) -> boolconst 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 returnSome(3), indicating alpha is found in the third index but if the image is inARGBformat, it will returnSome(0)indicating alpha is found in
index 0If an image doesn't have an alpha channel returns
None
Trait Implementations
impl Clone for ColorSpace
fn clone(&self) -> Self
impl Copy for ColorSpace
impl Debug for ColorSpace
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl Eq for ColorSpace
impl PartialEq for ColorSpace
fn eq(&self, other: &Self) -> bool