| 1 | use corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::{ |
| 2 | 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#, |
| 3 | opsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/::{Divrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Div#, Mulrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#}, |
| 4 | }; |
| 5 | |
| 6 | use craterust-analyzer cargo palette 0.7.6 crate/::{ |
| 7 | anglerust-analyzer cargo palette 0.7.6 angle/::{RealAnglerust-analyzer cargo palette 0.7.6 angle/RealAngle#, SignedAnglerust-analyzer cargo palette 0.7.6 angle/SignedAngle#}, |
| 8 | bool_maskrust-analyzer cargo palette 0.7.6 bool_mask/::{LazySelectrust-analyzer cargo palette 0.7.6 bool_mask/LazySelect#, Selectrust-analyzer cargo palette 0.7.6 bool_mask/Select#}, |
| 9 | clamprust-analyzer cargo palette 0.7.6 clamp()., |
| 10 | huesrust-analyzer cargo palette 0.7.6 hues/::Cam16Huerust-analyzer cargo palette 0.7.6 hues/Cam16Hue#, |
| 11 | numrust-analyzer cargo palette 0.7.6 num/::{ |
| 12 | Absrust-analyzer cargo palette 0.7.6 num/Abs#, Arithmeticsrust-analyzer cargo palette 0.7.6 num/Arithmetics#, Clamprust-analyzer cargo palette 0.7.6 num/Clamp#, Exprust-analyzer cargo palette 0.7.6 num/Exp#, FromScalarrust-analyzer cargo palette 0.7.6 num/FromScalar#, 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#, Realrust-analyzer cargo palette 0.7.6 num/Real#, Signumrust-analyzer cargo palette 0.7.6 num/Signum#, Sqrtrust-analyzer cargo palette 0.7.6 num/Sqrt#, |
| 13 | Trigonometryrust-analyzer cargo palette 0.7.6 num/Trigonometry#, Zerorust-analyzer cargo palette 0.7.6 num/Zero#, |
| 14 | }, |
| 15 | white_pointrust-analyzer cargo palette 0.7.6 white_point/, |
| 16 | xyzrust-analyzer cargo palette 0.7.6 xyz/::Xyzrust-analyzer cargo palette 0.7.6 xyz/Xyz#, |
| 17 | }; |
| 18 | |
| 19 | use superrust-analyzer cargo palette 0.7.6 cam16/::{Cam16rust-analyzer cargo palette 0.7.6 cam16/full/Cam16#, Parametersrust-analyzer cargo palette 0.7.6 cam16/parameters/Parameters#}; |
| 20 | |
| 21 | use selfrust-analyzer cargo palette 0.7.6 cam16/math/::{chromaticityrust-analyzer cargo palette 0.7.6 cam16/math/chromaticity/::ChromaticityTyperust-analyzer cargo palette 0.7.6 cam16/math/chromaticity/ChromaticityType#, luminancerust-analyzer cargo palette 0.7.6 cam16/math/luminance/::LuminanceTyperust-analyzer cargo palette 0.7.6 cam16/math/luminance/LuminanceType#}; |
| 22 | |
| 23 | pub(craterust-analyzer cargo palette 0.7.6 crate/) mod chromaticityrust-analyzer cargo palette 0.7.6 cam16/math/chromaticity/; |
| 24 | pub(craterust-analyzer cargo palette 0.7.6 crate/) mod luminancerust-analyzer cargo palette 0.7.6 cam16/math/luminance/; |
| 25 | |
| 26 | // This module is originally based on these sources: |
| 27 | // - https://observablehq.com/@jrus/cam16 |
| 28 | // - "Comprehensive color solutions: CAM16, CAT16, and CAM16-UCS" by Li C, Li Z, |
| 29 | // Wang Z, et al. |
| 30 | // (https://www.researchgate.net/publication/318152296_Comprehensive_color_solutions_CAM16_CAT16_and_CAM16-UCS) |
| 31 | // - "Algorithmic improvements for the CIECAM02 and CAM16 color appearance |
| 32 | // models" by Nico Schlömer (https://arxiv.org/pdf/1802.06067.pdf) |
| 33 | // - https://rawpedia.rawtherapee.com/CIECAM02. |
| 34 | // - "Usage Guidelines for CIECAM97s" by Nathan Moroney |
| 35 | // (https://www.imaging.org/common/uploaded%20files/pdfs/Papers/2000/PICS-0-81/1611.pdf) |
| 36 | // - "CIECAM02 and Its Recent Developments" by Ming Ronnier Luo and Changjun Li |
| 37 | // (https://cielab.xyz/pdf/CIECAM02_and_Its_Recent_Developments.pdf) |
| 38 | // - https://en.wikipedia.org/wiki/CIECAM02 |
| 39 | |
| 40 | pub(craterust-analyzer cargo palette 0.7.6 crate/) fn xyz_to_cam16rust-analyzer cargo palette 0.7.6 cam16/math/xyz_to_cam16().<T>( |
| 41 | xyz: Xyzrust-analyzer cargo palette 0.7.6 xyz/Xyz#<white_pointrust-analyzer cargo palette 0.7.6 white_point/::Anyrust-analyzer cargo palette 0.7.6 white_point/Any#, T>, |
| 42 | parameters: DependentParametersrust-analyzer cargo palette 0.7.6 cam16/math/DependentParameters#<T::Scalarrust-analyzer cargo palette 0.7.6 num/FromScalar#Scalar#>, |
| 43 | ) -> Cam16rust-analyzer cargo palette 0.7.6 cam16/full/Cam16#<T> |
| 44 | where |
| 45 | T: Realrust-analyzer cargo palette 0.7.6 num/Real# |
| 46 | + FromScalarrust-analyzer cargo palette 0.7.6 num/FromScalar# |
| 47 | + Arithmeticsrust-analyzer cargo palette 0.7.6 num/Arithmetics# |
| 48 | + Powfrust-analyzer cargo palette 0.7.6 num/Powf# |
| 49 | + Sqrtrust-analyzer cargo palette 0.7.6 num/Sqrt# |
| 50 | + Absrust-analyzer cargo palette 0.7.6 num/Abs# |
| 51 | + Signumrust-analyzer cargo palette 0.7.6 num/Signum# |
| 52 | + Trigonometryrust-analyzer cargo palette 0.7.6 num/Trigonometry# |
| 53 | + RealAnglerust-analyzer cargo palette 0.7.6 angle/RealAngle# |
| 54 | + Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#, |
| 55 | T::Scalarrust-analyzer cargo palette 0.7.6 num/FromScalar#Scalar#: Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#, |
| 56 | { |
| 57 | let xyz = xyz.with_white_pointrust-analyzer cargo palette 0.7.6 xyz/impl#[`Xyz<Wp, T>`]with_white_point().() rust-analyzer cargo palette 0.7.6 xyz/impl#[`Xyz<Wp, T>`][`Mul<T>`]mul().*rust-analyzer cargo palette 0.7.6 xyz/impl#[`Xyz<Wp, T>`][`Mul<T>`]mul(). rust-analyzer cargo palette 0.7.6 xyz/impl#[`Xyz<Wp, T>`][`Mul<T>`]mul().T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(100.0); // The reference uses 0.0 to 100.0 instead of 0.0 to 1.0. |
| 58 | let d_rgb = map3rust-analyzer cargo palette 0.7.6 cam16/math/map3().(parameters.d_rgbrust-analyzer cargo palette 0.7.6 cam16/math/DependentParameters#d_rgb..clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][Clone]clone().(), T::from_scalarrust-analyzer cargo palette 0.7.6 num/FromScalar#from_scalar().); |
| 59 | |
| 60 | let [r_a, g_a, b_a] = map3rust-analyzer cargo palette 0.7.6 cam16/math/map3().(mul3rust-analyzer cargo palette 0.7.6 cam16/math/mul3().(m16rust-analyzer cargo palette 0.7.6 cam16/math/m16().(xyz), d_rgb), |component| { |
| 61 | parameters.adaptrust-analyzer cargo palette 0.7.6 cam16/math/DependentParameters#adapt..runrust-analyzer cargo palette 0.7.6 cam16/math/impl#[`Adapt<T>`]run().(component) |
| 62 | }); |
| 63 | let a = r_a.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/Add#add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().(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().12.0) 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().&g_a rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().&b_a) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Div#div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Div#div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Div#div().T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(11.0); // redness-greenness |
| 64 | let b = (r_a.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/Add#add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().&g_a 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().(2.0) 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().&b_a) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Div#div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Div#div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Div#div().T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(9.0); // yellowness-blueness |
| 65 | let h_rad = b.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().().atan2rust-analyzer cargo palette 0.7.6 num/Trigonometry#atan2().(a.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().()); // hue in radians |
| 66 | let h = Cam16Huerust-analyzer cargo palette 0.7.6 hues/Cam16Hue#::from_radiansrust-analyzer cargo palette 0.7.6 hues/impl#[`Cam16Hue<T>`]from_radians().(h_rad.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().()); // hue in degrees |
| 67 | let e_t = T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(0.25) 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::cosrust-analyzer cargo palette 0.7.6 num/Trigonometry#cos().(h_rad rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(2.0)) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(3.8)); |
| 68 | let capital_a = T::from_scalarrust-analyzer cargo palette 0.7.6 num/FromScalar#from_scalar().(parameters.n_bbrust-analyzer cargo palette 0.7.6 cam16/math/DependentParameters#n_bb.) |
| 69 | *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().(2.0) 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().&r_a rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().&g_a rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(0.05) 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().&b_a); |
| 70 | let j_root = (capital_a rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Div#div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Div#div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Div#div().T::from_scalarrust-analyzer cargo palette 0.7.6 num/FromScalar#from_scalar().(parameters.a_wrust-analyzer cargo palette 0.7.6 cam16/math/DependentParameters#a_w..clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().())).powfrust-analyzer cargo palette 0.7.6 num/Powf#powf().( |
| 71 | T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(0.5) 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_scalarrust-analyzer cargo palette 0.7.6 num/FromScalar#from_scalar().(parameters.crust-analyzer cargo palette 0.7.6 cam16/math/DependentParameters#c..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_scalarrust-analyzer cargo palette 0.7.6 num/FromScalar#from_scalar().(parameters.zrust-analyzer cargo palette 0.7.6 cam16/math/DependentParameters#z.), |
| 72 | ); |
| 73 | |
| 74 | let j = calculate_lightnessrust-analyzer cargo palette 0.7.6 cam16/math/calculate_lightness().(j_root.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().()); // lightness |
| 75 | let q = calculate_brightnessrust-analyzer cargo palette 0.7.6 cam16/math/calculate_brightness().( |
| 76 | j_root.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().(), |
| 77 | T::from_scalarrust-analyzer cargo palette 0.7.6 num/FromScalar#from_scalar().(parameters.crust-analyzer cargo palette 0.7.6 cam16/math/DependentParameters#c..clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().()), |
| 78 | T::from_scalarrust-analyzer cargo palette 0.7.6 num/FromScalar#from_scalar().(parameters.a_wrust-analyzer cargo palette 0.7.6 cam16/math/DependentParameters#a_w..clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().()), |
| 79 | T::from_scalarrust-analyzer cargo palette 0.7.6 num/FromScalar#from_scalar().(parameters.f_l_4rust-analyzer cargo palette 0.7.6 cam16/math/DependentParameters#f_l_4..clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().()), |
| 80 | ); // brightness |
| 81 | |
| 82 | let t = T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(5e4) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Div#div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Div#div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Div#div().T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(13.0) |
| 83 | *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_scalarrust-analyzer cargo palette 0.7.6 num/FromScalar#from_scalar().(parameters.n_crust-analyzer cargo palette 0.7.6 cam16/math/DependentParameters#n_c.) |
| 84 | *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_scalarrust-analyzer cargo palette 0.7.6 num/FromScalar#from_scalar().(parameters.n_cbrust-analyzer cargo palette 0.7.6 cam16/math/DependentParameters#n_cb.) |
| 85 | *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().e_t |
| 86 | *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().(a.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().a rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().b.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().b).sqrtrust-analyzer cargo palette 0.7.6 num/Sqrt#sqrt().() |
| 87 | /rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Div#div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Div#div().(r_a rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().g_a rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(1.05) 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().b_a rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(0.305)); |
| 88 | let alpha = t.powfrust-analyzer cargo palette 0.7.6 num/Powf#powf().(T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(0.9)) |
| 89 | *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().(1.64) 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().(0.29).powfrust-analyzer cargo palette 0.7.6 num/Powf#powf().(T::from_scalarrust-analyzer cargo palette 0.7.6 num/FromScalar#from_scalar().(parameters.nrust-analyzer cargo palette 0.7.6 cam16/math/DependentParameters#n.))) |
| 90 | .powfrust-analyzer cargo palette 0.7.6 num/Powf#powf().(T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(0.73)); |
| 91 | |
| 92 | let c = calculate_chromarust-analyzer cargo palette 0.7.6 cam16/math/calculate_chroma().(j_root, alpha.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().()); // chroma |
| 93 | let m = calculate_colorfulnessrust-analyzer cargo palette 0.7.6 cam16/math/calculate_colorfulness().(T::from_scalarrust-analyzer cargo palette 0.7.6 num/FromScalar#from_scalar().(parameters.f_l_4rust-analyzer cargo palette 0.7.6 cam16/math/DependentParameters#f_l_4.), c.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().()); // colorfulness |
| 94 | let s = calculate_saturationrust-analyzer cargo palette 0.7.6 cam16/math/calculate_saturation().( |
| 95 | T::from_scalarrust-analyzer cargo palette 0.7.6 num/FromScalar#from_scalar().(parameters.crust-analyzer cargo palette 0.7.6 cam16/math/DependentParameters#c.), |
| 96 | T::from_scalarrust-analyzer cargo palette 0.7.6 num/FromScalar#from_scalar().(parameters.a_wrust-analyzer cargo palette 0.7.6 cam16/math/DependentParameters#a_w.), |
| 97 | alpha, |
| 98 | ); // saturation |
| 99 | |
| 100 | Cam16rust-analyzer cargo palette 0.7.6 cam16/full/Cam16# { |
| 101 | lightnessrust-analyzer cargo palette 0.7.6 cam16/full/Cam16#lightness.: j, |
| 102 | chromarust-analyzer cargo palette 0.7.6 cam16/full/Cam16#chroma.: c, |
| 103 | huerust-analyzer cargo palette 0.7.6 cam16/full/Cam16#hue.: h, |
| 104 | brightnessrust-analyzer cargo palette 0.7.6 cam16/full/Cam16#brightness.: q, |
| 105 | colorfulnessrust-analyzer cargo palette 0.7.6 cam16/full/Cam16#colorfulness.: m, |
| 106 | saturationrust-analyzer cargo palette 0.7.6 cam16/full/Cam16#saturation.: s, |
| 107 | } |
| 108 | } |
| 109 | |
| 110 | fn calculate_lightnessrust-analyzer cargo palette 0.7.6 cam16/math/calculate_lightness().<T>(j_root: T) -> T |
| 111 | where |
| 112 | T: Realrust-analyzer cargo palette 0.7.6 num/Real# + Arithmeticsrust-analyzer cargo palette 0.7.6 num/Arithmetics#, |
| 113 | { |
| 114 | T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(100.0) 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().&j_root 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().j_root |
| 115 | } |
| 116 | |
| 117 | fn calculate_brightnessrust-analyzer cargo palette 0.7.6 cam16/math/calculate_brightness().<T>(j_root: T, param_c: T, param_a_w: T, param_f_l_4: T) -> T |
| 118 | where |
| 119 | T: Realrust-analyzer cargo palette 0.7.6 num/Real# + Arithmeticsrust-analyzer cargo palette 0.7.6 num/Arithmetics#, |
| 120 | { |
| 121 | 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/Div#div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Div#div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Div#div().param_c 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().j_root 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().(4.0) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().param_a_w) 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().param_f_l_4 |
| 122 | } |
| 123 | |
| 124 | #[inline] |
| 125 | pub(superrust-analyzer cargo palette 0.7.6 cam16/) fn calculate_chromarust-analyzer cargo palette 0.7.6 cam16/math/calculate_chroma().<T>(j_root: T, alpha: T) -> T |
| 126 | where |
| 127 | T: 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>, |
| 128 | { |
| 129 | j_root 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().alpha |
| 130 | } |
| 131 | |
| 132 | #[inline] |
| 133 | pub(superrust-analyzer cargo palette 0.7.6 cam16/) fn calculate_colorfulnessrust-analyzer cargo palette 0.7.6 cam16/math/calculate_colorfulness().<T>(param_f_l_4: T, chroma: T) -> T |
| 134 | where |
| 135 | T: 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>, |
| 136 | { |
| 137 | param_f_l_4 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 |
| 138 | } |
| 139 | |
| 140 | #[inline] |
| 141 | pub(superrust-analyzer cargo palette 0.7.6 cam16/) fn calculate_saturationrust-analyzer cargo palette 0.7.6 cam16/math/calculate_saturation().<T>(param_c: T, param_a_w: T, alpha: T) -> T |
| 142 | where |
| 143 | T: Realrust-analyzer cargo palette 0.7.6 num/Real# + Arithmeticsrust-analyzer cargo palette 0.7.6 num/Arithmetics# + Sqrtrust-analyzer cargo palette 0.7.6 num/Sqrt#, |
| 144 | { |
| 145 | T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(50.0) 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().(param_c 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().alpha rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Div#div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Div#div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Div#div().(param_a_w rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(4.0))).sqrtrust-analyzer cargo palette 0.7.6 num/Sqrt#sqrt().() |
| 146 | } |
| 147 | |
| 148 | #[inline] |
| 149 | pub(craterust-analyzer cargo palette 0.7.6 crate/) fn cam16_to_xyzrust-analyzer cargo palette 0.7.6 cam16/math/cam16_to_xyz().<T>( |
| 150 | cam16: (LuminanceTyperust-analyzer cargo palette 0.7.6 cam16/math/luminance/LuminanceType#<T>, ChromaticityTyperust-analyzer cargo palette 0.7.6 cam16/math/chromaticity/ChromaticityType#<T>, Cam16Huerust-analyzer cargo palette 0.7.6 hues/Cam16Hue#<T>), |
| 151 | parameters: DependentParametersrust-analyzer cargo palette 0.7.6 cam16/math/DependentParameters#<T::Scalarrust-analyzer cargo palette 0.7.6 num/FromScalar#Scalar#>, |
| 152 | ) -> Xyzrust-analyzer cargo palette 0.7.6 xyz/Xyz#<white_pointrust-analyzer cargo palette 0.7.6 white_point/::Anyrust-analyzer cargo palette 0.7.6 white_point/Any#, T> |
| 153 | where |
| 154 | T: Realrust-analyzer cargo palette 0.7.6 num/Real# |
| 155 | + FromScalarrust-analyzer cargo palette 0.7.6 num/FromScalar# |
| 156 | + Onerust-analyzer cargo palette 0.7.6 num/One# |
| 157 | + Zerorust-analyzer cargo palette 0.7.6 num/Zero# |
| 158 | + Sqrtrust-analyzer cargo palette 0.7.6 num/Sqrt# |
| 159 | + Powfrust-analyzer cargo palette 0.7.6 num/Powf# |
| 160 | + Absrust-analyzer cargo palette 0.7.6 num/Abs# |
| 161 | + Signumrust-analyzer cargo palette 0.7.6 num/Signum# |
| 162 | + Arithmeticsrust-analyzer cargo palette 0.7.6 num/Arithmetics# |
| 163 | + Trigonometryrust-analyzer cargo palette 0.7.6 num/Trigonometry# |
| 164 | + RealAnglerust-analyzer cargo palette 0.7.6 angle/RealAngle# |
| 165 | + SignedAnglerust-analyzer cargo palette 0.7.6 angle/SignedAngle# |
| 166 | + PartialCmprust-analyzer cargo palette 0.7.6 num/PartialCmp# |
| 167 | + Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#, |
| 168 | T::Maskrust-analyzer cargo palette 0.7.6 bool_mask/HasBoolMask#Mask#: LazySelectrust-analyzer cargo palette 0.7.6 bool_mask/LazySelect#<T> + Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#, |
| 169 | T::Scalarrust-analyzer cargo palette 0.7.6 num/FromScalar#Scalar#: Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#, |
| 170 | { |
| 171 | // Weird naming, but we just want to know if it's black or not here. |
| 172 | let is_black = match &cam16.0 { |
| 173 | LuminanceTyperust-analyzer cargo palette 0.7.6 cam16/math/luminance/LuminanceType#::Lightnessrust-analyzer cargo palette 0.7.6 cam16/math/luminance/LuminanceType#Lightness#(lightness) => lightness.eqrust-analyzer cargo palette 0.7.6 num/PartialCmp#eq().(&T::zerorust-analyzer cargo palette 0.7.6 num/Zero#zero().()), |
| 174 | LuminanceTyperust-analyzer cargo palette 0.7.6 cam16/math/luminance/LuminanceType#::Brightnessrust-analyzer cargo palette 0.7.6 cam16/math/luminance/LuminanceType#Brightness#(brightness) => brightness.eqrust-analyzer cargo palette 0.7.6 num/PartialCmp#eq().(&T::zerorust-analyzer cargo palette 0.7.6 num/Zero#zero().()), |
| 175 | }; |
| 176 | |
| 177 | let xyz = non_black_cam16_to_xyzrust-analyzer cargo palette 0.7.6 cam16/math/non_black_cam16_to_xyz().(cam16, parameters); |
| 178 | Xyzrust-analyzer cargo palette 0.7.6 xyz/Xyz# { |
| 179 | xrust-analyzer cargo palette 0.7.6 xyz/Xyz#x.: is_black.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().().selectrust-analyzer cargo palette 0.7.6 bool_mask/Select#select().(T::zerorust-analyzer cargo palette 0.7.6 num/Zero#zero().(), xyz.xrust-analyzer cargo palette 0.7.6 xyz/Xyz#x.), |
| 180 | yrust-analyzer cargo palette 0.7.6 xyz/Xyz#y.: is_black.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().().selectrust-analyzer cargo palette 0.7.6 bool_mask/Select#select().(T::zerorust-analyzer cargo palette 0.7.6 num/Zero#zero().(), xyz.yrust-analyzer cargo palette 0.7.6 xyz/Xyz#y.), |
| 181 | zrust-analyzer cargo palette 0.7.6 xyz/Xyz#z.: is_black.selectrust-analyzer cargo palette 0.7.6 bool_mask/Select#select().(T::zerorust-analyzer cargo palette 0.7.6 num/Zero#zero().(), xyz.zrust-analyzer cargo palette 0.7.6 xyz/Xyz#z.), |
| 182 | white_pointrust-analyzer cargo palette 0.7.6 xyz/Xyz#white_point.: PhantomDatarust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/PhantomData#, |
| 183 | } |
| 184 | } |
| 185 | |
| 186 | // Assumes that lightness has been checked to be non-zero in `cam16_to_xyz`. |
| 187 | fn non_black_cam16_to_xyzrust-analyzer cargo palette 0.7.6 cam16/math/non_black_cam16_to_xyz().<T>( |
| 188 | cam16: (LuminanceTyperust-analyzer cargo palette 0.7.6 cam16/math/luminance/LuminanceType#<T>, ChromaticityTyperust-analyzer cargo palette 0.7.6 cam16/math/chromaticity/ChromaticityType#<T>, Cam16Huerust-analyzer cargo palette 0.7.6 hues/Cam16Hue#<T>), |
| 189 | parameters: DependentParametersrust-analyzer cargo palette 0.7.6 cam16/math/DependentParameters#<T::Scalarrust-analyzer cargo palette 0.7.6 num/FromScalar#Scalar#>, |
| 190 | ) -> Xyzrust-analyzer cargo palette 0.7.6 xyz/Xyz#<white_pointrust-analyzer cargo palette 0.7.6 white_point/::Anyrust-analyzer cargo palette 0.7.6 white_point/Any#, T> |
| 191 | where |
| 192 | T: Realrust-analyzer cargo palette 0.7.6 num/Real# |
| 193 | + FromScalarrust-analyzer cargo palette 0.7.6 num/FromScalar# |
| 194 | + Onerust-analyzer cargo palette 0.7.6 num/One# |
| 195 | + Sqrtrust-analyzer cargo palette 0.7.6 num/Sqrt# |
| 196 | + Powfrust-analyzer cargo palette 0.7.6 num/Powf# |
| 197 | + Absrust-analyzer cargo palette 0.7.6 num/Abs# |
| 198 | + Signumrust-analyzer cargo palette 0.7.6 num/Signum# |
| 199 | + Arithmeticsrust-analyzer cargo palette 0.7.6 num/Arithmetics# |
| 200 | + Trigonometryrust-analyzer cargo palette 0.7.6 num/Trigonometry# |
| 201 | + RealAnglerust-analyzer cargo palette 0.7.6 angle/RealAngle# |
| 202 | + SignedAnglerust-analyzer cargo palette 0.7.6 angle/SignedAngle# |
| 203 | + Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#, |
| 204 | T::Scalarrust-analyzer cargo palette 0.7.6 num/FromScalar#Scalar#: Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#, |
| 205 | { |
| 206 | let h_rad = cam16.2.into_radiansrust-analyzer cargo palette 0.7.6 hues/impl#[`Cam16Hue<T>`]into_radians().(); |
| 207 | let (sin_h, cos_h) = h_rad.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().().sin_cosrust-analyzer cargo palette 0.7.6 num/Trigonometry#sin_cos().(); |
| 208 | let j_root = match cam16.0 { |
| 209 | LuminanceTyperust-analyzer cargo palette 0.7.6 cam16/math/luminance/LuminanceType#::Lightnessrust-analyzer cargo palette 0.7.6 cam16/math/luminance/LuminanceType#Lightness#(j) => lightness_to_j_rootrust-analyzer cargo palette 0.7.6 cam16/math/lightness_to_j_root().(j), |
| 210 | LuminanceTyperust-analyzer cargo palette 0.7.6 cam16/math/luminance/LuminanceType#::Brightnessrust-analyzer cargo palette 0.7.6 cam16/math/luminance/LuminanceType#Brightness#(q) => brightness_to_j_rootrust-analyzer cargo palette 0.7.6 cam16/math/brightness_to_j_root().( |
| 211 | q, |
| 212 | T::from_scalarrust-analyzer cargo palette 0.7.6 num/FromScalar#from_scalar().(parameters.crust-analyzer cargo palette 0.7.6 cam16/math/DependentParameters#c..clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().()), |
| 213 | T::from_scalarrust-analyzer cargo palette 0.7.6 num/FromScalar#from_scalar().(parameters.a_wrust-analyzer cargo palette 0.7.6 cam16/math/DependentParameters#a_w..clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().()), |
| 214 | T::from_scalarrust-analyzer cargo palette 0.7.6 num/FromScalar#from_scalar().(parameters.f_l_4rust-analyzer cargo palette 0.7.6 cam16/math/DependentParameters#f_l_4..clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().()), |
| 215 | ), |
| 216 | }; |
| 217 | let alpha = match cam16.1 { |
| 218 | ChromaticityTyperust-analyzer cargo palette 0.7.6 cam16/math/chromaticity/ChromaticityType#::Chromarust-analyzer cargo palette 0.7.6 cam16/math/chromaticity/ChromaticityType#Chroma#(c) => c rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Div#div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Div#div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Div#div().&j_root, |
| 219 | ChromaticityTyperust-analyzer cargo palette 0.7.6 cam16/math/chromaticity/ChromaticityType#::Colorfulnessrust-analyzer cargo palette 0.7.6 cam16/math/chromaticity/ChromaticityType#Colorfulness#(m) => { |
| 220 | colorfulness_to_chromarust-analyzer cargo palette 0.7.6 cam16/math/colorfulness_to_chroma().(m, T::from_scalarrust-analyzer cargo palette 0.7.6 num/FromScalar#from_scalar().(parameters.f_l_4rust-analyzer cargo palette 0.7.6 cam16/math/DependentParameters#f_l_4.)) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Div#div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Div#div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Div#div().&j_root |
| 221 | } |
| 222 | ChromaticityTyperust-analyzer cargo palette 0.7.6 cam16/math/chromaticity/ChromaticityType#::Saturationrust-analyzer cargo palette 0.7.6 cam16/math/chromaticity/ChromaticityType#Saturation#(s) => saturation_to_alpharust-analyzer cargo palette 0.7.6 cam16/math/saturation_to_alpha().( |
| 223 | s, |
| 224 | T::from_scalarrust-analyzer cargo palette 0.7.6 num/FromScalar#from_scalar().(parameters.crust-analyzer cargo palette 0.7.6 cam16/math/DependentParameters#c..clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().()), |
| 225 | T::from_scalarrust-analyzer cargo palette 0.7.6 num/FromScalar#from_scalar().(parameters.a_wrust-analyzer cargo palette 0.7.6 cam16/math/DependentParameters#a_w..clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().()), |
| 226 | ), |
| 227 | }; |
| 228 | let t = (alpha |
| 229 | *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().(1.64) 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().(0.29).powfrust-analyzer cargo palette 0.7.6 num/Powf#powf().(T::from_scalarrust-analyzer cargo palette 0.7.6 num/FromScalar#from_scalar().(parameters.nrust-analyzer cargo palette 0.7.6 cam16/math/DependentParameters#n.))) |
| 230 | .powfrust-analyzer cargo palette 0.7.6 num/Powf#powf().(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().0.73))) |
| 231 | .powfrust-analyzer cargo palette 0.7.6 num/Powf#powf().(T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(10.0) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Div#div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Div#div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Div#div().T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(9.0)); |
| 232 | let e_t = T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(0.25) 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().((h_rad rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(2.0)).cosrust-analyzer cargo palette 0.7.6 num/Trigonometry#cos().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(3.8)); |
| 233 | let capital_a = T::from_scalarrust-analyzer cargo palette 0.7.6 num/FromScalar#from_scalar().(parameters.a_wrust-analyzer cargo palette 0.7.6 cam16/math/DependentParameters#a_w.) |
| 234 | *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().j_root |
| 235 | .powfrust-analyzer cargo palette 0.7.6 num/Powf#powf().(T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(2.0) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Div#div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Div#div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Div#div().T::from_scalarrust-analyzer cargo palette 0.7.6 num/FromScalar#from_scalar().(parameters.crust-analyzer cargo palette 0.7.6 cam16/math/DependentParameters#c.) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Div#div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Div#div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Div#div().T::from_scalarrust-analyzer cargo palette 0.7.6 num/FromScalar#from_scalar().(parameters.zrust-analyzer cargo palette 0.7.6 cam16/math/DependentParameters#z.)); |
| 236 | let p_1 = T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(5e4) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Div#div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Div#div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Div#div().T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(13.0) |
| 237 | *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_scalarrust-analyzer cargo palette 0.7.6 num/FromScalar#from_scalar().(parameters.n_crust-analyzer cargo palette 0.7.6 cam16/math/DependentParameters#n_c.) |
| 238 | *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_scalarrust-analyzer cargo palette 0.7.6 num/FromScalar#from_scalar().(parameters.n_cbrust-analyzer cargo palette 0.7.6 cam16/math/DependentParameters#n_cb.) |
| 239 | *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().e_t; |
| 240 | let p_2 = capital_a rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Div#div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Div#div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Div#div().T::from_scalarrust-analyzer cargo palette 0.7.6 num/FromScalar#from_scalar().(parameters.n_bbrust-analyzer cargo palette 0.7.6 cam16/math/DependentParameters#n_bb.); |
| 241 | let r = T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(23.0) 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().(0.305) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().&p_2) 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 |
| 242 | /rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Div#div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Div#div().(T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(23.0) 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().p_1 |
| 243 | +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().t 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().(11.0) 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().&cos_h rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(108.0) 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().&sin_h)); |
| 244 | let a = cos_h 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().&r; |
| 245 | let b = sin_h 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().r; |
| 246 | let denom = T::onerust-analyzer cargo palette 0.7.6 num/One#one().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Div#div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Div#div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Div#div().T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(1403.0); |
| 247 | let rgb_c = [ |
| 248 | (T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(460.0) 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().&p_2 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(451.0) 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().&a rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(288.0) 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().&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().&denom, |
| 249 | (T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(460.0) 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().&p_2 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().(891.0) 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().&a 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().(261.0) 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().&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().&denom, |
| 250 | (T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(460.0) 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().p_2 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().(220.0) 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().a 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().(6300.0) 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().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().&denom, |
| 251 | ]; |
| 252 | |
| 253 | let unadapt = parameters.unadaptrust-analyzer cargo palette 0.7.6 cam16/math/DependentParameters#unadapt.; |
| 254 | let rgb_c = map3rust-analyzer cargo palette 0.7.6 cam16/math/map3().(rgb_c, |component| unadapt.runrust-analyzer cargo palette 0.7.6 cam16/math/impl#[`Unadapt<T>`]run().(component)); |
| 255 | let d_rgb_inv = map3rust-analyzer cargo palette 0.7.6 cam16/math/map3().(parameters.d_rgb_invrust-analyzer cargo palette 0.7.6 cam16/math/DependentParameters#d_rgb_inv., T::from_scalarrust-analyzer cargo palette 0.7.6 num/FromScalar#from_scalar().); |
| 256 | |
| 257 | m16_invrust-analyzer cargo palette 0.7.6 cam16/math/m16_inv().(mul3rust-analyzer cargo palette 0.7.6 cam16/math/mul3().(rgb_c, d_rgb_inv)) rust-analyzer cargo palette 0.7.6 xyz/impl#[`Xyz<Wp, T>`][`Div<T>`]div()./rust-analyzer cargo palette 0.7.6 xyz/impl#[`Xyz<Wp, T>`][`Div<T>`]div(). rust-analyzer cargo palette 0.7.6 xyz/impl#[`Xyz<Wp, T>`][`Div<T>`]div().T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(100.0) // The reference uses 0.0 to 100.0 instead of 0.0 to 1.0. |
| 258 | } |
| 259 | |
| 260 | pub(superrust-analyzer cargo palette 0.7.6 cam16/) fn prepare_parametersrust-analyzer cargo palette 0.7.6 cam16/math/prepare_parameters().<T>( |
| 261 | parameters: Parametersrust-analyzer cargo palette 0.7.6 cam16/parameters/Parameters#<Xyzrust-analyzer cargo palette 0.7.6 xyz/Xyz#<white_pointrust-analyzer cargo palette 0.7.6 white_point/::Anyrust-analyzer cargo palette 0.7.6 white_point/Any#, T>, T>, |
| 262 | ) -> DependentParametersrust-analyzer cargo palette 0.7.6 cam16/math/DependentParameters#<T> |
| 263 | where |
| 264 | T: Realrust-analyzer cargo palette 0.7.6 num/Real# |
| 265 | + FromScalarrust-analyzer cargo palette 0.7.6 num/FromScalar#<Scalarrust-analyzer cargo palette 0.7.6 num/FromScalar#Scalar# = T> |
| 266 | + Onerust-analyzer cargo palette 0.7.6 num/One# |
| 267 | + Zerorust-analyzer cargo palette 0.7.6 num/Zero# |
| 268 | + Clamprust-analyzer cargo palette 0.7.6 num/Clamp# |
| 269 | + PartialCmprust-analyzer cargo palette 0.7.6 num/PartialCmp# |
| 270 | + Arithmeticsrust-analyzer cargo palette 0.7.6 num/Arithmetics# |
| 271 | + Powfrust-analyzer cargo palette 0.7.6 num/Powf# |
| 272 | + Sqrtrust-analyzer cargo palette 0.7.6 num/Sqrt# |
| 273 | + Exprust-analyzer cargo palette 0.7.6 num/Exp# |
| 274 | + Absrust-analyzer cargo palette 0.7.6 num/Abs# |
| 275 | + Signumrust-analyzer cargo palette 0.7.6 num/Signum# |
| 276 | + Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#, |
| 277 | T::Maskrust-analyzer cargo palette 0.7.6 bool_mask/HasBoolMask#Mask#: LazySelectrust-analyzer cargo palette 0.7.6 bool_mask/LazySelect#<T>, |
| 278 | { |
| 279 | // Compute dependent parameters. |
| 280 | let xyz_w = parameters.white_pointrust-analyzer cargo palette 0.7.6 cam16/parameters/Parameters#white_point. rust-analyzer cargo palette 0.7.6 xyz/impl#[`Xyz<Wp, T>`][`Mul<T>`]mul().*rust-analyzer cargo palette 0.7.6 xyz/impl#[`Xyz<Wp, T>`][`Mul<T>`]mul(). rust-analyzer cargo palette 0.7.6 xyz/impl#[`Xyz<Wp, T>`][`Mul<T>`]mul().T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(100.0); // The reference uses 0.0 to 100.0 instead of 0.0 to 1.0. |
| 281 | let l_a = parameters.adapting_luminancerust-analyzer cargo palette 0.7.6 cam16/parameters/Parameters#adapting_luminance.; |
| 282 | let y_b = parameters.background_luminancerust-analyzer cargo palette 0.7.6 cam16/parameters/Parameters#background_luminance. 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().(100.0); // The reference uses 0.0 to 100.0 instead of 0.0 to 1.0. |
| 283 | let y_w = xyz_w.yrust-analyzer cargo palette 0.7.6 xyz/Xyz#y..clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().(); |
| 284 | let surround = parameters.surroundrust-analyzer cargo palette 0.7.6 cam16/parameters/Parameters#surround..into_percentrust-analyzer cargo palette 0.7.6 cam16/parameters/impl#[`Surround<T>`]into_percent().() 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().(0.1); |
| 285 | let c = lazy_selectrust-analyzer cargo palette 0.7.6 macros/lazy_select/lazy_select!! { |
| 286 | if surround.gt_eqrust-analyzer cargo palette 0.7.6 num/PartialCmp#gt_eq().(&T::onerust-analyzer cargo palette 0.7.6 num/One#one().()) => lerprust-analyzer cargo palette 0.7.6 cam16/math/lerp().( |
| 287 | T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(0.59), |
| 288 | T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(0.69), |
| 289 | surround.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/Sub#sub(). T::onerust-analyzer cargo palette 0.7.6 num/One#one().(), |
| 290 | ), |
| 291 | else => lerprust-analyzer cargo palette 0.7.6 cam16/math/lerp().(T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(0.525), T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(0.59), surround.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().()) |
| 292 | }; |
| 293 | let f = lazy_selectrust-analyzer cargo palette 0.7.6 macros/lazy_select/lazy_select!! { |
| 294 | if c.gt_eqrust-analyzer cargo palette 0.7.6 num/PartialCmp#gt_eq().(&T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(0.59)) => lerprust-analyzer cargo palette 0.7.6 cam16/math/lerp().( |
| 295 | T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(0.9), |
| 296 | T::onerust-analyzer cargo palette 0.7.6 num/One#one().(), |
| 297 | (c.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/Sub#sub(). T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(0.59)) /rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Div#div(). T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(0.1)), |
| 298 | else => lerprust-analyzer cargo palette 0.7.6 cam16/math/lerp().( |
| 299 | T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(0.8), |
| 300 | T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(0.9), |
| 301 | (c.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/Sub#sub(). T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(0.525)) /rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Div#div(). T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(0.065) |
| 302 | ) |
| 303 | }; |
| 304 | let n_c = f.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().(); |
| 305 | let k = T::onerust-analyzer cargo palette 0.7.6 num/One#one().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Div#div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Div#div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Div#div().(T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(5.0) 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().&l_a rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().T::onerust-analyzer cargo palette 0.7.6 num/One#one().()); |
| 306 | let f_l = { |
| 307 | // Luminance adaptation factor |
| 308 | let k4 = k.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().&k 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().&k 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().k; |
| 309 | let k4_inv = T::onerust-analyzer cargo palette 0.7.6 num/One#one().() 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().&k4; |
| 310 | let a_third = T::onerust-analyzer cargo palette 0.7.6 num/One#one().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Div#div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Div#div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Div#div().T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(3.0); |
| 311 | |
| 312 | k4 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().&l_a rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(0.1) 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().&k4_inv 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().k4_inv 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().(5.0) 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().&l_a).powfrust-analyzer cargo palette 0.7.6 num/Powf#powf().(a_third) |
| 313 | }; |
| 314 | let f_l_4 = f_l.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().().powfrust-analyzer cargo palette 0.7.6 num/Powf#powf().(T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(0.25)); |
| 315 | let n = y_b rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Div#div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Div#div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Div#div().&y_w; |
| 316 | let z = T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(1.48) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().n.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().().sqrtrust-analyzer cargo palette 0.7.6 num/Sqrt#sqrt().(); // Lightness non-linearity exponent (modified by `c`). |
| 317 | let n_bb = T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(0.725) 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().n.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().().powfrust-analyzer cargo palette 0.7.6 num/Powf#powf().(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().0.2)); // Chromatic induction factors |
| 318 | let n_cb = n_bb.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().(); |
| 319 | // Illuminant discounting (adaptation). Fully adapted = 1 |
| 320 | let d = match parameters.discountingrust-analyzer cargo palette 0.7.6 cam16/parameters/Parameters#discounting. { |
| 321 | superrust-analyzer cargo palette 0.7.6 cam16/::Discountingrust-analyzer cargo palette 0.7.6 cam16/parameters/Discounting#::Autorust-analyzer cargo palette 0.7.6 cam16/parameters/Discounting#Auto# => { |
| 322 | // The default D function. |
| 323 | f 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::onerust-analyzer cargo palette 0.7.6 num/One#one().() |
| 324 | -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::onerust-analyzer cargo palette 0.7.6 num/One#one().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Div#div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Div#div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Div#div().T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(3.6) |
| 325 | *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().Exprust-analyzer cargo palette 0.7.6 num/Exp#::exprust-analyzer cargo palette 0.7.6 num/Exp#exp().((-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Neg#neg().l_a 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().(42.0)) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Div#div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Div#div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Div#div().T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(92.0))) |
| 326 | } |
| 327 | superrust-analyzer cargo palette 0.7.6 cam16/::Discountingrust-analyzer cargo palette 0.7.6 cam16/parameters/Discounting#::Customrust-analyzer cargo palette 0.7.6 cam16/parameters/Discounting#Custom#(degree) => degree, |
| 328 | }; |
| 329 | |
| 330 | let d = clamprust-analyzer cargo palette 0.7.6 clamp().(d, T::zerorust-analyzer cargo palette 0.7.6 num/Zero#zero().(), T::onerust-analyzer cargo palette 0.7.6 num/One#one().()); |
| 331 | |
| 332 | let rgb_w = m16rust-analyzer cargo palette 0.7.6 cam16/math/m16().(xyz_w); // Cone responses of the white point |
| 333 | let d_rgb = map3rust-analyzer cargo palette 0.7.6 cam16/math/map3().(rgb_w.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][Clone]clone().(), |c_w| { |
| 334 | lerprust-analyzer cargo palette 0.7.6 cam16/math/lerp().(T::onerust-analyzer cargo palette 0.7.6 num/One#one().(), y_w.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/Div#div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Div#div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Div#div().c_w, d.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().()) |
| 335 | }); |
| 336 | let d_rgb_inv = map3rust-analyzer cargo palette 0.7.6 cam16/math/map3().(d_rgb.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][Clone]clone().(), |d_c| T::onerust-analyzer cargo palette 0.7.6 num/One#one().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Div#div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Div#div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Div#div().d_c); |
| 337 | let rgb_cw = mul3rust-analyzer cargo palette 0.7.6 cam16/math/mul3().(rgb_w, d_rgb.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][Clone]clone().()); |
| 338 | |
| 339 | let adapt = Adaptrust-analyzer cargo palette 0.7.6 cam16/math/Adapt# { f_lrust-analyzer cargo palette 0.7.6 cam16/math/Adapt#f_l.: f_l.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().() }; |
| 340 | |
| 341 | let exponent = T::onerust-analyzer cargo palette 0.7.6 num/One#one().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Div#div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Div#div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Div#div().T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(0.42); |
| 342 | let unadapt = Unadaptrust-analyzer cargo palette 0.7.6 cam16/math/Unadapt# { |
| 343 | constantrust-analyzer cargo palette 0.7.6 cam16/math/Unadapt#constant.: T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(100.0) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Div#div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Div#div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Div#div().f_l 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().(27.13).powfrust-analyzer cargo palette 0.7.6 num/Powf#powf().(exponent.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().()), |
| 344 | exponentrust-analyzer cargo palette 0.7.6 cam16/math/Unadapt#exponent., |
| 345 | }; |
| 346 | |
| 347 | let [rgb_aw1, rgb_aw2, rgb_aw3] = map3rust-analyzer cargo palette 0.7.6 cam16/math/map3().(rgb_cw, |component| adapt.runrust-analyzer cargo palette 0.7.6 cam16/math/impl#[`Adapt<T>`]run().(component)); |
| 348 | let a_w = n_bb.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().(2.0) 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().rgb_aw1 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().rgb_aw2 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(0.05) 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().rgb_aw3); |
| 349 | |
| 350 | DependentParametersrust-analyzer cargo palette 0.7.6 cam16/math/DependentParameters# { |
| 351 | d_rgbrust-analyzer cargo palette 0.7.6 cam16/math/DependentParameters#d_rgb., |
| 352 | d_rgb_invrust-analyzer cargo palette 0.7.6 cam16/math/DependentParameters#d_rgb_inv., |
| 353 | nrust-analyzer cargo palette 0.7.6 cam16/math/DependentParameters#n., |
| 354 | n_bbrust-analyzer cargo palette 0.7.6 cam16/math/DependentParameters#n_bb., |
| 355 | n_crust-analyzer cargo palette 0.7.6 cam16/math/DependentParameters#n_c., |
| 356 | n_cbrust-analyzer cargo palette 0.7.6 cam16/math/DependentParameters#n_cb., |
| 357 | a_wrust-analyzer cargo palette 0.7.6 cam16/math/DependentParameters#a_w., |
| 358 | crust-analyzer cargo palette 0.7.6 cam16/math/DependentParameters#c., |
| 359 | zrust-analyzer cargo palette 0.7.6 cam16/math/DependentParameters#z., |
| 360 | f_l_4rust-analyzer cargo palette 0.7.6 cam16/math/DependentParameters#f_l_4., |
| 361 | adaptrust-analyzer cargo palette 0.7.6 cam16/math/DependentParameters#adapt., |
| 362 | unadaptrust-analyzer cargo palette 0.7.6 cam16/math/DependentParameters#unadapt., |
| 363 | } |
| 364 | } |
| 365 | |
| 366 | #[inline] |
| 367 | pub(superrust-analyzer cargo palette 0.7.6 cam16/) fn lightness_to_brightnessrust-analyzer cargo palette 0.7.6 cam16/math/lightness_to_brightness().<T>( |
| 368 | lightness: T, |
| 369 | param_c: T, |
| 370 | param_a_w: T, |
| 371 | param_f_l_4: T, |
| 372 | ) -> T |
| 373 | where |
| 374 | T: Realrust-analyzer cargo palette 0.7.6 num/Real# + Arithmeticsrust-analyzer cargo palette 0.7.6 num/Arithmetics# + Sqrtrust-analyzer cargo palette 0.7.6 num/Sqrt#, |
| 375 | { |
| 376 | let j_root = lightness_to_j_rootrust-analyzer cargo palette 0.7.6 cam16/math/lightness_to_j_root().(lightness); |
| 377 | calculate_brightnessrust-analyzer cargo palette 0.7.6 cam16/math/calculate_brightness().(j_root, param_c, param_a_w, param_f_l_4) |
| 378 | } |
| 379 | |
| 380 | #[inline] |
| 381 | pub(superrust-analyzer cargo palette 0.7.6 cam16/) fn brightness_to_lightnessrust-analyzer cargo palette 0.7.6 cam16/math/brightness_to_lightness().<T>( |
| 382 | brightness: T, |
| 383 | param_c: T, |
| 384 | param_a_w: T, |
| 385 | param_f_l_4: T, |
| 386 | ) -> T |
| 387 | where |
| 388 | T: Realrust-analyzer cargo palette 0.7.6 num/Real# + Arithmeticsrust-analyzer cargo palette 0.7.6 num/Arithmetics#, |
| 389 | { |
| 390 | let j_root = brightness_to_j_rootrust-analyzer cargo palette 0.7.6 cam16/math/brightness_to_j_root().(brightness, param_c, param_a_w, param_f_l_4); |
| 391 | calculate_lightnessrust-analyzer cargo palette 0.7.6 cam16/math/calculate_lightness().(j_root) |
| 392 | } |
| 393 | |
| 394 | #[inline] |
| 395 | pub(superrust-analyzer cargo palette 0.7.6 cam16/) fn chroma_to_colorfulnessrust-analyzer cargo palette 0.7.6 cam16/math/chroma_to_colorfulness().<T>(chroma: T, param_f_l_4: T) -> T |
| 396 | where |
| 397 | T: 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>, |
| 398 | { |
| 399 | param_f_l_4 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 |
| 400 | } |
| 401 | |
| 402 | #[inline] |
| 403 | pub(superrust-analyzer cargo palette 0.7.6 cam16/) fn chroma_to_saturationrust-analyzer cargo palette 0.7.6 cam16/math/chroma_to_saturation().<T>(chroma: T, lightness: T, param_c: T, param_a_w: T) -> T |
| 404 | where |
| 405 | T: Realrust-analyzer cargo palette 0.7.6 num/Real# + Arithmeticsrust-analyzer cargo palette 0.7.6 num/Arithmetics# + Sqrtrust-analyzer cargo palette 0.7.6 num/Sqrt# + Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#, |
| 406 | { |
| 407 | let j_root = lightness_to_j_rootrust-analyzer cargo palette 0.7.6 cam16/math/lightness_to_j_root().(lightness); |
| 408 | let alpha = chroma rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Div#div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Div#div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Div#div().&j_root; |
| 409 | |
| 410 | calculate_saturationrust-analyzer cargo palette 0.7.6 cam16/math/calculate_saturation().(param_c, param_a_w, alpha) |
| 411 | } |
| 412 | |
| 413 | #[inline] |
| 414 | pub(superrust-analyzer cargo palette 0.7.6 cam16/) fn colorfulness_to_chromarust-analyzer cargo palette 0.7.6 cam16/math/colorfulness_to_chroma().<T>(colorfulness: T, param_f_l_4: T) -> T |
| 415 | where |
| 416 | T: Divrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Div#<T, Outputrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Div#Output# = T>, |
| 417 | { |
| 418 | colorfulness rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Div#div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Div#div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Div#div().param_f_l_4 |
| 419 | } |
| 420 | |
| 421 | #[inline] |
| 422 | pub(superrust-analyzer cargo palette 0.7.6 cam16/) fn saturation_to_chromarust-analyzer cargo palette 0.7.6 cam16/math/saturation_to_chroma().<T>(saturation: T, lightness: T, param_c: T, param_a_w: T) -> T |
| 423 | where |
| 424 | T: Realrust-analyzer cargo palette 0.7.6 num/Real# + Arithmeticsrust-analyzer cargo palette 0.7.6 num/Arithmetics# + Sqrtrust-analyzer cargo palette 0.7.6 num/Sqrt#, |
| 425 | { |
| 426 | let j_root = lightness_to_j_rootrust-analyzer cargo palette 0.7.6 cam16/math/lightness_to_j_root().(lightness); |
| 427 | let alpha = saturation_to_alpharust-analyzer cargo palette 0.7.6 cam16/math/saturation_to_alpha().(saturation, param_c, param_a_w); |
| 428 | |
| 429 | calculate_chromarust-analyzer cargo palette 0.7.6 cam16/math/calculate_chroma().(j_root, alpha) |
| 430 | } |
| 431 | |
| 432 | #[inline] |
| 433 | fn lightness_to_j_rootrust-analyzer cargo palette 0.7.6 cam16/math/lightness_to_j_root().<T>(lightness: T) -> T |
| 434 | where |
| 435 | 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> + Sqrtrust-analyzer cargo palette 0.7.6 num/Sqrt#, |
| 436 | { |
| 437 | lightness.sqrtrust-analyzer cargo palette 0.7.6 num/Sqrt#sqrt().() 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().(0.1) |
| 438 | } |
| 439 | |
| 440 | #[inline] |
| 441 | fn brightness_to_j_rootrust-analyzer cargo palette 0.7.6 cam16/math/brightness_to_j_root().<T>(brightness: T, param_c: T, param_a_w: T, param_f_l_4: T) -> T |
| 442 | where |
| 443 | T: Realrust-analyzer cargo palette 0.7.6 num/Real# + Arithmeticsrust-analyzer cargo palette 0.7.6 num/Arithmetics#, |
| 444 | { |
| 445 | T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(0.25) 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().param_c 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().brightness rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Div#div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Div#div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Div#div().((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/Add#add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().param_a_w) 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().param_f_l_4) |
| 446 | } |
| 447 | |
| 448 | #[inline] |
| 449 | fn saturation_to_alpharust-analyzer cargo palette 0.7.6 cam16/math/saturation_to_alpha().<T>(saturation: T, param_c: T, param_a_w: T) -> T |
| 450 | where |
| 451 | T: Realrust-analyzer cargo palette 0.7.6 num/Real# + Arithmeticsrust-analyzer cargo palette 0.7.6 num/Arithmetics#, |
| 452 | { |
| 453 | T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(0.0004) 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().&saturation 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().saturation 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().(4.0) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().param_a_w) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Div#div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Div#div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Div#div().param_c |
| 454 | } |
| 455 | |
| 456 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy:)] |
| 457 | pub(craterust-analyzer cargo palette 0.7.6 crate/) struct DependentParametersrust-analyzer cargo palette 0.7.6 cam16/math/DependentParameters#<T> { |
| 458 | d_rgbrust-analyzer cargo palette 0.7.6 cam16/math/DependentParameters#d_rgb.: [T; 3], |
| 459 | d_rgb_invrust-analyzer cargo palette 0.7.6 cam16/math/DependentParameters#d_rgb_inv.: [T; 3], |
| 460 | nrust-analyzer cargo palette 0.7.6 cam16/math/DependentParameters#n.: T, |
| 461 | n_bbrust-analyzer cargo palette 0.7.6 cam16/math/DependentParameters#n_bb.: T, |
| 462 | n_crust-analyzer cargo palette 0.7.6 cam16/math/DependentParameters#n_c.: T, |
| 463 | n_cbrust-analyzer cargo palette 0.7.6 cam16/math/DependentParameters#n_cb.: T, |
| 464 | pub(superrust-analyzer cargo palette 0.7.6 cam16/) a_wrust-analyzer cargo palette 0.7.6 cam16/math/DependentParameters#a_w.: T, |
| 465 | pub(superrust-analyzer cargo palette 0.7.6 cam16/) crust-analyzer cargo palette 0.7.6 cam16/math/DependentParameters#c.: T, |
| 466 | zrust-analyzer cargo palette 0.7.6 cam16/math/DependentParameters#z.: T, |
| 467 | pub(superrust-analyzer cargo palette 0.7.6 cam16/) f_l_4rust-analyzer cargo palette 0.7.6 cam16/math/DependentParameters#f_l_4.: T, |
| 468 | adaptrust-analyzer cargo palette 0.7.6 cam16/math/DependentParameters#adapt.: Adaptrust-analyzer cargo palette 0.7.6 cam16/math/Adapt#<T>, |
| 469 | unadaptrust-analyzer cargo palette 0.7.6 cam16/math/DependentParameters#unadapt.: Unadaptrust-analyzer cargo palette 0.7.6 cam16/math/Unadapt#<T>, |
| 470 | } |
| 471 | |
| 472 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy:)] |
| 473 | struct Adaptrust-analyzer cargo palette 0.7.6 cam16/math/Adapt#<T> { |
| 474 | f_lrust-analyzer cargo palette 0.7.6 cam16/math/Adapt#f_l.: T, |
| 475 | } |
| 476 | |
| 477 | impl<T> Adaptrust-analyzer cargo palette 0.7.6 cam16/math/Adapt#<T> { |
| 478 | fn runrust-analyzer cargo palette 0.7.6 cam16/math/impl#[`Adapt<T>`]run().<V>(&self, component: V) -> V |
| 479 | where |
| 480 | V: Realrust-analyzer cargo palette 0.7.6 num/Real# + FromScalarrust-analyzer cargo palette 0.7.6 num/FromScalar#<Scalarrust-analyzer cargo palette 0.7.6 num/FromScalar#Scalar# = T> + Absrust-analyzer cargo palette 0.7.6 num/Abs# + Signumrust-analyzer cargo palette 0.7.6 num/Signum# + Powfrust-analyzer cargo palette 0.7.6 num/Powf# + Arithmeticsrust-analyzer cargo palette 0.7.6 num/Arithmetics# + Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#, |
| 481 | T: Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#, |
| 482 | { |
| 483 | let x = (V::from_scalarrust-analyzer cargo palette 0.7.6 num/FromScalar#from_scalar().(self.f_lrust-analyzer cargo palette 0.7.6 cam16/math/Adapt#f_l..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().component.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().().absrust-analyzer cargo palette 0.7.6 num/Abs#abs().() 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().V::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(0.01)) |
| 484 | .powfrust-analyzer cargo palette 0.7.6 num/Powf#powf().(V::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(0.42)); |
| 485 | component.signumrust-analyzer cargo palette 0.7.6 num/Signum#signum().() 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().V::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(400.0) 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().&x rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Div#div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Div#div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Div#div().(x rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().V::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(27.13)) |
| 486 | } |
| 487 | } |
| 488 | |
| 489 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy:)] |
| 490 | struct Unadaptrust-analyzer cargo palette 0.7.6 cam16/math/Unadapt#<T> { |
| 491 | constantrust-analyzer cargo palette 0.7.6 cam16/math/Unadapt#constant.: T, |
| 492 | exponentrust-analyzer cargo palette 0.7.6 cam16/math/Unadapt#exponent.: T, |
| 493 | } |
| 494 | |
| 495 | impl<T> Unadaptrust-analyzer cargo palette 0.7.6 cam16/math/Unadapt#<T> { |
| 496 | fn runrust-analyzer cargo palette 0.7.6 cam16/math/impl#[`Unadapt<T>`]run().<V>(&self, component: V) -> V |
| 497 | where |
| 498 | V: Realrust-analyzer cargo palette 0.7.6 num/Real# + FromScalarrust-analyzer cargo palette 0.7.6 num/FromScalar#<Scalarrust-analyzer cargo palette 0.7.6 num/FromScalar#Scalar# = T> + Absrust-analyzer cargo palette 0.7.6 num/Abs# + Signumrust-analyzer cargo palette 0.7.6 num/Signum# + Powfrust-analyzer cargo palette 0.7.6 num/Powf# + Arithmeticsrust-analyzer cargo palette 0.7.6 num/Arithmetics# + Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#, |
| 499 | T: Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#, |
| 500 | { |
| 501 | let c_abs = component.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().().absrust-analyzer cargo palette 0.7.6 num/Abs#abs().(); |
| 502 | component.signumrust-analyzer cargo palette 0.7.6 num/Signum#signum().() |
| 503 | *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().V::from_scalarrust-analyzer cargo palette 0.7.6 num/FromScalar#from_scalar().(self.constantrust-analyzer cargo palette 0.7.6 cam16/math/Unadapt#constant..clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().()) |
| 504 | *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().(c_abs.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/Div#div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Div#div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Div#div().(V::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(400.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().c_abs)) |
| 505 | .powfrust-analyzer cargo palette 0.7.6 num/Powf#powf().(V::from_scalarrust-analyzer cargo palette 0.7.6 num/FromScalar#from_scalar().(self.exponentrust-analyzer cargo palette 0.7.6 cam16/math/Unadapt#exponent..clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().())) |
| 506 | } |
| 507 | } |
| 508 | |
| 509 | fn lerprust-analyzer cargo palette 0.7.6 cam16/math/lerp().<T>(from: T, to: T, factor: T) -> T |
| 510 | where |
| 511 | T: Onerust-analyzer cargo palette 0.7.6 num/One# + Arithmeticsrust-analyzer cargo palette 0.7.6 num/Arithmetics#, |
| 512 | { |
| 513 | (T::onerust-analyzer cargo palette 0.7.6 num/One#one().() 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().&factor) 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().from rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().factor 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().to |
| 514 | } |
| 515 | |
| 516 | fn m16rust-analyzer cargo palette 0.7.6 cam16/math/m16().<T>(xyz: Xyzrust-analyzer cargo palette 0.7.6 xyz/Xyz#<white_pointrust-analyzer cargo palette 0.7.6 white_point/::Anyrust-analyzer cargo palette 0.7.6 white_point/Any#, T>) -> [T; 3] |
| 517 | where |
| 518 | T: Realrust-analyzer cargo palette 0.7.6 num/Real# + Arithmeticsrust-analyzer cargo palette 0.7.6 num/Arithmetics#, |
| 519 | { |
| 520 | 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., .. } = xyz; |
| 521 | |
| 522 | #[rustfmt::skip] |
| 523 | let rgb = [ |
| 524 | T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().( 0.401288) 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().&x rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(0.650173) 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().&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().T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(0.051461) 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().&z, |
| 525 | 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().0.250268) 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().&x rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(1.204414) 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().&y rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(0.045854) 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().&z, |
| 526 | 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().0.002079) 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().x rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(0.048952) 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().y rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(0.953127) 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().z, |
| 527 | ]; |
| 528 | |
| 529 | rgb |
| 530 | } |
| 531 | |
| 532 | fn m16_invrust-analyzer cargo palette 0.7.6 cam16/math/m16_inv().<T>(rgb: [T; 3]) -> Xyzrust-analyzer cargo palette 0.7.6 xyz/Xyz#<white_pointrust-analyzer cargo palette 0.7.6 white_point/::Anyrust-analyzer cargo palette 0.7.6 white_point/Any#, T> |
| 533 | where |
| 534 | T: Realrust-analyzer cargo palette 0.7.6 num/Real# + Arithmeticsrust-analyzer cargo palette 0.7.6 num/Arithmetics#, |
| 535 | { |
| 536 | let [r, g, b] = rgb; |
| 537 | |
| 538 | #[rustfmt::skip] |
| 539 | #[allow(clippy::excessive_precision)] // Clippy didn't like the e+0 |
| 540 | let xyz = Xyzrust-analyzer cargo palette 0.7.6 xyz/Xyz# { |
| 541 | xrust-analyzer cargo palette 0.7.6 xyz/Xyz#x.: T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().( 1.862067855087233e+0) 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().&r 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().(1.011254630531685e+0) 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().&g rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(1.491867754444518e-1) 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().&b, |
| 542 | yrust-analyzer cargo palette 0.7.6 xyz/Xyz#y.: T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().( 3.875265432361372e-1) 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().&r rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(6.214474419314753e-1) 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().&g 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().(8.973985167612518e-3) 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().&b, |
| 543 | zrust-analyzer cargo palette 0.7.6 xyz/Xyz#z.: 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().1.584149884933386e-2) 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().r 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().(3.412293802851557e-2) 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().g rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#add().T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(1.049964436877850e+0) 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().b, |
| 544 | white_pointrust-analyzer cargo palette 0.7.6 xyz/Xyz#white_point.: PhantomDatarust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/PhantomData# |
| 545 | }; |
| 546 | |
| 547 | xyz |
| 548 | } |
| 549 | |
| 550 | fn map3rust-analyzer cargo palette 0.7.6 cam16/math/map3().<T, U>(array: [T; 3], mut map: impl FnMutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/function/FnMut#(T) -> U) -> [U; 3] { |
| 551 | let [a1, a2, a3] = array; |
| 552 | [map(a1), map(a2), map(a3)] |
| 553 | } |
| 554 | |
| 555 | fn mul3rust-analyzer cargo palette 0.7.6 cam16/math/mul3().<T>(lhs: [T; 3], rhs: [T; 3]) -> [T; 3] |
| 556 | where |
| 557 | T: 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>, |
| 558 | { |
| 559 | let [l1, l2, l3] = lhs; |
| 560 | let [r1, r2, r3] = rhs; |
| 561 | |
| 562 | [l1 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().r1, l2 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().r2, l3 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().r3] |
| 563 | } |