pub struct LabColorSpace {
pub white_point: [f64; 3],
pub black_point: [f64; 3],
pub range: [f64; 4],
}Expand description
CIE Lab color space (ISO 32000-1 §8.6.5.4)
Fields§
§white_point: [f64; 3]White point in CIE XYZ coordinates [Xw, Yw, Zw] Default is D50 standard illuminant
black_point: [f64; 3]Black point in CIE XYZ coordinates [Xb, Yb, Zb]
Default is [0, 0, 0]
range: [f64; 4]Range for a* and b* components [a_min, a_max, b_min, b_max] Default is [-100, 100, -100, 100]
Implementations§
Source§impl LabColorSpace
impl LabColorSpace
Sourcepub fn with_white_point(self, white_point: [f64; 3]) -> Self
pub fn with_white_point(self, white_point: [f64; 3]) -> Self
Set the white point (CIE XYZ coordinates)
Sourcepub fn with_black_point(self, black_point: [f64; 3]) -> Self
pub fn with_black_point(self, black_point: [f64; 3]) -> Self
Set the black point (CIE XYZ coordinates)
Sourcepub fn with_range(self, a_min: f64, a_max: f64, b_min: f64, b_max: f64) -> Self
pub fn with_range(self, a_min: f64, a_max: f64, b_min: f64, b_max: f64) -> Self
Set the range for a* and b* components
Sourcepub fn params_dictionary(&self) -> Dictionary
pub fn params_dictionary(&self) -> Dictionary
Build the Lab parameter dictionary (WhitePoint, optional
BlackPoint/Range). Single source of the dict shape, shared by
Self::to_pdf_array and the PageColorSpace bridge
(impl From<&LabColorSpace> for PageColorSpace).
Sourcepub fn to_pdf_array(&self) -> Vec<Object>
pub fn to_pdf_array(&self) -> Vec<Object>
Convert to PDF color space array
Sourcepub fn lab_to_xyz(&self, l: f64, a: f64, b: f64) -> [f64; 3]
pub fn lab_to_xyz(&self, l: f64, a: f64, b: f64) -> [f64; 3]
Convert Lab values to CIE XYZ L* is in range [0, 100], a* and b* are typically in [-128, 127]
Sourcepub fn lab_to_rgb(&self, l: f64, a: f64, b: f64) -> [f64; 3]
pub fn lab_to_rgb(&self, l: f64, a: f64, b: f64) -> [f64; 3]
Convert Lab to approximate sRGB for display purposes This is a convenience method for visualization
Sourcepub fn rgb_to_lab(&self, r: f64, g: f64, b: f64) -> [f64; 3]
pub fn rgb_to_lab(&self, r: f64, g: f64, b: f64) -> [f64; 3]
Convert sRGB to Lab for convenience
Trait Implementations§
Source§impl Clone for LabColorSpace
impl Clone for LabColorSpace
Source§fn clone(&self) -> LabColorSpace
fn clone(&self) -> LabColorSpace
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 LabColorSpace
impl Debug for LabColorSpace
Source§impl Default for LabColorSpace
impl Default for LabColorSpace
Source§impl From<&LabColorSpace> for PageColorSpace
impl From<&LabColorSpace> for PageColorSpace
Source§fn from(cs: &LabColorSpace) -> Self
fn from(cs: &LabColorSpace) -> Self
Bridge a typed LabColorSpace into a registrable colour space
(ISO 32000-1 §8.6.5.4).
Source§impl PartialEq for LabColorSpace
impl PartialEq for LabColorSpace
Source§fn eq(&self, other: &LabColorSpace) -> bool
fn eq(&self, other: &LabColorSpace) -> bool
self and other values to be equal, and is used by ==.