pub struct DynamicColorSpace { /* private fields */ }Expand description
A color space defined in data by its Primaries, white point, and an optional invertible transform function.
See spaces for defined color spaces.
ColorSpace assumes that a color space is one of
- the CIE XYZ color space
- an RGB color space
- a color space which may be defined as an invertible mapping from one the above (TransformFn)
An example of a TransformFn is the sRGB “opto-eletronic transfer function”, or “gamma compensation”.
kolor makes the distinction between “linear” and “non-linear” color spaces, where a linear
color space can be defined as a linear transformation from the CIE XYZ color space.
ColorSpace contains a reference WhitePoint to represent a color space’s reference illuminant.
A linear RGB ColorSpace can be thought of as defining a relative coordinate system in the CIE XYZ color coordinate space, where three RGB primaries each define an axis pointing from the black point (0,0,0) in CIE XYZ.
Non-linear ColorSpaces - such as sRGB with gamma compensation applied - are defined as a non-linear mapping from a linear ColorSpace’s coordinate system.
Implementations§
Source§impl ColorSpace
impl ColorSpace
pub const fn new( primaries: RGBPrimaries, white_point: WhitePoint, transform_fn: TransformFn, ) -> ColorSpace
pub fn as_linear(&self) -> ColorSpace
pub fn primaries(&self) -> RGBPrimaries
pub fn white_point(&self) -> WhitePoint
pub fn transform_function(&self) -> TransformFn
Sourcepub fn with_transform(&self, new_transform: TransformFn) -> ColorSpace
pub fn with_transform(&self, new_transform: TransformFn) -> ColorSpace
Creates a new color space with the primaries and white point from this,
but with the provided TransformFn.
Sourcepub fn with_whitepoint(&self, new_wp: WhitePoint) -> ColorSpace
pub fn with_whitepoint(&self, new_wp: WhitePoint) -> ColorSpace
Creates a new color space with the transform function and white point from this,
but with the provided WhitePoint.
Sourcepub fn with_primaries(&self, primaries: RGBPrimaries) -> ColorSpace
pub fn with_primaries(&self, primaries: RGBPrimaries) -> ColorSpace
Creates a new color space with the primaries and transform function from this,
but with the provided RGBPrimaries.
Sourcepub fn to_cielab(&self) -> ColorSpace
pub fn to_cielab(&self) -> ColorSpace
Creates a CIE LAB color space using this space’s white point.
Sourcepub fn to_cie_xyY(&self) -> ColorSpace
pub fn to_cie_xyY(&self) -> ColorSpace
Creates a CIE uvV color space using this space’s white point.
Sourcepub fn to_cielch(&self) -> ColorSpace
pub fn to_cielch(&self) -> ColorSpace
Creates a CIE LCh color space using this space’s white point.
Trait Implementations§
Source§impl Clone for ColorSpace
impl Clone for ColorSpace
Source§fn clone(&self) -> ColorSpace
fn clone(&self) -> ColorSpace
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ColorSpace
impl Debug for ColorSpace
Source§impl<'de> Deserialize<'de> for ColorSpace
impl<'de> Deserialize<'de> for ColorSpace
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<ColorSpace, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<ColorSpace, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl Hash for ColorSpace
impl Hash for ColorSpace
Source§impl PartialEq for ColorSpace
impl PartialEq for ColorSpace
Source§fn eq(&self, other: &ColorSpace) -> bool
fn eq(&self, other: &ColorSpace) -> bool
self and other values to be equal, and is used by ==.