#[repr(C)]pub struct Chromaticity {
pub x: f32,
pub y: f32,
}
Fields§
§x: f32
§y: f32
Implementations§
Source§impl Chromaticity
impl Chromaticity
pub const D65: Chromaticity
pub const D50: Chromaticity
pub const fn new(x: f32, y: f32) -> Self
Sourcepub const fn to_xyz(&self) -> Xyz
pub const fn to_xyz(&self) -> Xyz
Converts this chromaticity (x
, y
) to a tristimulus Xyz
value,
normalized such that y = 1.0
.
Sourcepub const fn to_scaled_xyzd(&self) -> Xyzd
pub const fn to_scaled_xyzd(&self) -> Xyzd
Get the color representation with component sum 1
.
In contrast to the XYZ representation defined through setting Y
to a known
value (such as 1
in Self::to_xyz
) this representation can be uniquely
derived from the xy
coordinates with no ambiguities. It is scaled from the
original XYZ color by diving by X + Y + Z
. Note that, in particular, this
method is well-defined even if the original color had pure chromamatic
information with no luminance (Y = 0
) and will preserve that information,
whereas Self::to_xyz
is ill-defined and returns an incorrect value.
Sourcepub const fn to_scaled_xyz(&self) -> Xyz
pub const fn to_scaled_xyz(&self) -> Xyz
Get the color representation with component sum 1
.
In contrast to the XYZ representation defined through setting Y
to a known
value (such as 1
in Self::to_xyz
) this representation can be uniquely
derived from the xy
coordinates with no ambiguities. It is scaled from the
original XYZ color by diving by X + Y + Z
. Note that, in particular, this
method is well-defined even if the original color had pure chromamatic
information with no luminance (Y = 0
) and will preserve that information,
whereas Self::to_xyz
is ill-defined and returns an incorrect value.
pub const fn to_xyzd(&self) -> Xyzd
pub const fn to_xyyb(&self) -> XyY
Trait Implementations§
Source§impl Clone for Chromaticity
impl Clone for Chromaticity
Source§fn clone(&self) -> Chromaticity
fn clone(&self) -> Chromaticity
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more