Struct kolor_64::ColorSpace
source · pub struct ColorSpace { /* 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 ) -> Self
pub fn as_linear(&self) -> Self
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) -> Self
pub fn with_transform(&self, new_transform: TransformFn) -> Self
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) -> Self
pub fn with_whitepoint(&self, new_wp: WhitePoint) -> Self
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) -> Self
pub fn with_primaries(&self, primaries: RGBPrimaries) -> Self
Creates a new color space with the primaries and transform function from this
,
but with the provided RGBPrimaries.
sourcepub fn to_cie_xyY(&self) -> Self
pub fn to_cie_xyY(&self) -> Self
Creates a CIE uvV 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 · 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 Hash for ColorSpace
impl Hash for ColorSpace
source§impl PartialEq<ColorSpace> for ColorSpace
impl PartialEq<ColorSpace> 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 ==
.