Debian Codegraph @

src/okhwb/visual_eq.rs

raw symbols SCIP
1 use craterust-analyzer cargo palette 0.7.6 crate/::anglerust-analyzer cargo palette 0.7.6 angle/::{AngleEqrust-analyzer cargo palette 0.7.6 angle/AngleEq#, HalfRotationrust-analyzer cargo palette 0.7.6 angle/HalfRotation#, RealAnglerust-analyzer cargo palette 0.7.6 angle/RealAngle#, SignedAnglerust-analyzer cargo palette 0.7.6 angle/SignedAngle#};
2 use craterust-analyzer cargo palette 0.7.6 crate/::numrust-analyzer cargo palette 0.7.6 num/::{Arithmeticsrust-analyzer cargo palette 0.7.6 num/Arithmetics#, Onerust-analyzer cargo palette 0.7.6 num/One#, Zerorust-analyzer cargo palette 0.7.6 num/Zero#};
3 use craterust-analyzer cargo palette 0.7.6 crate/::visualrust-analyzer cargo palette 0.7.6 visual/::{VisualColorrust-analyzer cargo palette 0.7.6 visual/VisualColor#, VisuallyEqualrust-analyzer cargo palette 0.7.6 visual/VisuallyEqual#};
4 use craterust-analyzer cargo palette 0.7.6 crate/::{HasBoolMaskrust-analyzer cargo palette 0.7.6 bool_mask/HasBoolMask#, Okhwbrust-analyzer cargo palette 0.7.6 okhwb/Okhwb#, OklabHuerust-analyzer cargo palette 0.7.6 hues/OklabHue#};
5 use approxrust-analyzer cargo approx 0.5.1 crate/::AbsDiffEqrust-analyzer cargo approx 0.5.1 abs_diff_eq/AbsDiffEq#;
6 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::borrowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/::Borrowrust-analyzer cargo core https://github.com/rust-lang/rust/library/core borrow/Borrow#;
7
8 impl<T> VisualColorrust-analyzer cargo palette 0.7.6 visual/VisualColor#<T> for Okhwbrust-analyzer cargo palette 0.7.6 okhwb/Okhwb#<T>
9 where
10 T: PartialOrdrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd# + HasBoolMaskrust-analyzer cargo palette 0.7.6 bool_mask/HasBoolMask#<Maskrust-analyzer cargo palette 0.7.6 bool_mask/HasBoolMask#Mask# = bool> + AbsDiffEqrust-analyzer cargo approx 0.5.1 abs_diff_eq/AbsDiffEq#<Epsilonrust-analyzer cargo approx 0.5.1 abs_diff_eq/AbsDiffEq#Epsilon# = T> + Onerust-analyzer cargo palette 0.7.6 num/One# + Zerorust-analyzer cargo palette 0.7.6 num/Zero# + Arithmeticsrust-analyzer cargo palette 0.7.6 num/Arithmetics#,
11 T::Epsilonrust-analyzer cargo approx 0.5.1 abs_diff_eq/AbsDiffEq#Epsilon#: Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#,
12 OklabHuerust-analyzer cargo palette 0.7.6 hues/OklabHue#<T>: AbsDiffEqrust-analyzer cargo approx 0.5.1 abs_diff_eq/AbsDiffEq#<Epsilonrust-analyzer cargo approx 0.5.1 abs_diff_eq/AbsDiffEq#Epsilon# = T::Epsilonrust-analyzer cargo approx 0.5.1 abs_diff_eq/AbsDiffEq#Epsilon#>,
13 {
14 /// Returns `true`, if `self.blackness + self.whiteness >= 1`,
15 /// assuming (but not asserting) that neither
16 /// `blackness` nor `whiteness` can be negative.
17 fn is_greyrust-analyzer cargo palette 0.7.6 okhwb/visual_eq/impl#[`Okhwb<T>`][`VisualColor<T>`]is_grey().(&self, epsilon: T::Epsilonrust-analyzer cargo approx 0.5.1 abs_diff_eq/AbsDiffEq#Epsilon#) -> bool {
18 let wb_sum = self.blacknessrust-analyzer cargo palette 0.7.6 okhwb/Okhwb#blackness..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().self.whitenessrust-analyzer cargo palette 0.7.6 okhwb/Okhwb#whiteness..clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().();
19 wb_sum rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#gt().T::onerust-analyzer cargo palette 0.7.6 num/One#one().() || wb_sum.abs_diff_eqrust-analyzer cargo approx 0.5.1 abs_diff_eq/AbsDiffEq#abs_diff_eq().(&T::onerust-analyzer cargo palette 0.7.6 num/One#one().(), epsilon)
20 }
21
22 /// Returns `true`, if `Self::is_grey && blackness == 0`,
23 /// i.e. the color's hue is irrelevant **and** the color contains
24 /// no black component it must be white.
25 fn is_whiterust-analyzer cargo palette 0.7.6 okhwb/visual_eq/impl#[`Okhwb<T>`][`VisualColor<T>`]is_white().(&self, epsilon: T::Epsilonrust-analyzer cargo approx 0.5.1 abs_diff_eq/AbsDiffEq#Epsilon#) -> bool {
26 self.is_greyrust-analyzer cargo palette 0.7.6 okhwb/visual_eq/impl#[`Okhwb<T>`][`VisualColor<T>`]is_grey().(epsilon.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().()) && self.blacknessrust-analyzer cargo palette 0.7.6 okhwb/Okhwb#blackness. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#lt().<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#lt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#lt().epsilon
27 }
28
29 /// Returns `true` if `Self::is_grey && whiteness == 0`
30 fn is_blackrust-analyzer cargo palette 0.7.6 okhwb/visual_eq/impl#[`Okhwb<T>`][`VisualColor<T>`]is_black().(&self, epsilon: T::Epsilonrust-analyzer cargo approx 0.5.1 abs_diff_eq/AbsDiffEq#Epsilon#) -> bool {
31 self.is_greyrust-analyzer cargo palette 0.7.6 okhwb/visual_eq/impl#[`Okhwb<T>`][`VisualColor<T>`]is_grey().(epsilon.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().()) && self.whitenessrust-analyzer cargo palette 0.7.6 okhwb/Okhwb#whiteness. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#lt().<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#lt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#lt().epsilon
32 }
33 }
34
35 impl<S, O, T> VisuallyEqualrust-analyzer cargo palette 0.7.6 visual/VisuallyEqual#<O, S, T> for Okhwbrust-analyzer cargo palette 0.7.6 okhwb/Okhwb#<T>
36 where
37 T: PartialOrdrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#
38 + HasBoolMaskrust-analyzer cargo palette 0.7.6 bool_mask/HasBoolMask#<Maskrust-analyzer cargo palette 0.7.6 bool_mask/HasBoolMask#Mask# = bool>
39 + RealAnglerust-analyzer cargo palette 0.7.6 angle/RealAngle#
40 + SignedAnglerust-analyzer cargo palette 0.7.6 angle/SignedAngle#
41 + Zerorust-analyzer cargo palette 0.7.6 num/Zero#
42 + Onerust-analyzer cargo palette 0.7.6 num/One#
43 + AngleEqrust-analyzer cargo palette 0.7.6 angle/AngleEq#<Maskrust-analyzer cargo palette 0.7.6 bool_mask/HasBoolMask#Mask# = bool>
44 + Arithmeticsrust-analyzer cargo palette 0.7.6 num/Arithmetics#
45 + AbsDiffEqrust-analyzer cargo approx 0.5.1 abs_diff_eq/AbsDiffEq#<Epsilonrust-analyzer cargo approx 0.5.1 abs_diff_eq/AbsDiffEq#Epsilon# = T>
46 + Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#,
47 T::Epsilonrust-analyzer cargo approx 0.5.1 abs_diff_eq/AbsDiffEq#Epsilon#: Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone# + HalfRotationrust-analyzer cargo palette 0.7.6 angle/HalfRotation#,
48 S: Borrowrust-analyzer cargo core https://github.com/rust-lang/rust/library/core borrow/Borrow#<Selfrust-analyzer cargo palette 0.7.6 okhwb/visual_eq/impl#[`Okhwb<T>`][`VisuallyEqual<O, S, T>`]> + Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy#,
49 O: Borrowrust-analyzer cargo core https://github.com/rust-lang/rust/library/core borrow/Borrow#<Selfrust-analyzer cargo palette 0.7.6 okhwb/visual_eq/impl#[`Okhwb<T>`][`VisuallyEqual<O, S, T>`]> + Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy#,
50 {
51 fn visually_eqrust-analyzer cargo palette 0.7.6 okhwb/visual_eq/impl#[`Okhwb<T>`][`VisuallyEqual<O, S, T>`]visually_eq().(s: S, o: O, epsilon: T::Epsilonrust-analyzer cargo approx 0.5.1 abs_diff_eq/AbsDiffEq#Epsilon#) -> bool {
52 VisuallyEqualrust-analyzer cargo palette 0.7.6 visual/VisuallyEqual#::both_black_or_both_whiterust-analyzer cargo palette 0.7.6 visual/VisuallyEqual#both_black_or_both_white().(s, o, epsilon.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().())
53 || VisuallyEqualrust-analyzer cargo palette 0.7.6 visual/VisuallyEqual#::both_greyscalerust-analyzer cargo palette 0.7.6 visual/VisuallyEqual#both_greyscale().(s, o, epsilon.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().())
54 && s.borrowrust-analyzer cargo core https://github.com/rust-lang/rust/library/core borrow/Borrow#borrow().()
55 .whitenessrust-analyzer cargo palette 0.7.6 okhwb/Okhwb#whiteness.
56 .abs_diff_eqrust-analyzer cargo approx 0.5.1 abs_diff_eq/AbsDiffEq#abs_diff_eq().(&o.borrowrust-analyzer cargo core https://github.com/rust-lang/rust/library/core borrow/Borrow#borrow().().whitenessrust-analyzer cargo palette 0.7.6 okhwb/Okhwb#whiteness., epsilon.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().())
57 && s.borrowrust-analyzer cargo core https://github.com/rust-lang/rust/library/core borrow/Borrow#borrow().()
58 .blacknessrust-analyzer cargo palette 0.7.6 okhwb/Okhwb#blackness.
59 .abs_diff_eqrust-analyzer cargo approx 0.5.1 abs_diff_eq/AbsDiffEq#abs_diff_eq().(&o.borrowrust-analyzer cargo core https://github.com/rust-lang/rust/library/core borrow/Borrow#borrow().().blacknessrust-analyzer cargo palette 0.7.6 okhwb/Okhwb#blackness., epsilon.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().())
60 || s.borrowrust-analyzer cargo core https://github.com/rust-lang/rust/library/core borrow/Borrow#borrow().().huerust-analyzer cargo palette 0.7.6 okhwb/Okhwb#hue..abs_diff_eqrust-analyzer cargo palette 0.7.6 hues/impl#[`OklabHue<T>`][`AbsDiffEq<Self>`]abs_diff_eq().(&o.borrowrust-analyzer cargo core https://github.com/rust-lang/rust/library/core borrow/Borrow#borrow().().huerust-analyzer cargo palette 0.7.6 okhwb/Okhwb#hue., epsilon.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().())
61 && s.borrowrust-analyzer cargo core https://github.com/rust-lang/rust/library/core borrow/Borrow#borrow().()
62 .blacknessrust-analyzer cargo palette 0.7.6 okhwb/Okhwb#blackness.
63 .abs_diff_eqrust-analyzer cargo approx 0.5.1 abs_diff_eq/AbsDiffEq#abs_diff_eq().(&o.borrowrust-analyzer cargo core https://github.com/rust-lang/rust/library/core borrow/Borrow#borrow().().blacknessrust-analyzer cargo palette 0.7.6 okhwb/Okhwb#blackness., epsilon.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().())
64 && s.borrowrust-analyzer cargo core https://github.com/rust-lang/rust/library/core borrow/Borrow#borrow().()
65 .whitenessrust-analyzer cargo palette 0.7.6 okhwb/Okhwb#whiteness.
66 .abs_diff_eqrust-analyzer cargo approx 0.5.1 abs_diff_eq/AbsDiffEq#abs_diff_eq().(&o.borrowrust-analyzer cargo core https://github.com/rust-lang/rust/library/core borrow/Borrow#borrow().().whitenessrust-analyzer cargo palette 0.7.6 okhwb/Okhwb#whiteness., epsilon)
67 }
68 }