| 1 | //! Types for the CIE L\*a\*b\* (CIELAB) color space. |
| 2 | |
| 3 | use corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::{ |
| 4 | markerrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/::PhantomDatarust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/PhantomData#, |
| 5 | opsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/::{Addrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#, BitAndrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/BitAnd#, BitOrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/BitOr#, Mulrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#, Negrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Neg#}, |
| 6 | }; |
| 7 | |
| 8 | use craterust-analyzer cargo palette 0.7.6 crate/::{ |
| 9 | anglerust-analyzer cargo palette 0.7.6 angle/::RealAnglerust-analyzer cargo palette 0.7.6 angle/RealAngle#, |
| 10 | bool_maskrust-analyzer cargo palette 0.7.6 bool_mask/::{HasBoolMaskrust-analyzer cargo palette 0.7.6 bool_mask/HasBoolMask#, LazySelectrust-analyzer cargo palette 0.7.6 bool_mask/LazySelect#}, |
| 11 | color_differencerust-analyzer cargo palette 0.7.6 color_difference/::{ |
| 12 | get_ciede2000_differencerust-analyzer cargo palette 0.7.6 color_difference/get_ciede2000_difference()., Ciede2000rust-analyzer cargo palette 0.7.6 color_difference/Ciede2000#, DeltaErust-analyzer cargo palette 0.7.6 color_difference/DeltaE#, EuclideanDistancerust-analyzer cargo palette 0.7.6 color_difference/EuclideanDistance#, ImprovedDeltaErust-analyzer cargo palette 0.7.6 color_difference/ImprovedDeltaE#, |
| 13 | LabColorDiffrust-analyzer cargo palette 0.7.6 color_difference/LabColorDiff#, |
| 14 | }, |
| 15 | convertrust-analyzer cargo palette 0.7.6 convert/::FromColorUnclampedrust-analyzer cargo palette 0.7.6 convert/from_into_color_unclamped/FromColorUnclamped#, |
| 16 | numrust-analyzer cargo palette 0.7.6 num/::{ |
| 17 | Absrust-analyzer cargo palette 0.7.6 num/Abs#, Arithmeticsrust-analyzer cargo palette 0.7.6 num/Arithmetics#, Cbrtrust-analyzer cargo palette 0.7.6 num/Cbrt#, Exprust-analyzer cargo palette 0.7.6 num/Exp#, Hypotrust-analyzer cargo palette 0.7.6 num/Hypot#, MinMaxrust-analyzer cargo palette 0.7.6 num/MinMax#, Onerust-analyzer cargo palette 0.7.6 num/One#, PartialCmprust-analyzer cargo palette 0.7.6 num/PartialCmp#, Powfrust-analyzer cargo palette 0.7.6 num/Powf#, Powirust-analyzer cargo palette 0.7.6 num/Powi#, Realrust-analyzer cargo palette 0.7.6 num/Real#, Sqrtrust-analyzer cargo palette 0.7.6 num/Sqrt#, |
| 18 | Trigonometryrust-analyzer cargo palette 0.7.6 num/Trigonometry#, Zerorust-analyzer cargo palette 0.7.6 num/Zero#, |
| 19 | }, |
| 20 | white_pointrust-analyzer cargo palette 0.7.6 white_point/::{WhitePointrust-analyzer cargo palette 0.7.6 white_point/WhitePoint#, D65rust-analyzer cargo palette 0.7.6 white_point/D65#}, |
| 21 | Alpharust-analyzer cargo palette 0.7.6 alpha/alpha/Alpha#, FromColorrust-analyzer cargo palette 0.7.6 convert/from_into_color/FromColor#, GetHuerust-analyzer cargo palette 0.7.6 GetHue#, LabHuerust-analyzer cargo palette 0.7.6 hues/LabHue#, Lchrust-analyzer cargo palette 0.7.6 lch/Lch#, Xyzrust-analyzer cargo palette 0.7.6 xyz/Xyz#, |
| 22 | }; |
| 23 | |
| 24 | /// CIE L\*a\*b\* (CIELAB) with an alpha component. See the [`Laba` |
| 25 | /// implementation in `Alpha`](crate::Alpha#Laba). |
| 26 | pub type Labarust-analyzer cargo palette 0.7.6 lab/Laba#<Wp = D65rust-analyzer cargo palette 0.7.6 white_point/D65#, T = f32> = Alpharust-analyzer cargo palette 0.7.6 alpha/alpha/Alpha#<Labrust-analyzer cargo palette 0.7.6 lab/Lab#<Wp, T>, T>; |
| 27 | |
| 28 | /// The CIE L\*a\*b\* (CIELAB) color space. |
| 29 | /// |
| 30 | /// CIE L\*a\*b\* is a device independent color space which includes all |
| 31 | /// perceivable colors. It's sometimes used to convert between other color |
| 32 | /// spaces, because of its ability to represent all of their colors, and |
| 33 | /// sometimes in color manipulation, because of its perceptual uniformity. This |
| 34 | /// means that the perceptual difference between two colors is equal to their |
| 35 | /// numerical difference. It was, however, [never designed for the perceptual |
| 36 | /// qualities required for gamut mapping](http://www.brucelindbloom.com/UPLab.html). |
| 37 | /// For perceptually uniform color manipulation the newer color spaces based on |
| 38 | /// [`Oklab`](crate::Oklab) are preferable: |
| 39 | /// [`Oklch`](crate::Oklch), [`Okhsv`](crate::Okhsv), [`Okhsl`](crate::Okhsl), |
| 40 | /// [`Okhwb`](crate::Okhwb) (Note that the latter three are tied to the sRGB gamut |
| 41 | /// and reference white). |
| 42 | /// |
| 43 | /// The parameters of L\*a\*b\* are quite different, compared to many other |
| 44 | /// color spaces, so manipulating them manually may be unintuitive. |
| 45 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, ArrayCastrust-analyzer cargo palette_derive 0.7.6 ArrayCast:, FromColorUnclampedrust-analyzer cargo palette_derive 0.7.6 FromColorUnclamped:, WithAlpharust-analyzer cargo palette_derive 0.7.6 WithAlpha:)] |
| 46 | #[cfg_attr(feature = "serializing", derive(Serializerust-analyzer cargo serde_derive 1.0.229 Serialize:, Deserializerust-analyzer cargo serde_derive 1.0.229 Deserialize:))] |
| 47 | #[palette( |
| 48 | palette_internal, |
| 49 | white_point = "Wp", |
| 50 | component = "T", |
| 51 | skip_derives(Xyz, Lab, Lch) |
| 52 | )] |
| 53 | #[repr(C)] |
| 54 | pub struct Labrust-analyzer cargo palette 0.7.6 lab/Lab#<Wp = D65rust-analyzer cargo palette 0.7.6 white_point/D65#, T = f32> { |
| 55 | /// L\* is the lightness of the color. 0.0 gives absolute black and 100 |
| 56 | /// give the brightest white. |
| 57 | pub lrust-analyzer cargo palette 0.7.6 lab/Lab#l.: T, |
| 58 | |
| 59 | /// a\* goes from red at -128 to green at 127. |
| 60 | pub arust-analyzer cargo palette 0.7.6 lab/Lab#a.: T, |
| 61 | |
| 62 | /// b\* goes from yellow at -128 to blue at 127. |
| 63 | pub brust-analyzer cargo palette 0.7.6 lab/Lab#b.: T, |
| 64 | |
| 65 | /// The white point associated with the color's illuminant and observer. |
| 66 | /// D65 for 2 degree observer is used by default. |
| 67 | #[cfg_attr(feature = "serializing", serde(skip))] |
| 68 | #[paletterust-analyzer cargo palette_derive 0.7.6 palette:(unsafe_zero_sized)] |
| 69 | pub white_pointrust-analyzer cargo palette 0.7.6 lab/Lab#white_point.: PhantomDatarust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/PhantomData#<Wp>, |
| 70 | } |
| 71 | |
| 72 | impl<Wp, T> Labrust-analyzer cargo palette 0.7.6 lab/Lab#<Wp, T> { |
| 73 | /// Create a CIE L\*a\*b\* color. |
| 74 | pub const fn newrust-analyzer cargo palette 0.7.6 lab/impl#[`Lab<Wp, T>`]new().(l: T, a: T, b: T) -> Labrust-analyzer cargo palette 0.7.6 lab/Lab#<Wp, T> { |
| 75 | Labrust-analyzer cargo palette 0.7.6 lab/Lab# { |
| 76 | lrust-analyzer cargo palette 0.7.6 lab/Lab#l., |
| 77 | arust-analyzer cargo palette 0.7.6 lab/Lab#a., |
| 78 | brust-analyzer cargo palette 0.7.6 lab/Lab#b., |
| 79 | white_pointrust-analyzer cargo palette 0.7.6 lab/Lab#white_point.: PhantomDatarust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/PhantomData#, |
| 80 | } |
| 81 | } |
| 82 | |
| 83 | /// Convert to a `(L\*, a\*, b\*)` tuple. |
| 84 | pub fn into_componentsrust-analyzer cargo palette 0.7.6 lab/impl#[`Lab<Wp, T>`]into_components().(self) -> (T, T, T) { |
| 85 | (self.lrust-analyzer cargo palette 0.7.6 lab/Lab#l., self.arust-analyzer cargo palette 0.7.6 lab/Lab#a., self.brust-analyzer cargo palette 0.7.6 lab/Lab#b.) |
| 86 | } |
| 87 | |
| 88 | /// Convert from a `(L\*, a\*, b\*)` tuple. |
| 89 | pub fn from_componentsrust-analyzer cargo palette 0.7.6 lab/impl#[`Lab<Wp, T>`]from_components().((l, a, b): (T, T, T)) -> Selfrust-analyzer cargo palette 0.7.6 lab/impl#[`Lab<Wp, T>`] { |
| 90 | Selfrust-analyzer cargo palette 0.7.6 lab/impl#[`Lab<Wp, T>`]::newrust-analyzer cargo palette 0.7.6 lab/impl#[`Lab<Wp, T>`]new().(l, a, b) |
| 91 | } |
| 92 | } |
| 93 | |
| 94 | impl<Wp, T> Labrust-analyzer cargo palette 0.7.6 lab/Lab#<Wp, T> |
| 95 | where |
| 96 | T: Zerorust-analyzer cargo palette 0.7.6 num/Zero# + Realrust-analyzer cargo palette 0.7.6 num/Real#, |
| 97 | { |
| 98 | /// Return the `l` value minimum. |
| 99 | pub fn min_lrust-analyzer cargo palette 0.7.6 lab/impl#[`Lab<Wp, T>`]min_l().() -> T { |
| 100 | T::zerorust-analyzer cargo palette 0.7.6 num/Zero#zero().() |
| 101 | } |
| 102 | |
| 103 | /// Return the `l` value maximum. |
| 104 | pub fn max_lrust-analyzer cargo palette 0.7.6 lab/impl#[`Lab<Wp, T>`]max_l().() -> T { |
| 105 | T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(100.0) |
| 106 | } |
| 107 | |
| 108 | /// Return the `a` value minimum. |
| 109 | pub fn min_arust-analyzer cargo palette 0.7.6 lab/impl#[`Lab<Wp, T>`]min_a().() -> T { |
| 110 | T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][Neg]neg().128.0) |
| 111 | } |
| 112 | |
| 113 | /// Return the `a` value maximum. |
| 114 | pub fn max_arust-analyzer cargo palette 0.7.6 lab/impl#[`Lab<Wp, T>`]max_a().() -> T { |
| 115 | T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(127.0) |
| 116 | } |
| 117 | |
| 118 | /// Return the `b` value minimum. |
| 119 | pub fn min_brust-analyzer cargo palette 0.7.6 lab/impl#[`Lab<Wp, T>`]min_b().() -> T { |
| 120 | T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][Neg]neg().128.0) |
| 121 | } |
| 122 | |
| 123 | /// Return the `b` value maximum. |
| 124 | pub fn max_brust-analyzer cargo palette 0.7.6 lab/impl#[`Lab<Wp, T>`]max_b().() -> T { |
| 125 | T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(127.0) |
| 126 | } |
| 127 | } |
| 128 | |
| 129 | ///<span id="Laba"></span>[`Laba`](crate::Laba) implementations. |
| 130 | impl<Wp, T, A> Alpharust-analyzer cargo palette 0.7.6 alpha/alpha/Alpha#<Labrust-analyzer cargo palette 0.7.6 lab/Lab#<Wp, T>, A> { |
| 131 | /// Create a CIE L\*a\*b\* with transparency. |
| 132 | pub const fn newrust-analyzer cargo palette 0.7.6 lab/impl#[`Alpha<Lab<Wp, T>, A>`]new().(l: T, a: T, b: T, alpha: A) -> Selfrust-analyzer cargo palette 0.7.6 lab/impl#[`Alpha<Lab<Wp, T>, A>`] { |
| 133 | Alpharust-analyzer cargo palette 0.7.6 alpha/alpha/Alpha# { |
| 134 | colorrust-analyzer cargo palette 0.7.6 alpha/alpha/Alpha#color.: Labrust-analyzer cargo palette 0.7.6 lab/Lab#::newrust-analyzer cargo palette 0.7.6 lab/impl#[`Lab<Wp, T>`]new().(l, a, b), |
| 135 | alpharust-analyzer cargo palette 0.7.6 alpha/alpha/Alpha#alpha., |
| 136 | } |
| 137 | } |
| 138 | |
| 139 | /// Convert to a `(L\*, a\*, b\*, alpha)` tuple. |
| 140 | pub fn into_componentsrust-analyzer cargo palette 0.7.6 lab/impl#[`Alpha<Lab<Wp, T>, A>`]into_components().(self) -> (T, T, T, A) { |
| 141 | (self.colorrust-analyzer cargo palette 0.7.6 alpha/alpha/Alpha#color..lrust-analyzer cargo palette 0.7.6 lab/Lab#l., self.colorrust-analyzer cargo palette 0.7.6 alpha/alpha/Alpha#color..arust-analyzer cargo palette 0.7.6 lab/Lab#a., self.colorrust-analyzer cargo palette 0.7.6 alpha/alpha/Alpha#color..brust-analyzer cargo palette 0.7.6 lab/Lab#b., self.alpharust-analyzer cargo palette 0.7.6 alpha/alpha/Alpha#alpha.) |
| 142 | } |
| 143 | |
| 144 | /// Convert from a `(L\*, a\*, b\*, alpha)` tuple. |
| 145 | pub fn from_componentsrust-analyzer cargo palette 0.7.6 lab/impl#[`Alpha<Lab<Wp, T>, A>`]from_components().((l, a, b, alpha): (T, T, T, A)) -> Selfrust-analyzer cargo palette 0.7.6 lab/impl#[`Alpha<Lab<Wp, T>, A>`] { |
| 146 | Selfrust-analyzer cargo palette 0.7.6 lab/impl#[`Alpha<Lab<Wp, T>, A>`]::newrust-analyzer cargo palette 0.7.6 lab/impl#[`Alpha<Lab<Wp, T>, A>`]new().(l, a, b, alpha) |
| 147 | } |
| 148 | } |
| 149 | |
| 150 | impl_reference_component_methodsrust-analyzer cargo palette 0.7.6 macros/reference_component/impl_reference_component_methods!!(Labrust-analyzer cargo palette 0.7.6 lab/Lab#<Wp>, [lrust-analyzer cargo palette 0.7.6 lab/Lab#l., arust-analyzer cargo palette 0.7.6 lab/Lab#a., brust-analyzer cargo palette 0.7.6 lab/Lab#b.], white_pointrust-analyzer cargo palette 0.7.6 lab/Lab#white_point.); |
| 151 | impl_struct_of_arrays_methodsrust-analyzer cargo palette 0.7.6 macros/struct_of_arrays/impl_struct_of_arrays_methods!!(Labrust-analyzer cargo palette 0.7.6 lab/Lab#<Wp>, [l, a, b], white_pointrust-analyzer cargo palette 0.7.6 lab/Lab#white_point.); |
| 152 | |
| 153 | impl<Wp, T> FromColorUnclampedrust-analyzer cargo palette 0.7.6 convert/from_into_color_unclamped/FromColorUnclamped#<Labrust-analyzer cargo palette 0.7.6 lab/Lab#<Wp, T>> for Labrust-analyzer cargo palette 0.7.6 lab/Lab#<Wp, T> { |
| 154 | fn from_color_unclampedrust-analyzer cargo palette 0.7.6 lab/impl#[`Lab<Wp, T>`][`FromColorUnclamped<Self>`]from_color_unclamped().(color: Labrust-analyzer cargo palette 0.7.6 lab/Lab#<Wp, T>) -> Selfrust-analyzer cargo palette 0.7.6 lab/impl#[`Lab<Wp, T>`][`FromColorUnclamped<Self>`] { |
| 155 | color |
| 156 | } |
| 157 | } |
| 158 | |
| 159 | impl<Wp, T> FromColorUnclampedrust-analyzer cargo palette 0.7.6 convert/from_into_color_unclamped/FromColorUnclamped#<Xyzrust-analyzer cargo palette 0.7.6 xyz/Xyz#<Wp, T>> for Labrust-analyzer cargo palette 0.7.6 lab/Lab#<Wp, T> |
| 160 | where |
| 161 | Wp: WhitePointrust-analyzer cargo palette 0.7.6 white_point/WhitePoint#<T>, |
| 162 | T: Realrust-analyzer cargo palette 0.7.6 num/Real# + Powirust-analyzer cargo palette 0.7.6 num/Powi# + Cbrtrust-analyzer cargo palette 0.7.6 num/Cbrt# + Arithmeticsrust-analyzer cargo palette 0.7.6 num/Arithmetics# + PartialCmprust-analyzer cargo palette 0.7.6 num/PartialCmp# + Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#, |
| 163 | T::Maskrust-analyzer cargo palette 0.7.6 bool_mask/HasBoolMask#Mask#: LazySelectrust-analyzer cargo palette 0.7.6 bool_mask/LazySelect#<T>, |
| 164 | { |
| 165 | fn from_color_unclampedrust-analyzer cargo palette 0.7.6 lab/impl#[`Lab<Wp, T>`][`FromColorUnclamped<Xyz<Wp, T>>`]from_color_unclamped().(color: Xyzrust-analyzer cargo palette 0.7.6 xyz/Xyz#<Wp, T>) -> Selfrust-analyzer cargo palette 0.7.6 lab/impl#[`Lab<Wp, T>`][`FromColorUnclamped<Xyz<Wp, T>>`] { |
| 166 | let Xyzrust-analyzer cargo palette 0.7.6 xyz/Xyz# { xrust-analyzer cargo palette 0.7.6 xyz/Xyz#x., yrust-analyzer cargo palette 0.7.6 xyz/Xyz#y., zrust-analyzer cargo palette 0.7.6 xyz/Xyz#z., .. } = color rust-analyzer cargo palette 0.7.6 xyz/impl#[`Xyz<Wp, T>`][`Div<Self>`]div()./rust-analyzer cargo palette 0.7.6 xyz/impl#[`Xyz<Wp, T>`][`Div<Self>`]div(). rust-analyzer cargo palette 0.7.6 xyz/impl#[`Xyz<Wp, T>`][`Div<Self>`]div().Wp::get_xyzrust-analyzer cargo palette 0.7.6 white_point/WhitePoint#get_xyz().().with_white_pointrust-analyzer cargo palette 0.7.6 xyz/impl#[`Xyz<Wp, T>`]with_white_point().(); |
| 167 | |
| 168 | let epsilon = T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(6.0 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Div<Self>`]div().29.0).powirust-analyzer cargo palette 0.7.6 num/Powi#powi().(3); |
| 169 | let kappa: T = T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(841.0 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Div<Self>`]div().108.0); |
| 170 | let delta: T = T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(4.0 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Div<Self>`]div().29.0); |
| 171 | |
| 172 | let convert = |c: T| { |
| 173 | lazy_selectrust-analyzer cargo palette 0.7.6 macros/lazy_select/lazy_select!! { |
| 174 | if c.gtrust-analyzer cargo palette 0.7.6 num/PartialCmp#gt().(&epsilon) => c.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().().cbrtrust-analyzer cargo palette 0.7.6 num/Cbrt#cbrt().(), |
| 175 | else => (kappa.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().() *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). &c) +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add(). &delta, |
| 176 | } |
| 177 | }; |
| 178 | |
| 179 | let x = convert(x); |
| 180 | let y = convert(y); |
| 181 | let z = convert(z); |
| 182 | |
| 183 | Labrust-analyzer cargo palette 0.7.6 lab/Lab# { |
| 184 | lrust-analyzer cargo palette 0.7.6 lab/Lab#l.: ((y.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(116.0)) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Sub#sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Sub#sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Sub#sub().T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(16.0)), |
| 185 | arust-analyzer cargo palette 0.7.6 lab/Lab#a.: ((x rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Sub#sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Sub#sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Sub#sub().&y) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(500.0)), |
| 186 | brust-analyzer cargo palette 0.7.6 lab/Lab#b.: ((y rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Sub#sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Sub#sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Sub#sub().z) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(200.0)), |
| 187 | white_pointrust-analyzer cargo palette 0.7.6 lab/Lab#white_point.: PhantomDatarust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/PhantomData#, |
| 188 | } |
| 189 | } |
| 190 | } |
| 191 | |
| 192 | impl<Wp, T> FromColorUnclampedrust-analyzer cargo palette 0.7.6 convert/from_into_color_unclamped/FromColorUnclamped#<Lchrust-analyzer cargo palette 0.7.6 lch/Lch#<Wp, T>> for Labrust-analyzer cargo palette 0.7.6 lab/Lab#<Wp, T> |
| 193 | where |
| 194 | T: RealAnglerust-analyzer cargo palette 0.7.6 angle/RealAngle# + Zerorust-analyzer cargo palette 0.7.6 num/Zero# + MinMaxrust-analyzer cargo palette 0.7.6 num/MinMax# + Trigonometryrust-analyzer cargo palette 0.7.6 num/Trigonometry# + Mulrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#<Outputrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#Output# = T> + Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#, |
| 195 | { |
| 196 | fn from_color_unclampedrust-analyzer cargo palette 0.7.6 lab/impl#[`Lab<Wp, T>`][`FromColorUnclamped<Lch<Wp, T>>`]from_color_unclamped().(color: Lchrust-analyzer cargo palette 0.7.6 lch/Lch#<Wp, T>) -> Selfrust-analyzer cargo palette 0.7.6 lab/impl#[`Lab<Wp, T>`][`FromColorUnclamped<Lch<Wp, T>>`] { |
| 197 | let (a, b) = color.huerust-analyzer cargo palette 0.7.6 lch/Lch#hue..into_cartesianrust-analyzer cargo palette 0.7.6 hues/impl#[`LabHue<T>`]into_cartesian().(); |
| 198 | let chroma = color.chromarust-analyzer cargo palette 0.7.6 lch/Lch#chroma..maxrust-analyzer cargo palette 0.7.6 num/MinMax#max().(T::zerorust-analyzer cargo palette 0.7.6 num/Zero#zero().()); |
| 199 | |
| 200 | Labrust-analyzer cargo palette 0.7.6 lab/Lab# { |
| 201 | lrust-analyzer cargo palette 0.7.6 lab/Lab#l.: color.lrust-analyzer cargo palette 0.7.6 lch/Lch#l., |
| 202 | arust-analyzer cargo palette 0.7.6 lab/Lab#a.: a rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().chroma.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().(), |
| 203 | brust-analyzer cargo palette 0.7.6 lab/Lab#b.: b rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().chroma, |
| 204 | white_pointrust-analyzer cargo palette 0.7.6 lab/Lab#white_point.: PhantomDatarust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/PhantomData#, |
| 205 | } |
| 206 | } |
| 207 | } |
| 208 | |
| 209 | impl_tuple_conversionrust-analyzer cargo palette 0.7.6 macros/convert/impl_tuple_conversion!!(Labrust-analyzer cargo palette 0.7.6 lab/Lab#<Wp> as (T, T, T)); |
| 210 | |
| 211 | impl_is_within_boundsrust-analyzer cargo palette 0.7.6 macros/clamp/impl_is_within_bounds!! { |
| 212 | Labrust-analyzer cargo palette 0.7.6 lab/Lab#<Wp> { |
| 213 | lrust-analyzer cargo palette 0.7.6 lab/Lab#l. => [Selfrust-analyzer cargo palette 0.7.6 lab/impl#[`Lab<Wp, T>`][IsWithinBounds]::min_lrust-analyzer cargo palette 0.7.6 lab/impl#[`Lab<Wp, T>`]min_l().(), Selfrust-analyzer cargo palette 0.7.6 lab/impl#[`Lab<Wp, T>`][IsWithinBounds]::max_lrust-analyzer cargo palette 0.7.6 lab/impl#[`Lab<Wp, T>`]max_l().()], |
| 214 | arust-analyzer cargo palette 0.7.6 lab/Lab#a. => [Selfrust-analyzer cargo palette 0.7.6 lab/impl#[`Lab<Wp, T>`][IsWithinBounds]::min_arust-analyzer cargo palette 0.7.6 lab/impl#[`Lab<Wp, T>`]min_a().(), Selfrust-analyzer cargo palette 0.7.6 lab/impl#[`Lab<Wp, T>`][IsWithinBounds]::max_arust-analyzer cargo palette 0.7.6 lab/impl#[`Lab<Wp, T>`]max_a().()], |
| 215 | brust-analyzer cargo palette 0.7.6 lab/Lab#b. => [Selfrust-analyzer cargo palette 0.7.6 lab/impl#[`Lab<Wp, T>`][IsWithinBounds]::min_brust-analyzer cargo palette 0.7.6 lab/impl#[`Lab<Wp, T>`]min_b().(), Selfrust-analyzer cargo palette 0.7.6 lab/impl#[`Lab<Wp, T>`][IsWithinBounds]::max_brust-analyzer cargo palette 0.7.6 lab/impl#[`Lab<Wp, T>`]max_b().()] |
| 216 | } |
| 217 | where T: Realrust-analyzer cargo palette 0.7.6 num/Real# + Zerorust-analyzer cargo palette 0.7.6 num/Zero# |
| 218 | } |
| 219 | impl_clamprust-analyzer cargo palette 0.7.6 macros/clamp/impl_clamp!! { |
| 220 | Labrust-analyzer cargo palette 0.7.6 lab/Lab#<Wp> { |
| 221 | lrust-analyzer cargo palette 0.7.6 lab/Lab#l. => [Selfrust-analyzer cargo palette 0.7.6 lab/impl#[`Lab<Wp, T>`][ClampAssign]::min_lrust-analyzer cargo palette 0.7.6 lab/impl#[`Lab<Wp, T>`]min_l().(), Selfrust-analyzer cargo palette 0.7.6 lab/impl#[`Lab<Wp, T>`][ClampAssign]::max_lrust-analyzer cargo palette 0.7.6 lab/impl#[`Lab<Wp, T>`]max_l().()], |
| 222 | arust-analyzer cargo palette 0.7.6 lab/Lab#a. => [Selfrust-analyzer cargo palette 0.7.6 lab/impl#[`Lab<Wp, T>`][ClampAssign]::min_arust-analyzer cargo palette 0.7.6 lab/impl#[`Lab<Wp, T>`]min_a().(), Selfrust-analyzer cargo palette 0.7.6 lab/impl#[`Lab<Wp, T>`][ClampAssign]::max_arust-analyzer cargo palette 0.7.6 lab/impl#[`Lab<Wp, T>`]max_a().()], |
| 223 | brust-analyzer cargo palette 0.7.6 lab/Lab#b. => [Selfrust-analyzer cargo palette 0.7.6 lab/impl#[`Lab<Wp, T>`][ClampAssign]::min_brust-analyzer cargo palette 0.7.6 lab/impl#[`Lab<Wp, T>`]min_b().(), Selfrust-analyzer cargo palette 0.7.6 lab/impl#[`Lab<Wp, T>`][ClampAssign]::max_brust-analyzer cargo palette 0.7.6 lab/impl#[`Lab<Wp, T>`]max_b().()] |
| 224 | } |
| 225 | other {white_pointrust-analyzer cargo palette 0.7.6 lab/Lab#white_point.} |
| 226 | where T: Realrust-analyzer cargo palette 0.7.6 num/Real# + Zerorust-analyzer cargo palette 0.7.6 num/Zero# |
| 227 | } |
| 228 | |
| 229 | impl_mixrust-analyzer cargo palette 0.7.6 macros/mix/impl_mix!!(Labrust-analyzer cargo palette 0.7.6 lab/Lab#<Wp>); |
| 230 | impl_lightenrust-analyzer cargo palette 0.7.6 macros/lighten_saturate/impl_lighten!!(Labrust-analyzer cargo palette 0.7.6 lab/Lab#<Wp> increase {l => [Selfrust-analyzer cargo palette 0.7.6 lab/impl#[`Lab<Wp, T>`][Lighten]::min_lrust-analyzer cargo palette 0.7.6 lab/impl#[`Lab<Wp, T>`]min_l().(), Selfrust-analyzer cargo palette 0.7.6 lab/impl#[`Lab<Wp, T>`][Lighten]::max_lrust-analyzer cargo palette 0.7.6 lab/impl#[`Lab<Wp, T>`]max_l().()]} other {arust-analyzer cargo palette 0.7.6 lab/Lab#a., brust-analyzer cargo palette 0.7.6 lab/Lab#b.} phantom: white_pointrust-analyzer cargo palette 0.7.6 lab/Lab#white_point.); |
| 231 | impl_premultiplyrust-analyzer cargo palette 0.7.6 macros/blend/impl_premultiply!!(Labrust-analyzer cargo palette 0.7.6 lab/Lab#<Wp> {lrust-analyzer cargo palette 0.7.6 lab/Lab#l., arust-analyzer cargo palette 0.7.6 lab/Lab#a., brust-analyzer cargo palette 0.7.6 lab/Lab#b.} phantom: white_pointrust-analyzer cargo palette 0.7.6 lab/Lab#white_point.); |
| 232 | impl_euclidean_distancerust-analyzer cargo palette 0.7.6 macros/color_difference/impl_euclidean_distance!!(Labrust-analyzer cargo palette 0.7.6 lab/Lab#<Wp> {lrust-analyzer cargo palette 0.7.6 lab/Lab#l., arust-analyzer cargo palette 0.7.6 lab/Lab#a., brust-analyzer cargo palette 0.7.6 lab/Lab#b.}); |
| 233 | impl_hyabrust-analyzer cargo palette 0.7.6 macros/color_difference/impl_hyab!!(Labrust-analyzer cargo palette 0.7.6 lab/Lab#<Wp> {lightness: lrust-analyzer cargo palette 0.7.6 lab/Lab#l., chroma1: arust-analyzer cargo palette 0.7.6 lab/Lab#a., chroma2: brust-analyzer cargo palette 0.7.6 lab/Lab#b.}); |
| 234 | impl_lab_color_schemesrust-analyzer cargo palette 0.7.6 macros/color_theory/impl_lab_color_schemes!!(Labrust-analyzer cargo palette 0.7.6 lab/Lab#<Wp>[lrust-analyzer cargo palette 0.7.6 lab/Lab#l., white_pointrust-analyzer cargo palette 0.7.6 lab/Lab#white_point.]); |
| 235 | |
| 236 | impl<Wp, T> GetHuerust-analyzer cargo palette 0.7.6 GetHue# for Labrust-analyzer cargo palette 0.7.6 lab/Lab#<Wp, T> |
| 237 | where |
| 238 | T: RealAnglerust-analyzer cargo palette 0.7.6 angle/RealAngle# + Trigonometryrust-analyzer cargo palette 0.7.6 num/Trigonometry# + Addrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#<T, Outputrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#Output# = T> + Negrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Neg#<Outputrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Neg#Output# = T> + Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#, |
| 239 | { |
| 240 | type Huerust-analyzer cargo palette 0.7.6 lab/impl#[`Lab<Wp, T>`][GetHue]Hue# = LabHuerust-analyzer cargo palette 0.7.6 hues/LabHue#<T>; |
| 241 | |
| 242 | fn get_huerust-analyzer cargo palette 0.7.6 lab/impl#[`Lab<Wp, T>`][GetHue]get_hue().(&self) -> LabHuerust-analyzer cargo palette 0.7.6 hues/LabHue#<T> { |
| 243 | LabHuerust-analyzer cargo palette 0.7.6 hues/LabHue#::from_cartesianrust-analyzer cargo palette 0.7.6 hues/impl#[`LabHue<T>`]from_cartesian().(self.arust-analyzer cargo palette 0.7.6 lab/Lab#a..clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().(), self.brust-analyzer cargo palette 0.7.6 lab/Lab#b..clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().()) |
| 244 | } |
| 245 | } |
| 246 | |
| 247 | impl<Wp, T> DeltaErust-analyzer cargo palette 0.7.6 color_difference/DeltaE# for Labrust-analyzer cargo palette 0.7.6 lab/Lab#<Wp, T> |
| 248 | where |
| 249 | Selfrust-analyzer cargo palette 0.7.6 lab/impl#[`Lab<Wp, T>`][DeltaE]: EuclideanDistancerust-analyzer cargo palette 0.7.6 color_difference/EuclideanDistance#<Scalarrust-analyzer cargo palette 0.7.6 color_difference/EuclideanDistance#Scalar# = T>, |
| 250 | T: Sqrtrust-analyzer cargo palette 0.7.6 num/Sqrt#, |
| 251 | { |
| 252 | type Scalarrust-analyzer cargo palette 0.7.6 lab/impl#[`Lab<Wp, T>`][DeltaE]Scalar# = T; |
| 253 | |
| 254 | #[inline] |
| 255 | fn delta_erust-analyzer cargo palette 0.7.6 lab/impl#[`Lab<Wp, T>`][DeltaE]delta_e().(self, other: Selfrust-analyzer cargo palette 0.7.6 lab/impl#[`Lab<Wp, T>`][DeltaE]) -> Selfrust-analyzer cargo palette 0.7.6 lab/impl#[`Lab<Wp, T>`][DeltaE]::Scalarrust-analyzer cargo palette 0.7.6 color_difference/DeltaE#Scalar# { |
| 256 | self.distancerust-analyzer cargo palette 0.7.6 color_difference/EuclideanDistance#distance().(other) |
| 257 | } |
| 258 | } |
| 259 | |
| 260 | impl<Wp, T> ImprovedDeltaErust-analyzer cargo palette 0.7.6 color_difference/ImprovedDeltaE# for Labrust-analyzer cargo palette 0.7.6 lab/Lab#<Wp, T> |
| 261 | where |
| 262 | Selfrust-analyzer cargo palette 0.7.6 lab/impl#[`Lab<Wp, T>`][ImprovedDeltaE]: DeltaErust-analyzer cargo palette 0.7.6 color_difference/DeltaE#<Scalarrust-analyzer cargo palette 0.7.6 color_difference/DeltaE#Scalar# = T> + EuclideanDistancerust-analyzer cargo palette 0.7.6 color_difference/EuclideanDistance#<Scalarrust-analyzer cargo palette 0.7.6 color_difference/EuclideanDistance#Scalar# = T>, |
| 263 | T: Realrust-analyzer cargo palette 0.7.6 num/Real# + Mulrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#<T, Outputrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#Output# = T> + Powfrust-analyzer cargo palette 0.7.6 num/Powf#, |
| 264 | { |
| 265 | #[inline] |
| 266 | fn improved_delta_erust-analyzer cargo palette 0.7.6 lab/impl#[`Lab<Wp, T>`][ImprovedDeltaE]improved_delta_e().(self, other: Selfrust-analyzer cargo palette 0.7.6 lab/impl#[`Lab<Wp, T>`][ImprovedDeltaE]) -> Selfrust-analyzer cargo palette 0.7.6 lab/impl#[`Lab<Wp, T>`][ImprovedDeltaE]::Scalarrust-analyzer cargo palette 0.7.6 color_difference/DeltaE#Scalar# { |
| 267 | // Coefficients from "Power functions improving the performance of |
| 268 | // color-difference formulas" by Huang et al. |
| 269 | // https://opg.optica.org/oe/fulltext.cfm?uri=oe-23-1-597&id=307643 |
| 270 | // |
| 271 | // The multiplication of 0.5 in the exponent makes it square root the |
| 272 | // squared distance. |
| 273 | T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(1.26) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul().self.distance_squaredrust-analyzer cargo palette 0.7.6 color_difference/EuclideanDistance#distance_squared().(other).powfrust-analyzer cargo palette 0.7.6 num/Powf#powf().(T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(0.55 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Mul<Self>`]mul().0.5)) |
| 274 | } |
| 275 | } |
| 276 | |
| 277 | #[allow(deprecated)] |
| 278 | impl<Wp, T> craterust-analyzer cargo palette 0.7.6 crate/::ColorDifferencerust-analyzer cargo palette 0.7.6 color_difference/ColorDifference# for Labrust-analyzer cargo palette 0.7.6 lab/Lab#<Wp, T> |
| 279 | where |
| 280 | T: Realrust-analyzer cargo palette 0.7.6 num/Real# |
| 281 | + RealAnglerust-analyzer cargo palette 0.7.6 angle/RealAngle# |
| 282 | + Onerust-analyzer cargo palette 0.7.6 num/One# |
| 283 | + Zerorust-analyzer cargo palette 0.7.6 num/Zero# |
| 284 | + Powirust-analyzer cargo palette 0.7.6 num/Powi# |
| 285 | + Exprust-analyzer cargo palette 0.7.6 num/Exp# |
| 286 | + Trigonometryrust-analyzer cargo palette 0.7.6 num/Trigonometry# |
| 287 | + Absrust-analyzer cargo palette 0.7.6 num/Abs# |
| 288 | + Sqrtrust-analyzer cargo palette 0.7.6 num/Sqrt# |
| 289 | + Arithmeticsrust-analyzer cargo palette 0.7.6 num/Arithmetics# |
| 290 | + PartialCmprust-analyzer cargo palette 0.7.6 num/PartialCmp# |
| 291 | + Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#, |
| 292 | T::Maskrust-analyzer cargo palette 0.7.6 bool_mask/HasBoolMask#Mask#: LazySelectrust-analyzer cargo palette 0.7.6 bool_mask/LazySelect#<T> + BitAndrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/BitAnd#<Outputrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/BitAnd#Output# = T::Maskrust-analyzer cargo palette 0.7.6 bool_mask/HasBoolMask#Mask#> + BitOrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/BitOr#<Outputrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/BitOr#Output# = T::Maskrust-analyzer cargo palette 0.7.6 bool_mask/HasBoolMask#Mask#>, |
| 293 | Selfrust-analyzer cargo palette 0.7.6 lab/impl#[`Lab<Wp, T>`][ColorDifference]: Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#<LabColorDiffrust-analyzer cargo palette 0.7.6 color_difference/LabColorDiff#<T>>, |
| 294 | { |
| 295 | type Scalarrust-analyzer cargo palette 0.7.6 lab/impl#[`Lab<Wp, T>`][ColorDifference]Scalar# = T; |
| 296 | |
| 297 | #[inline] |
| 298 | fn get_color_differencerust-analyzer cargo palette 0.7.6 lab/impl#[`Lab<Wp, T>`][ColorDifference]get_color_difference().(self, other: Labrust-analyzer cargo palette 0.7.6 lab/Lab#<Wp, T>) -> Selfrust-analyzer cargo palette 0.7.6 lab/impl#[`Lab<Wp, T>`][ColorDifference]::Scalarrust-analyzer cargo palette 0.7.6 color_difference/ColorDifference#Scalar# { |
| 299 | get_ciede2000_differencerust-analyzer cargo palette 0.7.6 color_difference/get_ciede2000_difference().(self.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#into().(), other.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#into().()) |
| 300 | } |
| 301 | } |
| 302 | |
| 303 | impl<Wp, T> Ciede2000rust-analyzer cargo palette 0.7.6 color_difference/Ciede2000# for Labrust-analyzer cargo palette 0.7.6 lab/Lab#<Wp, T> |
| 304 | where |
| 305 | T: Realrust-analyzer cargo palette 0.7.6 num/Real# |
| 306 | + RealAnglerust-analyzer cargo palette 0.7.6 angle/RealAngle# |
| 307 | + Onerust-analyzer cargo palette 0.7.6 num/One# |
| 308 | + Zerorust-analyzer cargo palette 0.7.6 num/Zero# |
| 309 | + Powirust-analyzer cargo palette 0.7.6 num/Powi# |
| 310 | + Exprust-analyzer cargo palette 0.7.6 num/Exp# |
| 311 | + Trigonometryrust-analyzer cargo palette 0.7.6 num/Trigonometry# |
| 312 | + Absrust-analyzer cargo palette 0.7.6 num/Abs# |
| 313 | + Sqrtrust-analyzer cargo palette 0.7.6 num/Sqrt# |
| 314 | + Arithmeticsrust-analyzer cargo palette 0.7.6 num/Arithmetics# |
| 315 | + PartialCmprust-analyzer cargo palette 0.7.6 num/PartialCmp# |
| 316 | + Hypotrust-analyzer cargo palette 0.7.6 num/Hypot# |
| 317 | + Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#, |
| 318 | T::Maskrust-analyzer cargo palette 0.7.6 bool_mask/HasBoolMask#Mask#: LazySelectrust-analyzer cargo palette 0.7.6 bool_mask/LazySelect#<T> + BitAndrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/BitAnd#<Outputrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/BitAnd#Output# = T::Maskrust-analyzer cargo palette 0.7.6 bool_mask/HasBoolMask#Mask#> + BitOrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/BitOr#<Outputrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/BitOr#Output# = T::Maskrust-analyzer cargo palette 0.7.6 bool_mask/HasBoolMask#Mask#>, |
| 319 | { |
| 320 | type Scalarrust-analyzer cargo palette 0.7.6 lab/impl#[`Lab<Wp, T>`][Ciede2000]Scalar# = T; |
| 321 | |
| 322 | #[inline] |
| 323 | fn differencerust-analyzer cargo palette 0.7.6 lab/impl#[`Lab<Wp, T>`][Ciede2000]difference().(self, other: Selfrust-analyzer cargo palette 0.7.6 lab/impl#[`Lab<Wp, T>`][Ciede2000]) -> Selfrust-analyzer cargo palette 0.7.6 lab/impl#[`Lab<Wp, T>`][Ciede2000]::Scalarrust-analyzer cargo palette 0.7.6 color_difference/Ciede2000#Scalar# { |
| 324 | get_ciede2000_differencerust-analyzer cargo palette 0.7.6 color_difference/get_ciede2000_difference().(self.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), other.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()) |
| 325 | } |
| 326 | } |
| 327 | |
| 328 | impl<Wp, T> HasBoolMaskrust-analyzer cargo palette 0.7.6 bool_mask/HasBoolMask# for Labrust-analyzer cargo palette 0.7.6 lab/Lab#<Wp, T> |
| 329 | where |
| 330 | T: HasBoolMaskrust-analyzer cargo palette 0.7.6 bool_mask/HasBoolMask#, |
| 331 | { |
| 332 | type Maskrust-analyzer cargo palette 0.7.6 lab/impl#[`Lab<Wp, T>`][HasBoolMask]Mask# = T::Maskrust-analyzer cargo palette 0.7.6 bool_mask/HasBoolMask#Mask#; |
| 333 | } |
| 334 | |
| 335 | impl<Wp, T> Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default# for Labrust-analyzer cargo palette 0.7.6 lab/Lab#<Wp, T> |
| 336 | where |
| 337 | T: Zerorust-analyzer cargo palette 0.7.6 num/Zero#, |
| 338 | { |
| 339 | fn defaultrust-analyzer cargo palette 0.7.6 lab/impl#[`Lab<Wp, T>`][Default]default().() -> Labrust-analyzer cargo palette 0.7.6 lab/Lab#<Wp, T> { |
| 340 | Labrust-analyzer cargo palette 0.7.6 lab/Lab#::newrust-analyzer cargo palette 0.7.6 lab/impl#[`Lab<Wp, T>`]new().(T::zerorust-analyzer cargo palette 0.7.6 num/Zero#zero().(), T::zerorust-analyzer cargo palette 0.7.6 num/Zero#zero().(), T::zerorust-analyzer cargo palette 0.7.6 num/Zero#zero().()) |
| 341 | } |
| 342 | } |
| 343 | |
| 344 | impl_color_addrust-analyzer cargo palette 0.7.6 macros/arithmetics/impl_color_add!!(Labrust-analyzer cargo palette 0.7.6 lab/Lab#<Wp>, [lrust-analyzer cargo palette 0.7.6 lab/Lab#l., arust-analyzer cargo palette 0.7.6 lab/Lab#a., brust-analyzer cargo palette 0.7.6 lab/Lab#b.], white_pointrust-analyzer cargo palette 0.7.6 lab/Lab#white_point.); |
| 345 | impl_color_subrust-analyzer cargo palette 0.7.6 macros/arithmetics/impl_color_sub!!(Labrust-analyzer cargo palette 0.7.6 lab/Lab#<Wp>, [lrust-analyzer cargo palette 0.7.6 lab/Lab#l., arust-analyzer cargo palette 0.7.6 lab/Lab#a., brust-analyzer cargo palette 0.7.6 lab/Lab#b.], white_pointrust-analyzer cargo palette 0.7.6 lab/Lab#white_point.); |
| 346 | impl_color_mulrust-analyzer cargo palette 0.7.6 macros/arithmetics/impl_color_mul!!(Labrust-analyzer cargo palette 0.7.6 lab/Lab#<Wp>, [lrust-analyzer cargo palette 0.7.6 lab/Lab#l., arust-analyzer cargo palette 0.7.6 lab/Lab#a., brust-analyzer cargo palette 0.7.6 lab/Lab#b.], white_pointrust-analyzer cargo palette 0.7.6 lab/Lab#white_point.); |
| 347 | impl_color_divrust-analyzer cargo palette 0.7.6 macros/arithmetics/impl_color_div!!(Labrust-analyzer cargo palette 0.7.6 lab/Lab#<Wp>, [lrust-analyzer cargo palette 0.7.6 lab/Lab#l., arust-analyzer cargo palette 0.7.6 lab/Lab#a., brust-analyzer cargo palette 0.7.6 lab/Lab#b.], white_pointrust-analyzer cargo palette 0.7.6 lab/Lab#white_point.); |
| 348 | |
| 349 | impl_array_castsrust-analyzer cargo palette 0.7.6 macros/casting/impl_array_casts!!(Labrust-analyzer cargo palette 0.7.6 lab/Lab#<Wp, T>, [T; 3]); |
| 350 | impl_simd_array_conversionrust-analyzer cargo palette 0.7.6 macros/simd/impl_simd_array_conversion!!(Labrust-analyzer cargo palette 0.7.6 lab/Lab#<Wp>, [l, a, b], white_pointrust-analyzer cargo palette 0.7.6 lab/Lab#white_point.); |
| 351 | impl_struct_of_array_traitsrust-analyzer cargo palette 0.7.6 macros/struct_of_arrays/impl_struct_of_array_traits!!(Labrust-analyzer cargo palette 0.7.6 lab/Lab#<Wp>, [lrust-analyzer cargo palette 0.7.6 lab/Lab#l., arust-analyzer cargo palette 0.7.6 lab/Lab#a., brust-analyzer cargo palette 0.7.6 lab/Lab#b.], white_pointrust-analyzer cargo palette 0.7.6 lab/Lab#white_point.); |
| 352 | |
| 353 | impl_eqrust-analyzer cargo palette 0.7.6 macros/equality/impl_eq!!(Labrust-analyzer cargo palette 0.7.6 lab/Lab#<Wp>, [lrust-analyzer cargo palette 0.7.6 lab/Lab#l., arust-analyzer cargo palette 0.7.6 lab/Lab#a., brust-analyzer cargo palette 0.7.6 lab/Lab#b.]); |
| 354 | impl_copy_clonerust-analyzer cargo palette 0.7.6 macros/copy_clone/impl_copy_clone!!(Labrust-analyzer cargo palette 0.7.6 lab/Lab#<Wp>, [lrust-analyzer cargo palette 0.7.6 lab/Lab#l., arust-analyzer cargo palette 0.7.6 lab/Lab#a., brust-analyzer cargo palette 0.7.6 lab/Lab#b.], white_pointrust-analyzer cargo palette 0.7.6 lab/Lab#white_point.); |
| 355 | |
| 356 | #[allow(deprecated)] |
| 357 | impl<Wp, T> craterust-analyzer cargo palette 0.7.6 crate/::RelativeContrastrust-analyzer cargo palette 0.7.6 relative_contrast/RelativeContrast# for Labrust-analyzer cargo palette 0.7.6 lab/Lab#<Wp, T> |
| 358 | where |
| 359 | T: Realrust-analyzer cargo palette 0.7.6 num/Real# + Arithmeticsrust-analyzer cargo palette 0.7.6 num/Arithmetics# + PartialCmprust-analyzer cargo palette 0.7.6 num/PartialCmp#, |
| 360 | T::Maskrust-analyzer cargo palette 0.7.6 bool_mask/HasBoolMask#Mask#: LazySelectrust-analyzer cargo palette 0.7.6 bool_mask/LazySelect#<T>, |
| 361 | Xyzrust-analyzer cargo palette 0.7.6 xyz/Xyz#<Wp, T>: FromColorrust-analyzer cargo palette 0.7.6 convert/from_into_color/FromColor#<Selfrust-analyzer cargo palette 0.7.6 lab/impl#[`Lab<Wp, T>`][RelativeContrast]>, |
| 362 | { |
| 363 | type Scalarrust-analyzer cargo palette 0.7.6 lab/impl#[`Lab<Wp, T>`][RelativeContrast]Scalar# = T; |
| 364 | |
| 365 | #[inline] |
| 366 | fn get_contrast_ratiorust-analyzer cargo palette 0.7.6 lab/impl#[`Lab<Wp, T>`][RelativeContrast]get_contrast_ratio().(self, other: Selfrust-analyzer cargo palette 0.7.6 lab/impl#[`Lab<Wp, T>`][RelativeContrast]) -> T { |
| 367 | let xyz1 = Xyzrust-analyzer cargo palette 0.7.6 xyz/Xyz#::from_colorrust-analyzer cargo palette 0.7.6 convert/from_into_color/FromColor#from_color().(self); |
| 368 | let xyz2 = Xyzrust-analyzer cargo palette 0.7.6 xyz/Xyz#::from_colorrust-analyzer cargo palette 0.7.6 convert/from_into_color/FromColor#from_color().(other); |
| 369 | |
| 370 | craterust-analyzer cargo palette 0.7.6 crate/::contrast_ratiorust-analyzer cargo palette 0.7.6 relative_contrast/contrast_ratio().(xyz1.yrust-analyzer cargo palette 0.7.6 xyz/Xyz#y., xyz2.yrust-analyzer cargo palette 0.7.6 xyz/Xyz#y.) |
| 371 | } |
| 372 | } |
| 373 | |
| 374 | impl_rand_traits_cartesianrust-analyzer cargo palette 0.7.6 macros/random/impl_rand_traits_cartesian!!( |
| 375 | UniformLabrust-analyzer cargo palette 0.7.6 lab/UniformLab#, |
| 376 | Labrust-analyzer cargo palette 0.7.6 lab/Lab#<Wp> { |
| 377 | lrust-analyzer cargo palette 0.7.6 lab/Lab#l. => [|x| x *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(100.0)], |
| 378 | arust-analyzer cargo palette 0.7.6 lab/Lab#a. => [|x| x *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(255.0) -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Sub#sub(). T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(128.0)], |
| 379 | brust-analyzer cargo palette 0.7.6 lab/Lab#b. => [|x| x *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(255.0) -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Sub#sub(). T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(128.0)] |
| 380 | } |
| 381 | phantom: white_pointrust-analyzer cargo palette 0.7.6 lab/Lab#white_point.: PhantomData<Wp> |
| 382 | where T: Realrust-analyzer cargo palette 0.7.6 num/Real# + corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::opsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/::Subrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Sub#<Outputrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Sub#Output# = T> + corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::opsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/::Mulrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#<Outputrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#Output# = T> |
| 383 | ); |
| 384 | |
| 385 | #[cfg(feature = "bytemuck")] |
| 386 | unsafe impl<Wp, T> bytemuckrust-analyzer cargo bytemuck 1.25.2 crate/::Zeroablerust-analyzer cargo bytemuck 1.25.2 zeroable/Zeroable# for Labrust-analyzer cargo palette 0.7.6 lab/Lab#<Wp, T> where T: bytemuckrust-analyzer cargo bytemuck 1.25.2 crate/::Zeroablerust-analyzer cargo bytemuck 1.25.2 zeroable/Zeroable# {} |
| 387 | |
| 388 | #[cfg(feature = "bytemuck")] |
| 389 | unsafe impl<Wp: 'static, T> bytemuckrust-analyzer cargo bytemuck 1.25.2 crate/::Podrust-analyzer cargo bytemuck 1.25.2 pod/Pod# for Labrust-analyzer cargo palette 0.7.6 lab/Lab#<Wp, T> where T: bytemuckrust-analyzer cargo bytemuck 1.25.2 crate/::Podrust-analyzer cargo bytemuck 1.25.2 pod/Pod# {} |
| 390 | |
| 391 | #[cfg(test)] |
| 392 | mod testrust-analyzer cargo palette 0.7.6 lab/test/ { |
| 393 | use superrust-analyzer cargo palette 0.7.6 lab/::Labrust-analyzer cargo palette 0.7.6 lab/Lab#; |
| 394 | use craterust-analyzer cargo palette 0.7.6 crate/::white_pointrust-analyzer cargo palette 0.7.6 white_point/::D65rust-analyzer cargo palette 0.7.6 white_point/D65#; |
| 395 | |
| 396 | #[cfg(feature = "approx")] |
| 397 | use craterust-analyzer cargo palette 0.7.6 crate/::Lchrust-analyzer cargo palette 0.7.6 lch/Lch#; |
| 398 | |
| 399 | test_convert_into_from_xyzrust-analyzer cargo palette 0.7.6 macros/convert/test_convert_into_from_xyz!!(Labrust-analyzer cargo palette 0.7.6 lab/Lab#); |
| 400 | |
| 401 | #[cfg(feature = "approx")] |
| 402 | mod conversionrust-analyzer cargo palette 0.7.6 lab/test/conversion/ { |
| 403 | use craterust-analyzer cargo palette 0.7.6 crate/::{FromColorrust-analyzer cargo palette 0.7.6 convert/from_into_color/FromColor#, Labrust-analyzer cargo palette 0.7.6 lab/Lab#, LinSrgbrust-analyzer cargo palette 0.7.6 rgb/LinSrgb#}; |
| 404 | |
| 405 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 406 | fn redrust-analyzer cargo palette 0.7.6 lab/test/conversion/red().() { |
| 407 | let a = Labrust-analyzer cargo palette 0.7.6 lab/Lab#::from_colorrust-analyzer cargo palette 0.7.6 convert/from_into_color/impl#[U][`FromColor<T>`]from_color().(LinSrgbrust-analyzer cargo palette 0.7.6 rgb/LinSrgb#::newrust-analyzer cargo palette 0.7.6 rgb/rgb/impl#[`Rgb<S, T>`]new().(1.0, 0.0, 0.0)); |
| 408 | let b = Labrust-analyzer cargo palette 0.7.6 lab/Lab#::newrust-analyzer cargo palette 0.7.6 lab/impl#[`Lab<Wp, T>`]new().(53.23288, 80.09246, 67.2031); |
| 409 | assert_relative_eqrust-analyzer cargo approx 0.5.1 macros/assert_relative_eq!!(a, b, epsilonrust-analyzer cargo approx 0.5.1 impl#[`Relative<A, B>`]epsilon(). = 0.01); |
| 410 | } |
| 411 | |
| 412 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 413 | fn greenrust-analyzer cargo palette 0.7.6 lab/test/conversion/green().() { |
| 414 | let a = Labrust-analyzer cargo palette 0.7.6 lab/Lab#::from_colorrust-analyzer cargo palette 0.7.6 convert/from_into_color/impl#[U][`FromColor<T>`]from_color().(LinSrgbrust-analyzer cargo palette 0.7.6 rgb/LinSrgb#::newrust-analyzer cargo palette 0.7.6 rgb/rgb/impl#[`Rgb<S, T>`]new().(0.0, 1.0, 0.0)); |
| 415 | let b = Labrust-analyzer cargo palette 0.7.6 lab/Lab#::newrust-analyzer cargo palette 0.7.6 lab/impl#[`Lab<Wp, T>`]new().(87.73704, -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][Neg]neg().86.184654, 83.18117); |
| 416 | assert_relative_eqrust-analyzer cargo approx 0.5.1 macros/assert_relative_eq!!(a, b, epsilonrust-analyzer cargo approx 0.5.1 impl#[`Relative<A, B>`]epsilon(). = 0.01); |
| 417 | } |
| 418 | |
| 419 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 420 | fn bluerust-analyzer cargo palette 0.7.6 lab/test/conversion/blue().() { |
| 421 | let a = Labrust-analyzer cargo palette 0.7.6 lab/Lab#::from_colorrust-analyzer cargo palette 0.7.6 convert/from_into_color/impl#[U][`FromColor<T>`]from_color().(LinSrgbrust-analyzer cargo palette 0.7.6 rgb/LinSrgb#::newrust-analyzer cargo palette 0.7.6 rgb/rgb/impl#[`Rgb<S, T>`]new().(0.0, 0.0, 1.0)); |
| 422 | let b = Labrust-analyzer cargo palette 0.7.6 lab/Lab#::newrust-analyzer cargo palette 0.7.6 lab/impl#[`Lab<Wp, T>`]new().(32.302586, 79.19668, -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][Neg]neg().107.863686); |
| 423 | assert_relative_eqrust-analyzer cargo approx 0.5.1 macros/assert_relative_eq!!(a, b, epsilonrust-analyzer cargo approx 0.5.1 impl#[`Relative<A, B>`]epsilon(). = 0.01); |
| 424 | } |
| 425 | } |
| 426 | |
| 427 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 428 | fn rangesrust-analyzer cargo palette 0.7.6 lab/test/ranges().() { |
| 429 | assert_rangesrust-analyzer cargo palette 0.7.6 macros/clamp/assert_ranges!! { |
| 430 | Labrust-analyzer cargo palette 0.7.6 lab/Lab#<D65rust-analyzer cargo palette 0.7.6 white_point/D65#, f64>; |
| 431 | clamped { |
| 432 | l: 0.0 => 100.0, |
| 433 | a: -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][Neg]neg().128.0 => 127.0, |
| 434 | b: -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][Neg]neg().128.0 => 127.0 |
| 435 | } |
| 436 | clamped_min {} |
| 437 | unclamped {} |
| 438 | } |
| 439 | } |
| 440 | |
| 441 | raw_pixel_conversion_testsrust-analyzer cargo palette 0.7.6 macros/casting/raw_pixel_conversion_tests!!(Labrust-analyzer cargo palette 0.7.6 lab/Lab#<D65rust-analyzer cargo palette 0.7.6 white_point/D65#>: l, a, b); |
| 442 | raw_pixel_conversion_fail_testsrust-analyzer cargo palette 0.7.6 macros/casting/raw_pixel_conversion_fail_tests!!(Labrust-analyzer cargo palette 0.7.6 lab/Lab#<D65rust-analyzer cargo palette 0.7.6 white_point/D65#>: l, a, b); |
| 443 | |
| 444 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 445 | fn check_min_max_componentsrust-analyzer cargo palette 0.7.6 lab/test/check_min_max_components().() { |
| 446 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(Labrust-analyzer cargo palette 0.7.6 lab/Lab#::<D65rust-analyzer cargo palette 0.7.6 white_point/D65#, f32>::min_lrust-analyzer cargo palette 0.7.6 lab/impl#[`Lab<Wp, T>`]min_l().(), 0.0); |
| 447 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(Labrust-analyzer cargo palette 0.7.6 lab/Lab#::<D65rust-analyzer cargo palette 0.7.6 white_point/D65#, f32>::min_arust-analyzer cargo palette 0.7.6 lab/impl#[`Lab<Wp, T>`]min_a().(), -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][Neg]neg().128.0); |
| 448 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(Labrust-analyzer cargo palette 0.7.6 lab/Lab#::<D65rust-analyzer cargo palette 0.7.6 white_point/D65#, f32>::min_brust-analyzer cargo palette 0.7.6 lab/impl#[`Lab<Wp, T>`]min_b().(), -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f32][Neg]neg().128.0); |
| 449 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(Labrust-analyzer cargo palette 0.7.6 lab/Lab#::<D65rust-analyzer cargo palette 0.7.6 white_point/D65#, f32>::max_lrust-analyzer cargo palette 0.7.6 lab/impl#[`Lab<Wp, T>`]max_l().(), 100.0); |
| 450 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(Labrust-analyzer cargo palette 0.7.6 lab/Lab#::<D65rust-analyzer cargo palette 0.7.6 white_point/D65#, f32>::max_arust-analyzer cargo palette 0.7.6 lab/impl#[`Lab<Wp, T>`]max_a().(), 127.0); |
| 451 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(Labrust-analyzer cargo palette 0.7.6 lab/Lab#::<D65rust-analyzer cargo palette 0.7.6 white_point/D65#, f32>::max_brust-analyzer cargo palette 0.7.6 lab/impl#[`Lab<Wp, T>`]max_b().(), 127.0); |
| 452 | } |
| 453 | |
| 454 | struct_of_arrays_testsrust-analyzer cargo palette 0.7.6 macros/struct_of_arrays/struct_of_arrays_tests!!( |
| 455 | Labrust-analyzer cargo palette 0.7.6 lab/Lab#<D65rust-analyzer cargo palette 0.7.6 white_point/D65#>[lrust-analyzer cargo palette 0.7.6 lab/Lab#l., arust-analyzer cargo palette 0.7.6 lab/Lab#a., brust-analyzer cargo palette 0.7.6 lab/Lab#b.] phantom: white_pointrust-analyzer cargo palette 0.7.6 lab/Lab#white_point., |
| 456 | superrust-analyzer cargo palette 0.7.6 lab/::Labarust-analyzer cargo palette 0.7.6 lab/Laba#::newrust-analyzer cargo palette 0.7.6 lab/impl#[`Alpha<Lab<Wp, T>, A>`]new().(0.1f32, 0.2, 0.3, 0.4), |
| 457 | superrust-analyzer cargo palette 0.7.6 lab/::Labarust-analyzer cargo palette 0.7.6 lab/Laba#::newrust-analyzer cargo palette 0.7.6 lab/impl#[`Alpha<Lab<Wp, T>, A>`]new().(0.2, 0.3, 0.4, 0.5), |
| 458 | superrust-analyzer cargo palette 0.7.6 lab/::Labarust-analyzer cargo palette 0.7.6 lab/Laba#::newrust-analyzer cargo palette 0.7.6 lab/impl#[`Alpha<Lab<Wp, T>, A>`]new().(0.3, 0.4, 0.5, 0.6) |
| 459 | ); |
| 460 | |
| 461 | #[cfg(feature = "serializing")] |
| 462 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 463 | fn serializerust-analyzer cargo palette 0.7.6 lab/test/serialize().() { |
| 464 | let serialized = ::serde_jsonrust-analyzer cargo serde_json 1.0.116 crate/::to_stringrust-analyzer cargo serde_json 1.0.116 ser/to_string().(&Labrust-analyzer cargo palette 0.7.6 lab/Lab#::<D65rust-analyzer cargo palette 0.7.6 white_point/D65#>::newrust-analyzer cargo palette 0.7.6 lab/impl#[`Lab<Wp, T>`]new().(0.3, 0.8, 0.1)).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 465 | |
| 466 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(serialized, r#"{"l":0.3,"a":0.8,"b":0.1}"#); |
| 467 | } |
| 468 | |
| 469 | #[cfg(feature = "serializing")] |
| 470 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 471 | fn deserializerust-analyzer cargo palette 0.7.6 lab/test/deserialize().() { |
| 472 | let deserialized: Labrust-analyzer cargo palette 0.7.6 lab/Lab# = ::serde_jsonrust-analyzer cargo serde_json 1.0.116 crate/::from_strrust-analyzer cargo serde_json 1.0.116 de/from_str().(r#"{"l":0.3,"a":0.8,"b":0.1}"#).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 473 | |
| 474 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(deserialized, Labrust-analyzer cargo palette 0.7.6 lab/Lab#::newrust-analyzer cargo palette 0.7.6 lab/impl#[`Lab<Wp, T>`]new().(0.3, 0.8, 0.1)); |
| 475 | } |
| 476 | |
| 477 | test_uniform_distributionrust-analyzer cargo palette 0.7.6 macros/random/test_uniform_distribution!! { |
| 478 | Lab<D65, f32> { |
| 479 | l: (0.0, 100.0), |
| 480 | a: (-128.0, 127.0), |
| 481 | b: (-128.0, 127.0) |
| 482 | }, |
| 483 | min: Lab::new(0.0f32, -128.0, -128.0), |
| 484 | max: Lab::new(100.0, 127.0, 127.0) |
| 485 | } |
| 486 | |
| 487 | test_lab_color_schemesrust-analyzer cargo palette 0.7.6 macros/color_theory/test_lab_color_schemes!!(Labrust-analyzer cargo palette 0.7.6 lab/Lab#/Lchrust-analyzer cargo palette 0.7.6 lch/Lch# [l, white_point]); |
| 488 | } |