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 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
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for LabColorSpace
impl Debug for LabColorSpace
Source§impl Default for LabColorSpace
impl Default for LabColorSpace
Source§impl PartialEq for LabColorSpace
impl PartialEq for LabColorSpace
impl StructuralPartialEq for LabColorSpace
Auto Trait Implementations§
impl Freeze for LabColorSpace
impl RefUnwindSafe for LabColorSpace
impl Send for LabColorSpace
impl Sync for LabColorSpace
impl Unpin for LabColorSpace
impl UnwindSafe for LabColorSpace
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more