Debian Codegraph @

src/cam16/ucs_jmh.rs

raw symbols SCIP
1 use craterust-analyzer cargo palette 0.7.6 crate/::{
2 anglerust-analyzer cargo palette 0.7.6 angle/::RealAnglerust-analyzer cargo palette 0.7.6 angle/RealAngle#,
3 bool_maskrust-analyzer cargo palette 0.7.6 bool_mask/::HasBoolMaskrust-analyzer cargo palette 0.7.6 bool_mask/HasBoolMask#,
4 color_differencerust-analyzer cargo palette 0.7.6 color_difference/::{DeltaErust-analyzer cargo palette 0.7.6 color_difference/DeltaE#, ImprovedDeltaErust-analyzer cargo palette 0.7.6 color_difference/ImprovedDeltaE#},
5 convertrust-analyzer cargo palette 0.7.6 convert/::{FromColorUnclampedrust-analyzer cargo palette 0.7.6 convert/from_into_color_unclamped/FromColorUnclamped#, IntoColorUnclampedrust-analyzer cargo palette 0.7.6 convert/from_into_color_unclamped/IntoColorUnclamped#},
6 huesrust-analyzer cargo palette 0.7.6 hues/::{Cam16Huerust-analyzer cargo palette 0.7.6 hues/Cam16Hue#, Cam16HueIterrust-analyzer cargo palette 0.7.6 hues/Cam16HueIter#},
7 numrust-analyzer cargo palette 0.7.6 num/::{Arithmeticsrust-analyzer cargo palette 0.7.6 num/Arithmetics#, Hypotrust-analyzer cargo palette 0.7.6 num/Hypot#, Lnrust-analyzer cargo palette 0.7.6 num/Ln#, Onerust-analyzer cargo palette 0.7.6 num/One#, Realrust-analyzer cargo palette 0.7.6 num/Real#, Trigonometryrust-analyzer cargo palette 0.7.6 num/Trigonometry#, Zerorust-analyzer cargo palette 0.7.6 num/Zero#},
8 Alpharust-analyzer cargo palette 0.7.6 alpha/alpha/Alpha#,
9 };
10
11 use superrust-analyzer cargo palette 0.7.6 cam16/::{Cam16Jmhrust-analyzer cargo palette 0.7.6 cam16/partial/cam16_jmh/Cam16Jmh#, Cam16UcsJabrust-analyzer cargo palette 0.7.6 cam16/ucs_jab/Cam16UcsJab#};
12
13 /// Polar CAM16-UCS with an alpha component.
14 ///
15 /// See the [`Cam16UcsJmha` implementation in
16 /// `Alpha`](crate::Alpha#Cam16UcsJmha).
17 pub type Cam16UcsJmharust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/Cam16UcsJmha#<T> = Alpharust-analyzer cargo palette 0.7.6 alpha/alpha/Alpha#<Cam16UcsJmhrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/Cam16UcsJmh#<T>, T>;
18
19 /// The polar form of CAM16-UCS, or J'M'h'.
20 ///
21 /// CAM16-UCS is a perceptually uniform color space, based on CAM16 lightness
22 /// and colorfulness. Its cartesian counterpart is [`Cam16UcsJab`].
23 ///
24 /// # Creating a Value
25 ///
26 /// ```
27 /// use palette::{
28 /// Srgb, FromColor, IntoColor, hues::Cam16Hue,
29 /// cam16::{Cam16, Parameters, Cam16UcsJmh},
30 /// };
31 ///
32 /// let ucs = Cam16UcsJmh::new(50.0f32, 80.0, 120.0);
33 ///
34 /// // There's also `new_const`:
35 /// const UCS: Cam16UcsJmh<f32> = Cam16UcsJmh::new_const(50.0, 80.0, Cam16Hue::new(120.0));
36 ///
37 /// // Customize these according to the viewing conditions:
38 /// let mut example_parameters = Parameters::default_static_wp(40.0);
39 ///
40 /// // CAM16-UCS from sRGB, or most other color spaces:
41 /// let rgb = Srgb::new(0.3f32, 0.8, 0.1);
42 /// let cam16 = Cam16::from_xyz(rgb.into_color(), example_parameters);
43 /// let ucs_from_rgb = Cam16UcsJmh::from_color(cam16);
44 ///
45 /// // It's also possible to convert from (and to) arrays and tuples:
46 /// let ucs_from_array = Cam16UcsJmh::from([50.0f32, 80.0, 120.0]);
47 /// let ucs_from_tuple = Cam16UcsJmh::from((50.0f32, 80.0, 120.0));
48 /// ```
49 #[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:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default:, WithAlpharust-analyzer cargo palette_derive 0.7.6 WithAlpha:, ArrayCastrust-analyzer cargo palette_derive 0.7.6 ArrayCast:, FromColorUnclampedrust-analyzer cargo palette_derive 0.7.6 FromColorUnclamped:)]
50 #[cfg_attr(feature = "serializing", derive(Serializerust-analyzer cargo serde_derive 1.0.229 Serialize:, Deserializerust-analyzer cargo serde_derive 1.0.229 Deserialize:))]
51 #[palette(
52 palette_internal,
53 component = "T",
54 skip_derives(Cam16Jmh, Cam16UcsJmh, Cam16UcsJab)
55 )]
56 #[repr(C)]
57 pub struct Cam16UcsJmhrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/Cam16UcsJmh#<T> {
58 /// The lightness (J') of the color.
59 ///
60 /// It's derived from [`Cam16::lightness`][crate::cam16::Cam16::lightness]
61 /// and ranges from `0.0` to `100.0`.
62 pub lightnessrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/Cam16UcsJmh#lightness.: T,
63
64 /// The colorfulness (M') of the color.
65 ///
66 /// It's derived from [`Cam16::colorfulness`][crate::cam16::Cam16::colorfulness].
67 pub colorfulnessrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/Cam16UcsJmh#colorfulness.: T,
68
69 /// The hue (h') of the color.
70 ///
71 /// It's the same as [`Cam16::hue`][crate::cam16::Cam16::hue], despite the
72 /// h' notation.
73 #[paletterust-analyzer cargo palette_derive 0.7.6 palette:(unsafe_same_layout_as = "T")]
74 pub huerust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/Cam16UcsJmh#hue.: Cam16Huerust-analyzer cargo palette 0.7.6 hues/Cam16Hue#<T>,
75 }
76
77 impl<T> Cam16UcsJmhrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/Cam16UcsJmh#<T> {
78 /// Create a CAM16-UCS J' M' h' color.
79 pub fn newrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/impl#[`Cam16UcsJmh<T>`]new().<H: Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#<Cam16Huerust-analyzer cargo palette 0.7.6 hues/Cam16Hue#<T>>>(lightness: T, colorfulness: T, hue: H) -> Selfrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/impl#[`Cam16UcsJmh<T>`] {
80 Selfrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/impl#[`Cam16UcsJmh<T>`]::new_construst-analyzer cargo palette 0.7.6 cam16/ucs_jmh/impl#[`Cam16UcsJmh<T>`]new_const().(lightness, colorfulness, hue.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#into().())
81 }
82
83 /// Create a CAM16-UCS J' M' h' color. This is the same as
84 /// `Cam16UcsJmh::new` without the generic hue type. It's temporary until
85 /// `const fn` supports traits.
86 pub const fn new_construst-analyzer cargo palette 0.7.6 cam16/ucs_jmh/impl#[`Cam16UcsJmh<T>`]new_const().(lightness: T, colorfulness: T, hue: Cam16Huerust-analyzer cargo palette 0.7.6 hues/Cam16Hue#<T>) -> Selfrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/impl#[`Cam16UcsJmh<T>`] {
87 Selfrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/impl#[`Cam16UcsJmh<T>`] {
88 lightnessrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/Cam16UcsJmh#lightness.,
89 colorfulnessrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/Cam16UcsJmh#colorfulness.,
90 huerust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/Cam16UcsJmh#hue.,
91 }
92 }
93
94 /// Convert to a `(J', M', h')` tuple.
95 pub fn into_componentsrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/impl#[`Cam16UcsJmh<T>`]into_components().(self) -> (T, T, Cam16Huerust-analyzer cargo palette 0.7.6 hues/Cam16Hue#<T>) {
96 (self.lightnessrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/Cam16UcsJmh#lightness., self.colorfulnessrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/Cam16UcsJmh#colorfulness., self.huerust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/Cam16UcsJmh#hue.)
97 }
98
99 /// Convert from a `(J', M', h')` tuple.
100 pub fn from_componentsrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/impl#[`Cam16UcsJmh<T>`]from_components().<H: Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#<Cam16Huerust-analyzer cargo palette 0.7.6 hues/Cam16Hue#<T>>>(
101 (lightness, colorfulness, hue): (T, T, H),
102 ) -> Selfrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/impl#[`Cam16UcsJmh<T>`] {
103 Selfrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/impl#[`Cam16UcsJmh<T>`]::newrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/impl#[`Cam16UcsJmh<T>`]new().(lightness, colorfulness, hue)
104 }
105 }
106
107 impl<T> Cam16UcsJmhrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/Cam16UcsJmh#<T>
108 where
109 T: Zerorust-analyzer cargo palette 0.7.6 num/Zero# + Realrust-analyzer cargo palette 0.7.6 num/Real#,
110 {
111 /// Return the `lightness` value minimum.
112 pub fn min_lightnessrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/impl#[`Cam16UcsJmh<T>`]min_lightness().() -> T {
113 T::zerorust-analyzer cargo palette 0.7.6 num/Zero#zero().()
114 }
115
116 /// Return the `lightness` value maximum.
117 pub fn max_lightnessrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/impl#[`Cam16UcsJmh<T>`]max_lightness().() -> T {
118 T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(100.0)
119 }
120
121 /// Return the `colorfulness` value minimum.
122 pub fn min_colorfulnessrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/impl#[`Cam16UcsJmh<T>`]min_colorfulness().() -> T {
123 T::zerorust-analyzer cargo palette 0.7.6 num/Zero#zero().()
124 }
125
126 /// Return a `colorfulness` value maximum that includes the sRGB gamut.
127 ///
128 /// <p class="warning">
129 /// This is entirely arbitrary and only for use in `Lighten`, `Darken` and
130 /// random generation. Colorfulness doesn't have a well defined upper
131 /// bound.
132 /// </p>
133 pub fn max_srgb_colorfulnessrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/impl#[`Cam16UcsJmh<T>`]max_srgb_colorfulness().() -> T {
134 // Based on a plot from https://facelessuser.github.io/coloraide/colors/cam16_ucs/
135 T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(50.0)
136 }
137 }
138
139 ///<span id="Cam16UcsJmha"></span>[`Cam16UcsJmha`](crate::cam16::Cam16UcsJmha) implementations.
140 impl<T, A> Alpharust-analyzer cargo palette 0.7.6 alpha/alpha/Alpha#<Cam16UcsJmhrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/Cam16UcsJmh#<T>, A> {
141 /// Create a CAM16-UCS J' M' h' color with transparency.
142 pub fn newrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/impl#[`Alpha<Cam16UcsJmh<T>, A>`]new().<H: Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#<Cam16Huerust-analyzer cargo palette 0.7.6 hues/Cam16Hue#<T>>>(lightness: T, colorfulness: T, hue: H, alpha: A) -> Selfrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/impl#[`Alpha<Cam16UcsJmh<T>, A>`] {
143 Selfrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/impl#[`Alpha<Cam16UcsJmh<T>, A>`]::new_construst-analyzer cargo palette 0.7.6 cam16/ucs_jmh/impl#[`Alpha<Cam16UcsJmh<T>, A>`]new_const().(lightness, colorfulness, hue.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#into().(), alpha)
144 }
145
146 /// Create a CAM16-UCS J' M' h' color with transparency. This is the same as
147 /// `Cam16UcsJmha::new` without the generic hue type. It's temporary until
148 /// `const fn` supports traits.
149 pub const fn new_construst-analyzer cargo palette 0.7.6 cam16/ucs_jmh/impl#[`Alpha<Cam16UcsJmh<T>, A>`]new_const().(lightness: T, colorfulness: T, hue: Cam16Huerust-analyzer cargo palette 0.7.6 hues/Cam16Hue#<T>, alpha: A) -> Selfrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/impl#[`Alpha<Cam16UcsJmh<T>, A>`] {
150 Selfrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/impl#[`Alpha<Cam16UcsJmh<T>, A>`] {
151 colorrust-analyzer cargo palette 0.7.6 alpha/alpha/Alpha#color.: Cam16UcsJmhrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/Cam16UcsJmh#::new_construst-analyzer cargo palette 0.7.6 cam16/ucs_jmh/impl#[`Cam16UcsJmh<T>`]new_const().(lightness, colorfulness, hue),
152 alpharust-analyzer cargo palette 0.7.6 alpha/alpha/Alpha#alpha.,
153 }
154 }
155
156 /// Convert to a `(J', M', h', a)` tuple.
157 pub fn into_componentsrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/impl#[`Alpha<Cam16UcsJmh<T>, A>`]into_components().(self) -> (T, T, Cam16Huerust-analyzer cargo palette 0.7.6 hues/Cam16Hue#<T>, A) {
158 (
159 self.colorrust-analyzer cargo palette 0.7.6 alpha/alpha/Alpha#color..lightnessrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/Cam16UcsJmh#lightness.,
160 self.colorrust-analyzer cargo palette 0.7.6 alpha/alpha/Alpha#color..colorfulnessrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/Cam16UcsJmh#colorfulness.,
161 self.colorrust-analyzer cargo palette 0.7.6 alpha/alpha/Alpha#color..huerust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/Cam16UcsJmh#hue.,
162 self.alpharust-analyzer cargo palette 0.7.6 alpha/alpha/Alpha#alpha.,
163 )
164 }
165
166 /// Convert from a `(J', M', h', a)` tuple.
167 pub fn from_componentsrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/impl#[`Alpha<Cam16UcsJmh<T>, A>`]from_components().<H: Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#<Cam16Huerust-analyzer cargo palette 0.7.6 hues/Cam16Hue#<T>>>(
168 (lightness, colorfulness, hue, alpha): (T, T, H, A),
169 ) -> Selfrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/impl#[`Alpha<Cam16UcsJmh<T>, A>`] {
170 Selfrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/impl#[`Alpha<Cam16UcsJmh<T>, A>`]::newrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/impl#[`Alpha<Cam16UcsJmh<T>, A>`]new().(lightness, colorfulness, hue, alpha)
171 }
172 }
173
174 impl<T> FromColorUnclampedrust-analyzer cargo palette 0.7.6 convert/from_into_color_unclamped/FromColorUnclamped#<Cam16UcsJmhrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/Cam16UcsJmh#<T>> for Cam16UcsJmhrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/Cam16UcsJmh#<T> {
175 fn from_color_unclampedrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/impl#[`Cam16UcsJmh<T>`][`FromColorUnclamped<Self>`]from_color_unclamped().(val: Cam16UcsJmhrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/Cam16UcsJmh#<T>) -> Selfrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/impl#[`Cam16UcsJmh<T>`][`FromColorUnclamped<Self>`] {
176 val
177 }
178 }
179
180 impl<T> FromColorUnclampedrust-analyzer cargo palette 0.7.6 convert/from_into_color_unclamped/FromColorUnclamped#<Cam16Jmhrust-analyzer cargo palette 0.7.6 cam16/partial/cam16_jmh/Cam16Jmh#<T>> for Cam16UcsJmhrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/Cam16UcsJmh#<T>
181 where
182 T: Realrust-analyzer cargo palette 0.7.6 num/Real# + Onerust-analyzer cargo palette 0.7.6 num/One# + Lnrust-analyzer cargo palette 0.7.6 num/Ln# + Arithmeticsrust-analyzer cargo palette 0.7.6 num/Arithmetics#,
183 {
184 fn from_color_unclampedrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/impl#[`Cam16UcsJmh<T>`][`FromColorUnclamped<Cam16Jmh<T>>`]from_color_unclamped().(val: Cam16Jmhrust-analyzer cargo palette 0.7.6 cam16/partial/cam16_jmh/Cam16Jmh#<T>) -> Selfrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/impl#[`Cam16UcsJmh<T>`][`FromColorUnclamped<Cam16Jmh<T>>`] {
185 let colorfulness =
186 (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/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.0228) 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().val.colorfulnessrust-analyzer cargo palette 0.7.6 cam16/partial/cam16_jmh/Cam16Jmh#colorfulness.).lnrust-analyzer cargo palette 0.7.6 num/Ln#ln().() 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.0228);
187 let lightness =
188 T::from_f64rust-analyzer cargo palette 0.7.6 num/Real#from_f64().(1.7) 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().&val.lightnessrust-analyzer cargo palette 0.7.6 cam16/partial/cam16_jmh/Cam16Jmh#lightness. 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::onerust-analyzer cargo palette 0.7.6 num/One#one().() 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.007) 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().val.lightnessrust-analyzer cargo palette 0.7.6 cam16/partial/cam16_jmh/Cam16Jmh#lightness.);
189
190 Cam16UcsJmhrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/Cam16UcsJmh# {
191 lightnessrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/Cam16UcsJmh#lightness.,
192 colorfulnessrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/Cam16UcsJmh#colorfulness.,
193 huerust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/Cam16UcsJmh#hue.: val.huerust-analyzer cargo palette 0.7.6 cam16/partial/cam16_jmh/Cam16Jmh#hue.,
194 }
195 }
196 }
197
198 impl<T> FromColorUnclampedrust-analyzer cargo palette 0.7.6 convert/from_into_color_unclamped/FromColorUnclamped#<Cam16UcsJabrust-analyzer cargo palette 0.7.6 cam16/ucs_jab/Cam16UcsJab#<T>> for Cam16UcsJmhrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/Cam16UcsJmh#<T>
199 where
200 T: RealAnglerust-analyzer cargo palette 0.7.6 angle/RealAngle# + Hypotrust-analyzer cargo palette 0.7.6 num/Hypot# + Trigonometryrust-analyzer cargo palette 0.7.6 num/Trigonometry# + Arithmeticsrust-analyzer cargo palette 0.7.6 num/Arithmetics# + Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#,
201 {
202 fn from_color_unclampedrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/impl#[`Cam16UcsJmh<T>`][`FromColorUnclamped<Cam16UcsJab<T>>`]from_color_unclamped().(val: Cam16UcsJabrust-analyzer cargo palette 0.7.6 cam16/ucs_jab/Cam16UcsJab#<T>) -> Selfrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/impl#[`Cam16UcsJmh<T>`][`FromColorUnclamped<Cam16UcsJab<T>>`] {
203 Selfrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/impl#[`Cam16UcsJmh<T>`][`FromColorUnclamped<Cam16UcsJab<T>>`] {
204 lightnessrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/Cam16UcsJmh#lightness.: val.lightnessrust-analyzer cargo palette 0.7.6 cam16/ucs_jab/Cam16UcsJab#lightness.,
205 colorfulnessrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/Cam16UcsJmh#colorfulness.: val.arust-analyzer cargo palette 0.7.6 cam16/ucs_jab/Cam16UcsJab#a..clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().().hypotrust-analyzer cargo palette 0.7.6 num/Hypot#hypot().(val.brust-analyzer cargo palette 0.7.6 cam16/ucs_jab/Cam16UcsJab#b..clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().()),
206 huerust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/Cam16UcsJmh#hue.: Cam16Huerust-analyzer cargo palette 0.7.6 hues/Cam16Hue#::from_cartesianrust-analyzer cargo palette 0.7.6 hues/impl#[`Cam16Hue<T>`]from_cartesian().(val.arust-analyzer cargo palette 0.7.6 cam16/ucs_jab/Cam16UcsJab#a., val.brust-analyzer cargo palette 0.7.6 cam16/ucs_jab/Cam16UcsJab#b.),
207 }
208 }
209 }
210
211 impl<T> DeltaErust-analyzer cargo palette 0.7.6 color_difference/DeltaE# for Cam16UcsJmhrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/Cam16UcsJmh#<T>
212 where
213 Cam16UcsJabrust-analyzer cargo palette 0.7.6 cam16/ucs_jab/Cam16UcsJab#<T>: DeltaErust-analyzer cargo palette 0.7.6 color_difference/DeltaE#<Scalarrust-analyzer cargo palette 0.7.6 color_difference/DeltaE#Scalar# = T> + FromColorUnclampedrust-analyzer cargo palette 0.7.6 convert/from_into_color_unclamped/FromColorUnclamped#<Selfrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/impl#[`Cam16UcsJmh<T>`][DeltaE]>,
214 {
215 type Scalarrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/impl#[`Cam16UcsJmh<T>`][DeltaE]Scalar# = T;
216
217 #[inline]
218 fn delta_erust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/impl#[`Cam16UcsJmh<T>`][DeltaE]delta_e().(self, other: Selfrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/impl#[`Cam16UcsJmh<T>`][DeltaE]) -> Selfrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/impl#[`Cam16UcsJmh<T>`][DeltaE]::Scalarrust-analyzer cargo palette 0.7.6 color_difference/DeltaE#Scalar# {
219 // Jab and Jmh have the same delta E.
220 Cam16UcsJabrust-analyzer cargo palette 0.7.6 cam16/ucs_jab/Cam16UcsJab#::from_color_unclampedrust-analyzer cargo palette 0.7.6 convert/from_into_color_unclamped/FromColorUnclamped#from_color_unclamped().(self).delta_erust-analyzer cargo palette 0.7.6 color_difference/DeltaE#delta_e().(other.into_color_unclampedrust-analyzer cargo palette 0.7.6 convert/from_into_color_unclamped/impl#[T][`IntoColorUnclamped<U>`]into_color_unclamped().())
221 }
222 }
223
224 impl<T> ImprovedDeltaErust-analyzer cargo palette 0.7.6 color_difference/ImprovedDeltaE# for Cam16UcsJmhrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/Cam16UcsJmh#<T>
225 where
226 Cam16UcsJabrust-analyzer cargo palette 0.7.6 cam16/ucs_jab/Cam16UcsJab#<T>: ImprovedDeltaErust-analyzer cargo palette 0.7.6 color_difference/ImprovedDeltaE#<Scalarrust-analyzer cargo palette 0.7.6 color_difference/DeltaE#Scalar# = T> + FromColorUnclampedrust-analyzer cargo palette 0.7.6 convert/from_into_color_unclamped/FromColorUnclamped#<Selfrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/impl#[`Cam16UcsJmh<T>`][ImprovedDeltaE]>,
227 {
228 #[inline]
229 fn improved_delta_erust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/impl#[`Cam16UcsJmh<T>`][ImprovedDeltaE]improved_delta_e().(self, other: Selfrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/impl#[`Cam16UcsJmh<T>`][ImprovedDeltaE]) -> Selfrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/impl#[`Cam16UcsJmh<T>`][ImprovedDeltaE]::Scalarrust-analyzer cargo palette 0.7.6 color_difference/DeltaE#Scalar# {
230 // Jab and Jmh have the same delta E.
231 Cam16UcsJabrust-analyzer cargo palette 0.7.6 cam16/ucs_jab/Cam16UcsJab#::from_color_unclampedrust-analyzer cargo palette 0.7.6 convert/from_into_color_unclamped/FromColorUnclamped#from_color_unclamped().(self).improved_delta_erust-analyzer cargo palette 0.7.6 color_difference/ImprovedDeltaE#improved_delta_e().(other.into_color_unclampedrust-analyzer cargo palette 0.7.6 convert/from_into_color_unclamped/impl#[T][`IntoColorUnclamped<U>`]into_color_unclamped().())
232 }
233 }
234
235 impl<T> HasBoolMaskrust-analyzer cargo palette 0.7.6 bool_mask/HasBoolMask# for Cam16UcsJmhrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/Cam16UcsJmh#<T>
236 where
237 T: HasBoolMaskrust-analyzer cargo palette 0.7.6 bool_mask/HasBoolMask#,
238 {
239 type Maskrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/impl#[`Cam16UcsJmh<T>`][HasBoolMask]Mask# = T::Maskrust-analyzer cargo palette 0.7.6 bool_mask/HasBoolMask#Mask#;
240 }
241
242 #[cfg(feature = "bytemuck")]
243 unsafe impl<T> bytemuckrust-analyzer cargo bytemuck 1.25.2 crate/::Zeroablerust-analyzer cargo bytemuck 1.25.2 zeroable/Zeroable# for Cam16UcsJmhrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/Cam16UcsJmh#<T> where T: bytemuckrust-analyzer cargo bytemuck 1.25.2 crate/::Zeroablerust-analyzer cargo bytemuck 1.25.2 zeroable/Zeroable# {}
244
245 #[cfg(feature = "bytemuck")]
246 unsafe impl<T> bytemuckrust-analyzer cargo bytemuck 1.25.2 crate/::Podrust-analyzer cargo bytemuck 1.25.2 pod/Pod# for Cam16UcsJmhrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/Cam16UcsJmh#<T> where T: bytemuckrust-analyzer cargo bytemuck 1.25.2 crate/::Podrust-analyzer cargo bytemuck 1.25.2 pod/Pod# {}
247
248 // Macro implementations
249
250 impl_reference_component_methods_huerust-analyzer cargo palette 0.7.6 macros/reference_component/impl_reference_component_methods_hue!!(Cam16UcsJmhrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/Cam16UcsJmh#, [lightnessrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/Cam16UcsJmh#lightness., colorfulnessrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/Cam16UcsJmh#colorfulness.]);
251 impl_struct_of_arrays_methods_huerust-analyzer cargo palette 0.7.6 macros/struct_of_arrays/impl_struct_of_arrays_methods_hue!!(Cam16UcsJmhrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/Cam16UcsJmh#, [lightness, colorfulness]);
252 impl_tuple_conversion_huerust-analyzer cargo palette 0.7.6 macros/convert/impl_tuple_conversion_hue!!(Cam16UcsJmhrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/Cam16UcsJmh# as (T, T, H), Cam16Huerust-analyzer cargo palette 0.7.6 hues/Cam16Hue#);
253
254 impl_is_within_boundsrust-analyzer cargo palette 0.7.6 macros/clamp/impl_is_within_bounds!! {
255 Cam16UcsJmhrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/Cam16UcsJmh# {
256 lightnessrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/Cam16UcsJmh#lightness. => [Selfrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/impl#[`Cam16UcsJmh<T>`][IsWithinBounds]::min_lightnessrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/impl#[`Cam16UcsJmh<T>`]min_lightness().(), Selfrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/impl#[`Cam16UcsJmh<T>`][IsWithinBounds]::max_lightnessrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/impl#[`Cam16UcsJmh<T>`]max_lightness().()],
257 colorfulnessrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/Cam16UcsJmh#colorfulness. => [Selfrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/impl#[`Cam16UcsJmh<T>`][IsWithinBounds]::min_colorfulnessrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/impl#[`Cam16UcsJmh<T>`]min_colorfulness().(), Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#]
258 }
259 where T: Zerorust-analyzer cargo palette 0.7.6 num/Zero# + Realrust-analyzer cargo palette 0.7.6 num/Real#
260 }
261 impl_clamprust-analyzer cargo palette 0.7.6 macros/clamp/impl_clamp!! {
262 Cam16UcsJmhrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/Cam16UcsJmh# {
263 lightnessrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/Cam16UcsJmh#lightness. => [Selfrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/impl#[`Cam16UcsJmh<T>`][ClampAssign]::min_lightnessrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/impl#[`Cam16UcsJmh<T>`]min_lightness().(), Selfrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/impl#[`Cam16UcsJmh<T>`][ClampAssign]::max_lightnessrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/impl#[`Cam16UcsJmh<T>`]max_lightness().()],
264 colorfulnessrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/Cam16UcsJmh#colorfulness. => [Selfrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/impl#[`Cam16UcsJmh<T>`][ClampAssign]::min_colorfulnessrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/impl#[`Cam16UcsJmh<T>`]min_colorfulness().()]
265 }
266 other {huerust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/Cam16UcsJmh#hue.}
267 where T: Zerorust-analyzer cargo palette 0.7.6 num/Zero# + Realrust-analyzer cargo palette 0.7.6 num/Real#
268 }
269
270 impl_mix_huerust-analyzer cargo palette 0.7.6 macros/mix/impl_mix_hue!!(Cam16UcsJmhrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/Cam16UcsJmh# {
271 lightness,
272 colorfulness
273 });
274 impl_lightenrust-analyzer cargo palette 0.7.6 macros/lighten_saturate/impl_lighten!!(Cam16UcsJmhrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/Cam16UcsJmh# increase {lightness => [Selfrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/impl#[`Cam16UcsJmh<T>`][Lighten]::min_lightnessrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/impl#[`Cam16UcsJmh<T>`]min_lightness().(), Selfrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/impl#[`Cam16UcsJmh<T>`][Lighten]::max_lightnessrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/impl#[`Cam16UcsJmh<T>`]max_lightness().()]} other {huerust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/Cam16UcsJmh#hue., colorfulnessrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/Cam16UcsJmh#colorfulness.});
275 impl_saturaterust-analyzer cargo palette 0.7.6 macros/lighten_saturate/impl_saturate!!(Cam16UcsJmhrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/Cam16UcsJmh# increase {colorfulness => [Selfrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/impl#[`Cam16UcsJmh<T>`][Saturate]::min_colorfulnessrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/impl#[`Cam16UcsJmh<T>`]min_colorfulness().(), Selfrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/impl#[`Cam16UcsJmh<T>`][Saturate]::max_srgb_colorfulnessrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/impl#[`Cam16UcsJmh<T>`]max_srgb_colorfulness().()]} other {huerust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/Cam16UcsJmh#hue., lightnessrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/Cam16UcsJmh#lightness.});
276 impl_hue_opsrust-analyzer cargo palette 0.7.6 macros/hue/impl_hue_ops!!(Cam16UcsJmhrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/Cam16UcsJmh#, Cam16Huerust-analyzer cargo palette 0.7.6 hues/Cam16Hue#);
277
278 impl_color_addrust-analyzer cargo palette 0.7.6 macros/arithmetics/impl_color_add!!(Cam16UcsJmhrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/Cam16UcsJmh#, [lightnessrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/Cam16UcsJmh#lightness., colorfulnessrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/Cam16UcsJmh#colorfulness., huerust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/Cam16UcsJmh#hue.]);
279 impl_color_subrust-analyzer cargo palette 0.7.6 macros/arithmetics/impl_color_sub!!(Cam16UcsJmhrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/Cam16UcsJmh#, [lightnessrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/Cam16UcsJmh#lightness., colorfulnessrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/Cam16UcsJmh#colorfulness., huerust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/Cam16UcsJmh#hue.]);
280
281 impl_array_castsrust-analyzer cargo palette 0.7.6 macros/casting/impl_array_casts!!(Cam16UcsJmhrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/Cam16UcsJmh#<T>, [T; 3]);
282 impl_simd_array_conversion_huerust-analyzer cargo palette 0.7.6 macros/simd/impl_simd_array_conversion_hue!!(Cam16UcsJmhrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/Cam16UcsJmh#, [lightness, colorfulness]);
283 impl_struct_of_array_traits_huerust-analyzer cargo palette 0.7.6 macros/struct_of_arrays/impl_struct_of_array_traits_hue!!(Cam16UcsJmhrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/Cam16UcsJmh#, Cam16HueIterrust-analyzer cargo palette 0.7.6 hues/Cam16HueIter#, [lightnessrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/Cam16UcsJmh#lightness., colorfulnessrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/Cam16UcsJmh#colorfulness.]);
284
285 impl_eq_huerust-analyzer cargo palette 0.7.6 macros/equality/impl_eq_hue!!(Cam16UcsJmhrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/Cam16UcsJmh#, Cam16Huerust-analyzer cargo palette 0.7.6 hues/Cam16Hue#, [lightnessrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/Cam16UcsJmh#lightness., colorfulnessrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/Cam16UcsJmh#colorfulness., huerust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/Cam16UcsJmh#hue.]);
286
287 impl_rand_traits_cylinderrust-analyzer cargo palette 0.7.6 macros/random/impl_rand_traits_cylinder!!(
288 UniformCam16UcsJmhrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/UniformCam16UcsJmh#,
289 Cam16UcsJmhrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/Cam16UcsJmh# {
290 hue: UniformCam16Huerust-analyzer cargo palette 0.7.6 hues/UniformCam16Hue# => Cam16Huerust-analyzer cargo palette 0.7.6 hues/Cam16Hue#,
291 height: lightnessrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/Cam16UcsJmh#lightness. => [|l: T| l *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). Cam16UcsJmhrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/Cam16UcsJmh#::<T>::max_lightnessrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/impl#[`Cam16UcsJmh<T>`]max_lightness().()],
292 radius: colorfulnessrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/Cam16UcsJmh#colorfulness. => [|c| c *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#mul(). Cam16UcsJmhrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/Cam16UcsJmh#::<T>::max_srgb_colorfulnessrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/impl#[`Cam16UcsJmh<T>`]max_srgb_colorfulness().()]
293 }
294 where T: Realrust-analyzer cargo palette 0.7.6 num/Real# + Zerorust-analyzer cargo palette 0.7.6 num/Zero# + corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::opsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/::Mulrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#<Outputrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Mul#Output# = T>,
295 );
296
297 // Unit tests
298
299 #[cfg(test)]
300 mod testrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/test/ {
301 use craterust-analyzer cargo palette 0.7.6 crate/::{
302 cam16rust-analyzer cargo palette 0.7.6 cam16/::{Cam16Jmhrust-analyzer cargo palette 0.7.6 cam16/partial/cam16_jmh/Cam16Jmh#, Cam16UcsJmhrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/Cam16UcsJmh#},
303 convertrust-analyzer cargo palette 0.7.6 convert/::FromColorUnclampedrust-analyzer cargo palette 0.7.6 convert/from_into_color_unclamped/FromColorUnclamped#,
304 };
305
306 #[cfg(feature = "approx")]
307 use craterust-analyzer cargo palette 0.7.6 crate/::color_differencerust-analyzer cargo palette 0.7.6 color_difference/::DeltaErust-analyzer cargo palette 0.7.6 color_difference/DeltaE#;
308
309 #[cfg(all(feature = "approx", feature = "alloc"))]
310 use craterust-analyzer cargo palette 0.7.6 crate/::{
311 cam16rust-analyzer cargo palette 0.7.6 cam16/::Cam16UcsJabrust-analyzer cargo palette 0.7.6 cam16/ucs_jab/Cam16UcsJab#, color_differencerust-analyzer cargo palette 0.7.6 color_difference/::ImprovedDeltaErust-analyzer cargo palette 0.7.6 color_difference/ImprovedDeltaE#, convertrust-analyzer cargo palette 0.7.6 convert/::IntoColorUnclampedrust-analyzer cargo palette 0.7.6 convert/from_into_color_unclamped/IntoColorUnclamped#,
312 };
313
314 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
315 fn rangesrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/test/ranges().() {
316 assert_rangesrust-analyzer cargo palette 0.7.6 macros/clamp/assert_ranges!! {
317 Cam16UcsJmhrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/Cam16UcsJmh#<f64>;
318 clamped {
319 lightness: 0.0 => 100.0
320 }
321 clamped_min {
322 colorfulness: 0.0 => 200.0
323 }
324 unclamped {
325 hue: -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][Neg]neg().360.0 => 360.0
326 }
327 }
328 }
329
330 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
331 fn cam16_roundtriprust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/test/cam16_roundtrip().() {
332 let ucs = Cam16UcsJmhrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/Cam16UcsJmh#::newrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/impl#[`Cam16UcsJmh<T>`]new().(50.0f64, 80.0, 120.0);
333 let cam16 = Cam16Jmhrust-analyzer cargo palette 0.7.6 cam16/partial/cam16_jmh/Cam16Jmh#::from_color_unclampedrust-analyzer cargo palette 0.7.6 cam16/partial/impl#[`Cam16Jmh<T>`][`FromColorUnclamped<Cam16UcsJmh<T>>`]from_color_unclamped().(ucs);
334 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(Cam16UcsJmhrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/Cam16UcsJmh#::from_color_unclampedrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/impl#[`Cam16UcsJmh<T>`][`FromColorUnclamped<Cam16Jmh<T>>`]from_color_unclamped().(cam16), ucs);
335 }
336
337 raw_pixel_conversion_testsrust-analyzer cargo palette 0.7.6 macros/casting/raw_pixel_conversion_tests!!(Cam16UcsJmhrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/Cam16UcsJmh#<>: lightness, colorfulness, hue);
338 raw_pixel_conversion_fail_testsrust-analyzer cargo palette 0.7.6 macros/casting/raw_pixel_conversion_fail_tests!!(Cam16UcsJmhrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/Cam16UcsJmh#<>: lightness, colorfulness, hue);
339
340 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
341 #[cfg(feature = "approx")]
342 fn delta_e_large_hue_diffrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/test/delta_e_large_hue_diff().() {
343 let lhs1 = Cam16UcsJmhrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/Cam16UcsJmh#::<f64>::newrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/impl#[`Cam16UcsJmh<T>`]new().(50.0, 64.0, -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][Neg]neg().730.0);
344 let rhs1 = Cam16UcsJmhrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/Cam16UcsJmh#::newrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/impl#[`Cam16UcsJmh<T>`]new().(50.0, 64.0, 730.0);
345
346 let lhs2 = Cam16UcsJmhrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/Cam16UcsJmh#::<f64>::newrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/impl#[`Cam16UcsJmh<T>`]new().(50.0, 64.0, -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][Neg]neg().10.0);
347 let rhs2 = Cam16UcsJmhrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/Cam16UcsJmh#::newrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/impl#[`Cam16UcsJmh<T>`]new().(50.0, 64.0, 10.0);
348
349 assert_relative_eqrust-analyzer cargo approx 0.5.1 macros/assert_relative_eq!!(
350 lhs1.delta_erust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/impl#[`Cam16UcsJmh<T>`][DeltaE]delta_e().(rhs1),
351 lhs2.delta_erust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/impl#[`Cam16UcsJmh<T>`][DeltaE]delta_e().(rhs2),
352 epsilonrust-analyzer cargo approx 0.5.1 impl#[`Relative<A, B>`]epsilon(). = 0.0000000000001
353 );
354 }
355
356 // Jab and Jmh have the same delta E.
357 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
358 #[cfg(all(feature = "approx", feature = "alloc"))]
359 fn jab_delta_e_equalityrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/test/jab_delta_e_equality().() {
360 let mut jab_colors: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Cam16UcsJabrust-analyzer cargo palette 0.7.6 cam16/ucs_jab/Cam16UcsJab#<f64>> = allocrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc crate/::vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/::Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]new().();
361
362 for j_step in 0i8..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#5 {
363 for a_step in -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i8][Neg]neg().2i8..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#3 {
364 for b_step in -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i8][Neg]neg().2i8..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#3 {
365 jab_colors.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(Cam16UcsJabrust-analyzer cargo palette 0.7.6 cam16/ucs_jab/Cam16UcsJab#::newrust-analyzer cargo palette 0.7.6 cam16/ucs_jab/impl#[`Cam16UcsJab<T>`]new().(
366 j_step as f64 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Mul<Self>`]mul().25.0,
367 a_step as f64 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Mul<Self>`]mul().60.0,
368 b_step as f64 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Mul<Self>`]mul().60.0,
369 ))
370 }
371 }
372 }
373
374 let jmh_colors: allocrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc crate/::vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/::Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Cam16UcsJmhrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/Cam16UcsJmh#<_>> = jab_colors.clonerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][Clone]clone().().into_color_unclampedrust-analyzer cargo palette 0.7.6 convert/from_into_color_unclamped/impl#[T][`IntoColorUnclamped<U>`]into_color_unclamped().();
375
376 for (&lhs_jab, &lhs_jmh) in jab_colors.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().ziprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#zip().(&jmh_colors) {
377 for (&rhs_jab, &rhs_jmh) in jab_colors.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().ziprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#zip().(&jmh_colors) {
378 let delta_e_jab = lhs_jab.delta_erust-analyzer cargo palette 0.7.6 cam16/ucs_jab/impl#[`Cam16UcsJab<T>`][DeltaE]delta_e().(rhs_jab);
379 let delta_e_jmh = lhs_jmh.delta_erust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/impl#[`Cam16UcsJmh<T>`][DeltaE]delta_e().(rhs_jmh);
380 assert_relative_eqrust-analyzer cargo approx 0.5.1 macros/assert_relative_eq!!(delta_e_jab, delta_e_jmh, epsilonrust-analyzer cargo approx 0.5.1 impl#[`Relative<A, B>`]epsilon(). = 0.0000000000001);
381 }
382 }
383 }
384
385 // Jab and Jmh have the same delta E, so should also have the same improved
386 // delta E.
387 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
388 #[cfg(all(feature = "approx", feature = "alloc"))]
389 fn jab_improved_delta_e_equalityrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/test/jab_improved_delta_e_equality().() {
390 let mut jab_colors: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Cam16UcsJabrust-analyzer cargo palette 0.7.6 cam16/ucs_jab/Cam16UcsJab#<f64>> = allocrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc crate/::vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/::Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]new().();
391
392 for j_step in 0i8..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#5 {
393 for a_step in -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i8][Neg]neg().2i8..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#3 {
394 for b_step in -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i8][Neg]neg().2i8..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#3 {
395 jab_colors.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(Cam16UcsJabrust-analyzer cargo palette 0.7.6 cam16/ucs_jab/Cam16UcsJab#::newrust-analyzer cargo palette 0.7.6 cam16/ucs_jab/impl#[`Cam16UcsJab<T>`]new().(
396 j_step as f64 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Mul<Self>`]mul().25.0,
397 a_step as f64 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Mul<Self>`]mul().60.0,
398 b_step as f64 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Mul<Self>`]mul().60.0,
399 ))
400 }
401 }
402 }
403
404 let jmh_colors: allocrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc crate/::vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/::Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Cam16UcsJmhrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/Cam16UcsJmh#<_>> = jab_colors.clonerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][Clone]clone().().into_color_unclampedrust-analyzer cargo palette 0.7.6 convert/from_into_color_unclamped/impl#[T][`IntoColorUnclamped<U>`]into_color_unclamped().();
405
406 for (&lhs_jab, &lhs_jmh) in jab_colors.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().ziprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#zip().(&jmh_colors) {
407 for (&rhs_jab, &rhs_jmh) in jab_colors.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().ziprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#zip().(&jmh_colors) {
408 let delta_e_jab = lhs_jab.improved_delta_erust-analyzer cargo palette 0.7.6 cam16/ucs_jab/impl#[`Cam16UcsJab<T>`][ImprovedDeltaE]improved_delta_e().(rhs_jab);
409 let delta_e_jmh = lhs_jmh.improved_delta_erust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/impl#[`Cam16UcsJmh<T>`][ImprovedDeltaE]improved_delta_e().(rhs_jmh);
410 assert_relative_eqrust-analyzer cargo approx 0.5.1 macros/assert_relative_eq!!(delta_e_jab, delta_e_jmh, epsilonrust-analyzer cargo approx 0.5.1 impl#[`Relative<A, B>`]epsilon(). = 0.0000000000001);
411 }
412 }
413 }
414
415 struct_of_arrays_testsrust-analyzer cargo palette 0.7.6 macros/struct_of_arrays/struct_of_arrays_tests!!(
416 Cam16UcsJmhrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/Cam16UcsJmh#[lightnessrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/Cam16UcsJmh#lightness., colorfulnessrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/Cam16UcsJmh#colorfulness., huerust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/Cam16UcsJmh#hue.],
417 superrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/::Cam16UcsJmharust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/Cam16UcsJmha#::newrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/impl#[`Alpha<Cam16UcsJmh<T>, A>`]new().(0.1f32, 0.2, 0.3, 0.4),
418 superrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/::Cam16UcsJmharust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/Cam16UcsJmha#::newrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/impl#[`Alpha<Cam16UcsJmh<T>, A>`]new().(0.2, 0.3, 0.4, 0.5),
419 superrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/::Cam16UcsJmharust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/Cam16UcsJmha#::newrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/impl#[`Alpha<Cam16UcsJmh<T>, A>`]new().(0.3, 0.4, 0.5, 0.6)
420 );
421
422 #[cfg(feature = "serializing")]
423 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
424 fn serializerust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/test/serialize().() {
425 let serialized = ::serde_jsonrust-analyzer cargo serde_json 1.0.116 crate/::to_stringrust-analyzer cargo serde_json 1.0.116 ser/to_string().(&Cam16UcsJmhrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/Cam16UcsJmh#::newrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/impl#[`Cam16UcsJmh<T>`]new().(0.3, 0.8, 0.1)).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
426
427 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
428 serialized,
429 r#"{"lightness":0.3,"colorfulness":0.8,"hue":0.1}"#
430 );
431 }
432
433 #[cfg(feature = "serializing")]
434 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
435 fn deserializerust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/test/deserialize().() {
436 let deserialized: Cam16UcsJmhrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/Cam16UcsJmh#<f32> =
437 ::serde_jsonrust-analyzer cargo serde_json 1.0.116 crate/::from_strrust-analyzer cargo serde_json 1.0.116 de/from_str().(r#"{"lightness":0.3,"colorfulness":0.8,"hue":0.1}"#).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
438
439 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(deserialized, Cam16UcsJmhrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/Cam16UcsJmh#::newrust-analyzer cargo palette 0.7.6 cam16/ucs_jmh/impl#[`Cam16UcsJmh<T>`]new().(0.3, 0.8, 0.1));
440 }
441
442 test_uniform_distributionrust-analyzer cargo palette 0.7.6 macros/random/test_uniform_distribution!! {
443 Cam16UcsJmh<f32> as crate::cam16::Cam16UcsJab<f32> {
444 lightness: (0.0, 100.0),
445 a: (-30.0, 30.0),
446 b: (-30.0, 30.0),
447 },
448 min: Cam16UcsJmh::new(0.0f32, 0.0, 0.0),
449 max: Cam16UcsJmh::new(100.0, 50.0, 360.0)
450 }
451 }