| 1 | use corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::{ |
| 2 | anyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core any/::TypeIdrust-analyzer cargo core https://github.com/rust-lang/rust/library/core any/TypeId#, |
| 3 | convertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/::TryIntorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/TryInto#, |
| 4 | fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/, |
| 5 | 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#, |
| 6 | opsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/::{Addrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#, Divrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Div#}, |
| 7 | }; |
| 8 | |
| 9 | use craterust-analyzer cargo palette 0.7.6 crate/::{ |
| 10 | bool_maskrust-analyzer cargo palette 0.7.6 bool_mask/::{HasBoolMaskrust-analyzer cargo palette 0.7.6 bool_mask/HasBoolMask#, LazySelectrust-analyzer cargo palette 0.7.6 bool_mask/LazySelect#}, |
| 11 | castrust-analyzer cargo palette 0.7.6 cast/::{ComponentOrderrust-analyzer cargo palette 0.7.6 cast/packed/ComponentOrder#, Packedrust-analyzer cargo palette 0.7.6 cast/packed/Packed#, UintCastrust-analyzer cargo palette 0.7.6 cast/uint/UintCast#}, |
| 12 | color_differencerust-analyzer cargo palette 0.7.6 color_difference/::Wcag21RelativeContrastrust-analyzer cargo palette 0.7.6 color_difference/Wcag21RelativeContrast#, |
| 13 | convertrust-analyzer cargo palette 0.7.6 convert/::FromColorUnclampedrust-analyzer cargo palette 0.7.6 convert/from_into_color_unclamped/FromColorUnclamped#, |
| 14 | encodingrust-analyzer cargo palette 0.7.6 encoding/::{FromLinearrust-analyzer cargo palette 0.7.6 encoding/FromLinear#, IntoLinearrust-analyzer cargo palette 0.7.6 encoding/IntoLinear#, Linearrust-analyzer cargo palette 0.7.6 encoding/linear/Linear#, Srgbrust-analyzer cargo palette 0.7.6 encoding/srgb/Srgb#}, |
| 15 | lumarust-analyzer cargo palette 0.7.6 luma/::LumaStandardrust-analyzer cargo palette 0.7.6 luma/LumaStandard#, |
| 16 | numrust-analyzer cargo palette 0.7.6 num/::{Arithmeticsrust-analyzer cargo palette 0.7.6 num/Arithmetics#, MinMaxrust-analyzer cargo palette 0.7.6 num/MinMax#, PartialCmprust-analyzer cargo palette 0.7.6 num/PartialCmp#, Realrust-analyzer cargo palette 0.7.6 num/Real#}, |
| 17 | stimulusrust-analyzer cargo palette 0.7.6 stimulus/::{FromStimulusrust-analyzer cargo palette 0.7.6 stimulus/FromStimulus#, Stimulusrust-analyzer cargo palette 0.7.6 stimulus/Stimulus#, StimulusColorrust-analyzer cargo palette 0.7.6 stimulus/StimulusColor#}, |
| 18 | white_pointrust-analyzer cargo palette 0.7.6 white_point/::D65rust-analyzer cargo palette 0.7.6 white_point/D65#, |
| 19 | Alpharust-analyzer cargo palette 0.7.6 alpha/alpha/Alpha#, IntoColorrust-analyzer cargo palette 0.7.6 convert/from_into_color/IntoColor#, Xyzrust-analyzer cargo palette 0.7.6 xyz/Xyz#, Yxyrust-analyzer cargo palette 0.7.6 yxy/Yxy#, |
| 20 | }; |
| 21 | |
| 22 | /// Luminance with an alpha component. See the [`Lumaa` implementation |
| 23 | /// in `Alpha`](crate::Alpha#Lumaa). |
| 24 | pub type Lumaarust-analyzer cargo palette 0.7.6 luma/luma/Lumaa#<S = Srgbrust-analyzer cargo palette 0.7.6 encoding/srgb/Srgb#, T = f32> = Alpharust-analyzer cargo palette 0.7.6 alpha/alpha/Alpha#<Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#<S, T>, T>; |
| 25 | |
| 26 | /// Luminance. |
| 27 | /// |
| 28 | /// Luma is a purely gray scale color space, which is included more for |
| 29 | /// completeness than anything else, and represents how bright a color is |
| 30 | /// perceived to be. It's basically the `Y` component of [CIE |
| 31 | /// XYZ](crate::Xyz). The lack of any form of hue representation limits |
| 32 | /// the set of operations that can be performed on it. |
| 33 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, ArrayCastrust-analyzer cargo palette_derive 0.7.6 ArrayCast:, FromColorUnclampedrust-analyzer cargo palette_derive 0.7.6 FromColorUnclamped:, WithAlpharust-analyzer cargo palette_derive 0.7.6 WithAlpha:)] |
| 34 | #[cfg_attr(feature = "serializing", derive(Serializerust-analyzer cargo serde_derive 1.0.229 Serialize:, Deserializerust-analyzer cargo serde_derive 1.0.229 Deserialize:))] |
| 35 | #[palette( |
| 36 | palette_internal, |
| 37 | luma_standard = "S", |
| 38 | component = "T", |
| 39 | skip_derives(Xyz, Yxy, Luma) |
| 40 | )] |
| 41 | #[repr(C)] |
| 42 | #[doc(alias = "gray")] |
| 43 | #[doc(alias = "grey")] |
| 44 | pub struct Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#<S = Srgbrust-analyzer cargo palette 0.7.6 encoding/srgb/Srgb#, T = f32> { |
| 45 | /// The lightness of the color. 0.0 is black and 1.0 is white. |
| 46 | pub lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#luma.: T, |
| 47 | |
| 48 | /// The kind of RGB standard. sRGB is the default. |
| 49 | #[cfg_attr(feature = "serializing", serde(skip))] |
| 50 | #[paletterust-analyzer cargo palette_derive 0.7.6 palette:(unsafe_zero_sized)] |
| 51 | pub standardrust-analyzer cargo palette 0.7.6 luma/luma/Luma#standard.: PhantomDatarust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/PhantomData#<S>, |
| 52 | } |
| 53 | |
| 54 | impl<S, T> Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#<S, T> { |
| 55 | /// Create a luminance color. |
| 56 | pub const fn newrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Luma<S, T>`]new().(luma: T) -> Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#<S, T> { |
| 57 | Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma# { |
| 58 | lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#luma., |
| 59 | standardrust-analyzer cargo palette 0.7.6 luma/luma/Luma#standard.: PhantomDatarust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/PhantomData#, |
| 60 | } |
| 61 | } |
| 62 | |
| 63 | /// Convert into another component type. |
| 64 | pub fn into_formatrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Luma<S, T>`]into_format().<U>(self) -> Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#<S, U> |
| 65 | where |
| 66 | U: FromStimulusrust-analyzer cargo palette 0.7.6 stimulus/FromStimulus#<T>, |
| 67 | { |
| 68 | Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma# { |
| 69 | lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#luma.: U::from_stimulusrust-analyzer cargo palette 0.7.6 stimulus/FromStimulus#from_stimulus().(self.lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#luma.), |
| 70 | standardrust-analyzer cargo palette 0.7.6 luma/luma/Luma#standard.: PhantomDatarust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/PhantomData#, |
| 71 | } |
| 72 | } |
| 73 | |
| 74 | /// Convert from another component type. |
| 75 | pub fn from_formatrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Luma<S, T>`]from_format().<U>(color: Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#<S, U>) -> Selfrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Luma<S, T>`] |
| 76 | where |
| 77 | T: FromStimulusrust-analyzer cargo palette 0.7.6 stimulus/FromStimulus#<U>, |
| 78 | { |
| 79 | color.into_formatrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Luma<S, T>`]into_format().() |
| 80 | } |
| 81 | |
| 82 | /// Convert to a `(luma,)` tuple. |
| 83 | pub fn into_componentsrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Luma<S, T>`]into_components().(self) -> (T,) { |
| 84 | (self.lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#luma.,) |
| 85 | } |
| 86 | |
| 87 | /// Convert from a `(luma,)` tuple. |
| 88 | pub fn from_componentsrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Luma<S, T>`]from_components().((luma,): (T,)) -> Selfrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Luma<S, T>`] { |
| 89 | Selfrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Luma<S, T>`]::newrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Luma<S, T>`]new().(luma) |
| 90 | } |
| 91 | |
| 92 | fn reinterpret_asrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Luma<S, T>`]reinterpret_as().<S2>(self) -> Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#<S2, T> |
| 93 | where |
| 94 | S: LumaStandardrust-analyzer cargo palette 0.7.6 luma/LumaStandard#, |
| 95 | S2: LumaStandardrust-analyzer cargo palette 0.7.6 luma/LumaStandard#<WhitePointrust-analyzer cargo palette 0.7.6 luma/LumaStandard#WhitePoint# = S::WhitePointrust-analyzer cargo palette 0.7.6 luma/LumaStandard#WhitePoint#>, |
| 96 | { |
| 97 | Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma# { |
| 98 | lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#luma.: self.lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#luma., |
| 99 | standardrust-analyzer cargo palette 0.7.6 luma/luma/Luma#standard.: PhantomDatarust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/PhantomData#, |
| 100 | } |
| 101 | } |
| 102 | } |
| 103 | |
| 104 | impl<S, T> Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#<S, T> |
| 105 | where |
| 106 | T: Stimulusrust-analyzer cargo palette 0.7.6 stimulus/Stimulus#, |
| 107 | { |
| 108 | /// Return the `luma` value minimum. |
| 109 | pub fn min_lumarust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Luma<S, T>`]min_luma().() -> T { |
| 110 | T::zerorust-analyzer cargo palette 0.7.6 num/Zero#zero().() |
| 111 | } |
| 112 | |
| 113 | /// Return the `luma` value maximum. |
| 114 | pub fn max_lumarust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Luma<S, T>`]max_luma().() -> T { |
| 115 | T::max_intensityrust-analyzer cargo palette 0.7.6 stimulus/Stimulus#max_intensity().() |
| 116 | } |
| 117 | } |
| 118 | |
| 119 | impl<S> Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#<S, u8> { |
| 120 | /// Convert to a packed `u16` with with specifiable component order. |
| 121 | /// |
| 122 | /// ``` |
| 123 | /// use palette::{luma, SrgbLuma}; |
| 124 | /// |
| 125 | /// let integer = SrgbLuma::new(96u8).into_u16::<luma::channels::La>(); |
| 126 | /// assert_eq!(0x60FF, integer); |
| 127 | /// ``` |
| 128 | /// |
| 129 | /// It's also possible to use `From` and `Into`, which defaults to the |
| 130 | /// `0xAALL` component order: |
| 131 | /// |
| 132 | /// ``` |
| 133 | /// use palette::SrgbLuma; |
| 134 | /// |
| 135 | /// let integer = u16::from(SrgbLuma::new(96u8)); |
| 136 | /// assert_eq!(0xFF60, integer); |
| 137 | /// ``` |
| 138 | /// |
| 139 | /// See [Packed](crate::cast::Packed) for more details. |
| 140 | #[inline] |
| 141 | pub fn into_u16rust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Luma<S, u8>`]into_u16().<O>(self) -> u16 |
| 142 | where |
| 143 | O: ComponentOrderrust-analyzer cargo palette 0.7.6 cast/packed/ComponentOrder#<Lumaarust-analyzer cargo palette 0.7.6 luma/luma/Lumaa#<S, u8>, u16>, |
| 144 | { |
| 145 | O::packrust-analyzer cargo palette 0.7.6 cast/packed/ComponentOrder#pack().(Lumaarust-analyzer cargo palette 0.7.6 luma/luma/Lumaa#::fromrust-analyzer cargo palette 0.7.6 alpha/alpha/impl#[`Alpha<C, T>`][`From<C>`]from().(self)) |
| 146 | } |
| 147 | |
| 148 | /// Convert from a packed `u16` with specifiable component order. |
| 149 | /// |
| 150 | /// ``` |
| 151 | /// use palette::{luma, SrgbLuma}; |
| 152 | /// |
| 153 | /// let luma = SrgbLuma::from_u16::<luma::channels::La>(0x60FF); |
| 154 | /// assert_eq!(SrgbLuma::new(96u8), luma); |
| 155 | /// ``` |
| 156 | /// |
| 157 | /// It's also possible to use `From` and `Into`, which defaults to the |
| 158 | /// `0xAALL` component order: |
| 159 | /// |
| 160 | /// ``` |
| 161 | /// use palette::SrgbLuma; |
| 162 | /// |
| 163 | /// let luma = SrgbLuma::from(0x60u16); |
| 164 | /// assert_eq!(SrgbLuma::new(96u8), luma); |
| 165 | /// ``` |
| 166 | /// |
| 167 | /// See [Packed](crate::cast::Packed) for more details. |
| 168 | #[inline] |
| 169 | pub fn from_u16rust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Luma<S, u8>`]from_u16().<O>(color: u16) -> Selfrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Luma<S, u8>`] |
| 170 | where |
| 171 | O: ComponentOrderrust-analyzer cargo palette 0.7.6 cast/packed/ComponentOrder#<Lumaarust-analyzer cargo palette 0.7.6 luma/luma/Lumaa#<S, u8>, u16>, |
| 172 | { |
| 173 | O::unpackrust-analyzer cargo palette 0.7.6 cast/packed/ComponentOrder#unpack().(color).colorrust-analyzer cargo palette 0.7.6 alpha/alpha/Alpha#color. |
| 174 | } |
| 175 | } |
| 176 | |
| 177 | impl<S, T> Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#<S, T> |
| 178 | where |
| 179 | S: LumaStandardrust-analyzer cargo palette 0.7.6 luma/LumaStandard#, |
| 180 | { |
| 181 | /// Convert the color to linear luminance. |
| 182 | /// |
| 183 | /// Some transfer functions allow the component type to be converted at the |
| 184 | /// same time. This is usually offered with increased performance, compared |
| 185 | /// to using [`into_format`][Luma::into_format]. |
| 186 | /// |
| 187 | /// ``` |
| 188 | /// use palette::{SrgbLuma, LinLuma}; |
| 189 | /// |
| 190 | /// let linear: LinLuma<_, f32> = SrgbLuma::new(96u8).into_linear(); |
| 191 | /// ``` |
| 192 | /// |
| 193 | /// See the transfer function types in the [`encoding`](crate::encoding) |
| 194 | /// module for details and performance characteristics. |
| 195 | pub fn into_linearrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Luma<S, T>`]into_linear().<U>(self) -> Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#<Linearrust-analyzer cargo palette 0.7.6 encoding/linear/Linear#<S::WhitePointrust-analyzer cargo palette 0.7.6 luma/LumaStandard#WhitePoint#>, U> |
| 196 | where |
| 197 | S::TransferFnrust-analyzer cargo palette 0.7.6 luma/LumaStandard#TransferFn#: IntoLinearrust-analyzer cargo palette 0.7.6 encoding/IntoLinear#<U, T>, |
| 198 | { |
| 199 | Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#::newrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Luma<S, T>`]new().(S::TransferFnrust-analyzer cargo palette 0.7.6 luma/LumaStandard#TransferFn#::into_linearrust-analyzer cargo palette 0.7.6 encoding/IntoLinear#into_linear().(self.lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#luma.)) |
| 200 | } |
| 201 | |
| 202 | /// Convert linear luminance to non-linear luminance. |
| 203 | /// |
| 204 | /// Some transfer functions allow the component type to be converted at the |
| 205 | /// same time. This is usually offered with increased performance, compared |
| 206 | /// to using [`into_format`][Luma::into_format]. |
| 207 | /// |
| 208 | /// ``` |
| 209 | /// use palette::{SrgbLuma, LinLuma}; |
| 210 | /// |
| 211 | /// let encoded = SrgbLuma::<u8>::from_linear(LinLuma::new(0.95f32)); |
| 212 | /// ``` |
| 213 | /// |
| 214 | /// See the transfer function types in the [`encoding`](crate::encoding) |
| 215 | /// module for details and performance characteristics. |
| 216 | pub fn from_linearrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Luma<S, T>`]from_linear().<U>(color: Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#<Linearrust-analyzer cargo palette 0.7.6 encoding/linear/Linear#<S::WhitePointrust-analyzer cargo palette 0.7.6 luma/LumaStandard#WhitePoint#>, U>) -> Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#<S, T> |
| 217 | where |
| 218 | S::TransferFnrust-analyzer cargo palette 0.7.6 luma/LumaStandard#TransferFn#: FromLinearrust-analyzer cargo palette 0.7.6 encoding/FromLinear#<U, T>, |
| 219 | { |
| 220 | Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#::newrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Luma<S, T>`]new().(S::TransferFnrust-analyzer cargo palette 0.7.6 luma/LumaStandard#TransferFn#::from_linearrust-analyzer cargo palette 0.7.6 encoding/FromLinear#from_linear().(color.lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#luma.)) |
| 221 | } |
| 222 | } |
| 223 | |
| 224 | impl<Wp, T> Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#<Linearrust-analyzer cargo palette 0.7.6 encoding/linear/Linear#<Wp>, T> { |
| 225 | /// Convert a linear color to a different encoding. |
| 226 | /// |
| 227 | /// Some transfer functions allow the component type to be converted at the |
| 228 | /// same time. This is usually offered with increased performance, compared |
| 229 | /// to using [`into_format`][Luma::into_format]. |
| 230 | /// |
| 231 | /// ``` |
| 232 | /// use palette::{SrgbLuma, LinLuma}; |
| 233 | /// |
| 234 | /// let encoded: SrgbLuma<u8> = LinLuma::new(0.95f32).into_encoding(); |
| 235 | /// ``` |
| 236 | /// |
| 237 | /// See the transfer function types in the [`encoding`](crate::encoding) |
| 238 | /// module for details and performance characteristics. |
| 239 | pub fn into_encodingrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Luma<Linear<Wp>, T>`]into_encoding().<U, St>(self) -> Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#<St, U> |
| 240 | where |
| 241 | St: LumaStandardrust-analyzer cargo palette 0.7.6 luma/LumaStandard#<WhitePointrust-analyzer cargo palette 0.7.6 luma/LumaStandard#WhitePoint# = Wp>, |
| 242 | St::TransferFnrust-analyzer cargo palette 0.7.6 luma/LumaStandard#TransferFn#: FromLinearrust-analyzer cargo palette 0.7.6 encoding/FromLinear#<T, U>, |
| 243 | { |
| 244 | Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#::<St, U>::from_linearrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Luma<S, T>`]from_linear().(self) |
| 245 | } |
| 246 | |
| 247 | /// Convert from linear luminance from a different encoding. |
| 248 | /// |
| 249 | /// Some transfer functions allow the component type to be converted at the |
| 250 | /// same time. This is usually offered with increased performance, compared |
| 251 | /// to using [`into_format`][Luma::into_format]. |
| 252 | /// |
| 253 | /// ``` |
| 254 | /// use palette::{SrgbLuma, LinLuma}; |
| 255 | /// |
| 256 | /// let linear = LinLuma::<_, f32>::from_encoding(SrgbLuma::new(96u8)); |
| 257 | /// ``` |
| 258 | /// |
| 259 | /// See the transfer function types in the [`encoding`](crate::encoding) |
| 260 | /// module for details and performance characteristics. |
| 261 | pub fn from_encodingrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Luma<Linear<Wp>, T>`]from_encoding().<U, St>(color: Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#<St, U>) -> Selfrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Luma<Linear<Wp>, T>`] |
| 262 | where |
| 263 | St: LumaStandardrust-analyzer cargo palette 0.7.6 luma/LumaStandard#<WhitePointrust-analyzer cargo palette 0.7.6 luma/LumaStandard#WhitePoint# = Wp>, |
| 264 | St::TransferFnrust-analyzer cargo palette 0.7.6 luma/LumaStandard#TransferFn#: IntoLinearrust-analyzer cargo palette 0.7.6 encoding/IntoLinear#<T, U>, |
| 265 | { |
| 266 | color.into_linearrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Luma<S, T>`]into_linear().() |
| 267 | } |
| 268 | } |
| 269 | |
| 270 | // Safety: |
| 271 | // |
| 272 | // Luma is a transparent wrapper around its component, which fulfills the |
| 273 | // requirements of UintCast. |
| 274 | unsafe impl<S> UintCastrust-analyzer cargo palette 0.7.6 cast/uint/UintCast# for Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#<S, u8> { |
| 275 | type Uintrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Luma<S, u8>`][UintCast]Uint# = u8; |
| 276 | } |
| 277 | |
| 278 | // Safety: |
| 279 | // |
| 280 | // Luma is a transparent wrapper around its component, which fulfills the |
| 281 | // requirements of UintCast. |
| 282 | unsafe impl<S> UintCastrust-analyzer cargo palette 0.7.6 cast/uint/UintCast# for Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#<S, u16> { |
| 283 | type Uintrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Luma<S, u16>`][UintCast]Uint# = u16; |
| 284 | } |
| 285 | |
| 286 | // Safety: |
| 287 | // |
| 288 | // Luma is a transparent wrapper around its component, which fulfills the |
| 289 | // requirements of UintCast. |
| 290 | unsafe impl<S> UintCastrust-analyzer cargo palette 0.7.6 cast/uint/UintCast# for Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#<S, u32> { |
| 291 | type Uintrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Luma<S, u32>`][UintCast]Uint# = u32; |
| 292 | } |
| 293 | |
| 294 | // Safety: |
| 295 | // |
| 296 | // Luma is a transparent wrapper around its component, which fulfills the |
| 297 | // requirements of UintCast. |
| 298 | unsafe impl<S> UintCastrust-analyzer cargo palette 0.7.6 cast/uint/UintCast# for Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#<S, u64> { |
| 299 | type Uintrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Luma<S, u64>`][UintCast]Uint# = u64; |
| 300 | } |
| 301 | |
| 302 | // Safety: |
| 303 | // |
| 304 | // Luma is a transparent wrapper around its component, which fulfills the |
| 305 | // requirements of UintCast. |
| 306 | unsafe impl<S> UintCastrust-analyzer cargo palette 0.7.6 cast/uint/UintCast# for Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#<S, u128> { |
| 307 | type Uintrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Luma<S, u128>`][UintCast]Uint# = u128; |
| 308 | } |
| 309 | |
| 310 | ///<span id="Lumaa"></span>[`Lumaa`](crate::luma::Lumaa) implementations. |
| 311 | impl<S, T, A> Alpharust-analyzer cargo palette 0.7.6 alpha/alpha/Alpha#<Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#<S, T>, A> { |
| 312 | /// Create a luminance color with transparency. |
| 313 | pub const fn newrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Alpha<Luma<S, T>, A>`]new().(luma: T, alpha: A) -> Selfrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Alpha<Luma<S, T>, A>`] { |
| 314 | Alpharust-analyzer cargo palette 0.7.6 alpha/alpha/Alpha# { |
| 315 | colorrust-analyzer cargo palette 0.7.6 alpha/alpha/Alpha#color.: Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#::newrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Luma<S, T>`]new().(luma), |
| 316 | alpharust-analyzer cargo palette 0.7.6 alpha/alpha/Alpha#alpha., |
| 317 | } |
| 318 | } |
| 319 | |
| 320 | /// Convert into another component type. |
| 321 | pub fn into_formatrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Alpha<Luma<S, T>, A>`]into_format().<U, B>(self) -> Alpharust-analyzer cargo palette 0.7.6 alpha/alpha/Alpha#<Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#<S, U>, B> |
| 322 | where |
| 323 | U: FromStimulusrust-analyzer cargo palette 0.7.6 stimulus/FromStimulus#<T>, |
| 324 | B: FromStimulusrust-analyzer cargo palette 0.7.6 stimulus/FromStimulus#<A>, |
| 325 | { |
| 326 | Alpharust-analyzer cargo palette 0.7.6 alpha/alpha/Alpha# { |
| 327 | colorrust-analyzer cargo palette 0.7.6 alpha/alpha/Alpha#color.: self.colorrust-analyzer cargo palette 0.7.6 alpha/alpha/Alpha#color..into_formatrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Luma<S, T>`]into_format().(), |
| 328 | alpharust-analyzer cargo palette 0.7.6 alpha/alpha/Alpha#alpha.: B::from_stimulusrust-analyzer cargo palette 0.7.6 stimulus/FromStimulus#from_stimulus().(self.alpharust-analyzer cargo palette 0.7.6 alpha/alpha/Alpha#alpha.), |
| 329 | } |
| 330 | } |
| 331 | |
| 332 | /// Convert from another component type. |
| 333 | pub fn from_formatrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Alpha<Luma<S, T>, A>`]from_format().<U, B>(color: Alpharust-analyzer cargo palette 0.7.6 alpha/alpha/Alpha#<Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#<S, U>, B>) -> Selfrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Alpha<Luma<S, T>, A>`] |
| 334 | where |
| 335 | T: FromStimulusrust-analyzer cargo palette 0.7.6 stimulus/FromStimulus#<U>, |
| 336 | A: FromStimulusrust-analyzer cargo palette 0.7.6 stimulus/FromStimulus#<B>, |
| 337 | { |
| 338 | color.into_formatrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Alpha<Luma<S, T>, A>`]into_format().() |
| 339 | } |
| 340 | |
| 341 | /// Convert to a `(luma, alpha)` tuple. |
| 342 | pub fn into_componentsrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Alpha<Luma<S, T>, A>`]into_components().(self) -> (T, A) { |
| 343 | (self.colorrust-analyzer cargo palette 0.7.6 alpha/alpha/Alpha#color..lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#luma., self.alpharust-analyzer cargo palette 0.7.6 alpha/alpha/Alpha#alpha.) |
| 344 | } |
| 345 | |
| 346 | /// Convert from a `(luma, alpha)` tuple. |
| 347 | pub fn from_componentsrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Alpha<Luma<S, T>, A>`]from_components().((luma, alpha): (T, A)) -> Selfrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Alpha<Luma<S, T>, A>`] { |
| 348 | Selfrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Alpha<Luma<S, T>, A>`]::newrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Alpha<Luma<S, T>, A>`]new().(luma, alpha) |
| 349 | } |
| 350 | } |
| 351 | |
| 352 | impl<S> Lumaarust-analyzer cargo palette 0.7.6 luma/luma/Lumaa#<S, u8> { |
| 353 | /// Convert to a packed `u16` with with a specific component order. |
| 354 | /// |
| 355 | /// ``` |
| 356 | /// use palette::{luma, SrgbLumaa}; |
| 357 | /// |
| 358 | /// let integer = SrgbLumaa::new(96u8, 255).into_u16::<luma::channels::Al>(); |
| 359 | /// assert_eq!(0xFF60, integer); |
| 360 | /// ``` |
| 361 | /// |
| 362 | /// It's also possible to use `From` and `Into`, which defaults to the |
| 363 | /// `0xLLAA` component order: |
| 364 | /// |
| 365 | /// ``` |
| 366 | /// use palette::SrgbLumaa; |
| 367 | /// |
| 368 | /// let integer = u16::from(SrgbLumaa::new(96u8, 255)); |
| 369 | /// assert_eq!(0x60FF, integer); |
| 370 | /// ``` |
| 371 | /// |
| 372 | /// See [Packed](crate::cast::Packed) for more details. |
| 373 | #[inline] |
| 374 | pub fn into_u16rust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Alpha<Luma<S, u8>, u8>`]into_u16().<O>(self) -> u16 |
| 375 | where |
| 376 | O: ComponentOrderrust-analyzer cargo palette 0.7.6 cast/packed/ComponentOrder#<Lumaarust-analyzer cargo palette 0.7.6 luma/luma/Lumaa#<S, u8>, u16>, |
| 377 | { |
| 378 | O::packrust-analyzer cargo palette 0.7.6 cast/packed/ComponentOrder#pack().(self) |
| 379 | } |
| 380 | |
| 381 | /// Convert from a packed `u16` with a specific component order. |
| 382 | /// |
| 383 | /// ``` |
| 384 | /// use palette::{luma, SrgbLumaa}; |
| 385 | /// |
| 386 | /// let luma = SrgbLumaa::from_u16::<luma::channels::Al>(0xFF60); |
| 387 | /// assert_eq!(SrgbLumaa::new(96u8, 255), luma); |
| 388 | /// ``` |
| 389 | /// |
| 390 | /// It's also possible to use `From` and `Into`, which defaults to the |
| 391 | /// `0xLLAA` component order: |
| 392 | /// |
| 393 | /// ``` |
| 394 | /// use palette::SrgbLumaa; |
| 395 | /// |
| 396 | /// let luma = SrgbLumaa::from(0x60FF); |
| 397 | /// assert_eq!(SrgbLumaa::new(96u8, 255), luma); |
| 398 | /// ``` |
| 399 | /// |
| 400 | /// See [Packed](crate::cast::Packed) for more details. |
| 401 | #[inline] |
| 402 | pub fn from_u16rust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Alpha<Luma<S, u8>, u8>`]from_u16().<O>(color: u16) -> Selfrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Alpha<Luma<S, u8>, u8>`] |
| 403 | where |
| 404 | O: ComponentOrderrust-analyzer cargo palette 0.7.6 cast/packed/ComponentOrder#<Lumaarust-analyzer cargo palette 0.7.6 luma/luma/Lumaa#<S, u8>, u16>, |
| 405 | { |
| 406 | O::unpackrust-analyzer cargo palette 0.7.6 cast/packed/ComponentOrder#unpack().(color) |
| 407 | } |
| 408 | } |
| 409 | |
| 410 | impl<S, T, A> Alpharust-analyzer cargo palette 0.7.6 alpha/alpha/Alpha#<Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#<S, T>, A> |
| 411 | where |
| 412 | S: LumaStandardrust-analyzer cargo palette 0.7.6 luma/LumaStandard#, |
| 413 | { |
| 414 | /// Convert the color to linear luminance with transparency. |
| 415 | /// |
| 416 | /// Some transfer functions allow the component type to be converted at the |
| 417 | /// same time. This is usually offered with increased performance, compared |
| 418 | /// to using [`into_format`][Luma::into_format]. |
| 419 | /// |
| 420 | /// ``` |
| 421 | /// use palette::{SrgbLumaa, LinLumaa}; |
| 422 | /// |
| 423 | /// let linear: LinLumaa<_, f32> = SrgbLumaa::new(96u8, 38).into_linear(); |
| 424 | /// ``` |
| 425 | /// |
| 426 | /// See the transfer function types in the [`encoding`](crate::encoding) |
| 427 | /// module for details and performance characteristics. |
| 428 | pub fn into_linearrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Alpha<Luma<S, T>, A>`]into_linear().<U, B>(self) -> Alpharust-analyzer cargo palette 0.7.6 alpha/alpha/Alpha#<Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#<Linearrust-analyzer cargo palette 0.7.6 encoding/linear/Linear#<S::WhitePointrust-analyzer cargo palette 0.7.6 luma/LumaStandard#WhitePoint#>, U>, B> |
| 429 | where |
| 430 | S::TransferFnrust-analyzer cargo palette 0.7.6 luma/LumaStandard#TransferFn#: IntoLinearrust-analyzer cargo palette 0.7.6 encoding/IntoLinear#<U, T>, |
| 431 | B: FromStimulusrust-analyzer cargo palette 0.7.6 stimulus/FromStimulus#<A>, |
| 432 | { |
| 433 | Alpharust-analyzer cargo palette 0.7.6 alpha/alpha/Alpha# { |
| 434 | colorrust-analyzer cargo palette 0.7.6 alpha/alpha/Alpha#color.: self.colorrust-analyzer cargo palette 0.7.6 alpha/alpha/Alpha#color..into_linearrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Luma<S, T>`]into_linear().(), |
| 435 | alpharust-analyzer cargo palette 0.7.6 alpha/alpha/Alpha#alpha.: B::from_stimulusrust-analyzer cargo palette 0.7.6 stimulus/FromStimulus#from_stimulus().(self.alpharust-analyzer cargo palette 0.7.6 alpha/alpha/Alpha#alpha.), |
| 436 | } |
| 437 | } |
| 438 | |
| 439 | /// Convert linear luminance to non-linear luminance with transparency. |
| 440 | /// |
| 441 | /// Some transfer functions allow the component type to be converted at the |
| 442 | /// same time. This is usually offered with increased performance, compared |
| 443 | /// to using [`into_format`][Luma::into_format]. |
| 444 | /// |
| 445 | /// ``` |
| 446 | /// use palette::{SrgbLumaa, LinLumaa}; |
| 447 | /// |
| 448 | /// let encoded = SrgbLumaa::<u8>::from_linear(LinLumaa::new(0.95f32, 0.75)); |
| 449 | /// ``` |
| 450 | /// |
| 451 | /// See the transfer function types in the [`encoding`](crate::encoding) |
| 452 | /// module for details and performance characteristics. |
| 453 | pub fn from_linearrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Alpha<Luma<S, T>, A>`]from_linear().<U, B>(color: Alpharust-analyzer cargo palette 0.7.6 alpha/alpha/Alpha#<Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#<Linearrust-analyzer cargo palette 0.7.6 encoding/linear/Linear#<S::WhitePointrust-analyzer cargo palette 0.7.6 luma/LumaStandard#WhitePoint#>, U>, B>) -> Selfrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Alpha<Luma<S, T>, A>`] |
| 454 | where |
| 455 | S::TransferFnrust-analyzer cargo palette 0.7.6 luma/LumaStandard#TransferFn#: FromLinearrust-analyzer cargo palette 0.7.6 encoding/FromLinear#<U, T>, |
| 456 | A: FromStimulusrust-analyzer cargo palette 0.7.6 stimulus/FromStimulus#<B>, |
| 457 | { |
| 458 | Alpharust-analyzer cargo palette 0.7.6 alpha/alpha/Alpha# { |
| 459 | colorrust-analyzer cargo palette 0.7.6 alpha/alpha/Alpha#color.: Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#::from_linearrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Luma<S, T>`]from_linear().(color.colorrust-analyzer cargo palette 0.7.6 alpha/alpha/Alpha#color.), |
| 460 | alpharust-analyzer cargo palette 0.7.6 alpha/alpha/Alpha#alpha.: A::from_stimulusrust-analyzer cargo palette 0.7.6 stimulus/FromStimulus#from_stimulus().(color.alpharust-analyzer cargo palette 0.7.6 alpha/alpha/Alpha#alpha.), |
| 461 | } |
| 462 | } |
| 463 | } |
| 464 | |
| 465 | impl<Wp, T, A> Alpharust-analyzer cargo palette 0.7.6 alpha/alpha/Alpha#<Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#<Linearrust-analyzer cargo palette 0.7.6 encoding/linear/Linear#<Wp>, T>, A> { |
| 466 | /// Convert a linear color to a different encoding with transparency. |
| 467 | /// |
| 468 | /// Some transfer functions allow the component type to be converted at the |
| 469 | /// same time. This is usually offered with increased performance, compared |
| 470 | /// to using [`into_format`][Luma::into_format]. |
| 471 | /// |
| 472 | /// ``` |
| 473 | /// use palette::{SrgbLumaa, LinLumaa}; |
| 474 | /// |
| 475 | /// let encoded: SrgbLumaa<u8> = LinLumaa::new(0.95f32, 0.75).into_encoding(); |
| 476 | /// ``` |
| 477 | /// |
| 478 | /// See the transfer function types in the [`encoding`](crate::encoding) |
| 479 | /// module for details and performance characteristics. |
| 480 | pub fn into_encodingrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Alpha<Luma<Linear<Wp>, T>, A>`]into_encoding().<U, B, St>(self) -> Alpharust-analyzer cargo palette 0.7.6 alpha/alpha/Alpha#<Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#<St, U>, B> |
| 481 | where |
| 482 | St: LumaStandardrust-analyzer cargo palette 0.7.6 luma/LumaStandard#<WhitePointrust-analyzer cargo palette 0.7.6 luma/LumaStandard#WhitePoint# = Wp>, |
| 483 | St::TransferFnrust-analyzer cargo palette 0.7.6 luma/LumaStandard#TransferFn#: FromLinearrust-analyzer cargo palette 0.7.6 encoding/FromLinear#<T, U>, |
| 484 | B: FromStimulusrust-analyzer cargo palette 0.7.6 stimulus/FromStimulus#<A>, |
| 485 | { |
| 486 | Alpharust-analyzer cargo palette 0.7.6 alpha/alpha/Alpha#::<Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#<St, U>, B>::from_linearrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Alpha<Luma<S, T>, A>`]from_linear().(self) |
| 487 | } |
| 488 | |
| 489 | /// Convert to linear luminance from a different encoding with transparency. |
| 490 | /// |
| 491 | /// Some transfer functions allow the component type to be converted at the |
| 492 | /// same time. This is usually offered with increased performance, compared |
| 493 | /// to using [`into_format`][Luma::into_format]. |
| 494 | /// |
| 495 | /// ``` |
| 496 | /// use palette::{SrgbLumaa, LinLumaa}; |
| 497 | /// |
| 498 | /// let linear = LinLumaa::<_, f32>::from_encoding(SrgbLumaa::new(96u8, 38)); |
| 499 | /// ``` |
| 500 | /// |
| 501 | /// See the transfer function types in the [`encoding`](crate::encoding) |
| 502 | /// module for details and performance characteristics. |
| 503 | pub fn from_encodingrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Alpha<Luma<Linear<Wp>, T>, A>`]from_encoding().<U, B, St>(color: Alpharust-analyzer cargo palette 0.7.6 alpha/alpha/Alpha#<Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#<St, U>, B>) -> Selfrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Alpha<Luma<Linear<Wp>, T>, A>`] |
| 504 | where |
| 505 | St: LumaStandardrust-analyzer cargo palette 0.7.6 luma/LumaStandard#<WhitePointrust-analyzer cargo palette 0.7.6 luma/LumaStandard#WhitePoint# = Wp>, |
| 506 | St::TransferFnrust-analyzer cargo palette 0.7.6 luma/LumaStandard#TransferFn#: IntoLinearrust-analyzer cargo palette 0.7.6 encoding/IntoLinear#<T, U>, |
| 507 | A: FromStimulusrust-analyzer cargo palette 0.7.6 stimulus/FromStimulus#<B>, |
| 508 | { |
| 509 | color.into_linearrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Alpha<Luma<S, T>, A>`]into_linear().() |
| 510 | } |
| 511 | } |
| 512 | |
| 513 | impl_reference_component_methodsrust-analyzer cargo palette 0.7.6 macros/reference_component/impl_reference_component_methods!!(Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#<S>, [lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#luma.], standardrust-analyzer cargo palette 0.7.6 luma/luma/Luma#standard.); |
| 514 | impl_struct_of_arrays_methodsrust-analyzer cargo palette 0.7.6 macros/struct_of_arrays/impl_struct_of_arrays_methods!!(Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#<S>, [luma], standardrust-analyzer cargo palette 0.7.6 luma/luma/Luma#standard.); |
| 515 | |
| 516 | impl<S1, S2, T> FromColorUnclampedrust-analyzer cargo palette 0.7.6 convert/from_into_color_unclamped/FromColorUnclamped#<Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#<S2, T>> for Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#<S1, T> |
| 517 | where |
| 518 | S1: LumaStandardrust-analyzer cargo palette 0.7.6 luma/LumaStandard# + 'static, |
| 519 | S2: LumaStandardrust-analyzer cargo palette 0.7.6 luma/LumaStandard#<WhitePointrust-analyzer cargo palette 0.7.6 luma/LumaStandard#WhitePoint# = S1::WhitePointrust-analyzer cargo palette 0.7.6 luma/LumaStandard#WhitePoint#> + 'static, |
| 520 | S1::TransferFnrust-analyzer cargo palette 0.7.6 luma/LumaStandard#TransferFn#: FromLinearrust-analyzer cargo palette 0.7.6 encoding/FromLinear#<T, T>, |
| 521 | S2::TransferFnrust-analyzer cargo palette 0.7.6 luma/LumaStandard#TransferFn#: IntoLinearrust-analyzer cargo palette 0.7.6 encoding/IntoLinear#<T, T>, |
| 522 | { |
| 523 | fn from_color_unclampedrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Luma<S1, T>`][`FromColorUnclamped<Luma<S2, T>>`]from_color_unclamped().(color: Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#<S2, T>) -> Selfrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Luma<S1, T>`][`FromColorUnclamped<Luma<S2, T>>`] { |
| 524 | if TypeIdrust-analyzer cargo core https://github.com/rust-lang/rust/library/core any/TypeId#::ofrust-analyzer cargo core https://github.com/rust-lang/rust/library/core any/impl#[TypeId]of().::<S1>() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core any/impl#[TypeId][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core any/impl#[TypeId][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core any/impl#[TypeId][`PartialEq<Self>`]eq().TypeIdrust-analyzer cargo core https://github.com/rust-lang/rust/library/core any/TypeId#::ofrust-analyzer cargo core https://github.com/rust-lang/rust/library/core any/impl#[TypeId]of().::<S2>() { |
| 525 | color.reinterpret_asrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Luma<S, T>`]reinterpret_as().() |
| 526 | } else { |
| 527 | Selfrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Luma<S1, T>`][`FromColorUnclamped<Luma<S2, T>>`]::from_linearrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Luma<S, T>`]from_linear().(color.into_linearrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Luma<S, T>`]into_linear().().reinterpret_asrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Luma<S, T>`]reinterpret_as().()) |
| 528 | } |
| 529 | } |
| 530 | } |
| 531 | |
| 532 | impl<S, T> FromColorUnclampedrust-analyzer cargo palette 0.7.6 convert/from_into_color_unclamped/FromColorUnclamped#<Xyzrust-analyzer cargo palette 0.7.6 xyz/Xyz#<S::WhitePointrust-analyzer cargo palette 0.7.6 luma/LumaStandard#WhitePoint#, T>> for Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#<S, T> |
| 533 | where |
| 534 | S: LumaStandardrust-analyzer cargo palette 0.7.6 luma/LumaStandard#, |
| 535 | S::TransferFnrust-analyzer cargo palette 0.7.6 luma/LumaStandard#TransferFn#: FromLinearrust-analyzer cargo palette 0.7.6 encoding/FromLinear#<T, T>, |
| 536 | { |
| 537 | fn from_color_unclampedrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Luma<S, T>`][`FromColorUnclamped<Xyz<<S as LumaStandard>::WhitePoint, T>>`]from_color_unclamped().(color: Xyzrust-analyzer cargo palette 0.7.6 xyz/Xyz#<S::WhitePointrust-analyzer cargo palette 0.7.6 luma/LumaStandard#WhitePoint#, T>) -> Selfrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Luma<S, T>`][`FromColorUnclamped<Xyz<<S as LumaStandard>::WhitePoint, T>>`] { |
| 538 | Selfrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Luma<S, T>`][`FromColorUnclamped<Xyz<<S as LumaStandard>::WhitePoint, T>>`]::from_linearrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Luma<S, T>`]from_linear().(Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma# { |
| 539 | lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#luma.: color.yrust-analyzer cargo palette 0.7.6 xyz/Xyz#y., |
| 540 | standardrust-analyzer cargo palette 0.7.6 luma/luma/Luma#standard.: PhantomDatarust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/PhantomData#, |
| 541 | }) |
| 542 | } |
| 543 | } |
| 544 | |
| 545 | impl<S, T> FromColorUnclampedrust-analyzer cargo palette 0.7.6 convert/from_into_color_unclamped/FromColorUnclamped#<Yxyrust-analyzer cargo palette 0.7.6 yxy/Yxy#<S::WhitePointrust-analyzer cargo palette 0.7.6 luma/LumaStandard#WhitePoint#, T>> for Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#<S, T> |
| 546 | where |
| 547 | S: LumaStandardrust-analyzer cargo palette 0.7.6 luma/LumaStandard#, |
| 548 | S::TransferFnrust-analyzer cargo palette 0.7.6 luma/LumaStandard#TransferFn#: FromLinearrust-analyzer cargo palette 0.7.6 encoding/FromLinear#<T, T>, |
| 549 | { |
| 550 | fn from_color_unclampedrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Luma<S, T>`][`FromColorUnclamped<Yxy<<S as LumaStandard>::WhitePoint, T>>`]from_color_unclamped().(color: Yxyrust-analyzer cargo palette 0.7.6 yxy/Yxy#<S::WhitePointrust-analyzer cargo palette 0.7.6 luma/LumaStandard#WhitePoint#, T>) -> Selfrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Luma<S, T>`][`FromColorUnclamped<Yxy<<S as LumaStandard>::WhitePoint, T>>`] { |
| 551 | Selfrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Luma<S, T>`][`FromColorUnclamped<Yxy<<S as LumaStandard>::WhitePoint, T>>`]::from_linearrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Luma<S, T>`]from_linear().(Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma# { |
| 552 | lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#luma.: color.lumarust-analyzer cargo palette 0.7.6 yxy/Yxy#luma., |
| 553 | standardrust-analyzer cargo palette 0.7.6 luma/luma/Luma#standard.: PhantomDatarust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/PhantomData#, |
| 554 | }) |
| 555 | } |
| 556 | } |
| 557 | |
| 558 | impl_tuple_conversionrust-analyzer cargo palette 0.7.6 macros/convert/impl_tuple_conversion!!(Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#<S> as (T)); |
| 559 | |
| 560 | impl_is_within_boundsrust-analyzer cargo palette 0.7.6 macros/clamp/impl_is_within_bounds!! { |
| 561 | Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#<S> { |
| 562 | lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#luma. => [Selfrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Luma<S, T>`][IsWithinBounds]::min_lumarust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Luma<S, T>`]min_luma().(), Selfrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Luma<S, T>`][IsWithinBounds]::max_lumarust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Luma<S, T>`]max_luma().()] |
| 563 | } |
| 564 | where T: Stimulusrust-analyzer cargo palette 0.7.6 stimulus/Stimulus# |
| 565 | } |
| 566 | impl_clamprust-analyzer cargo palette 0.7.6 macros/clamp/impl_clamp!! { |
| 567 | Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#<S> { |
| 568 | lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#luma. => [Selfrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Luma<S, T>`][ClampAssign]::min_lumarust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Luma<S, T>`]min_luma().(), Selfrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Luma<S, T>`][ClampAssign]::max_lumarust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Luma<S, T>`]max_luma().()] |
| 569 | } |
| 570 | other {standardrust-analyzer cargo palette 0.7.6 luma/luma/Luma#standard.} |
| 571 | where T: Stimulusrust-analyzer cargo palette 0.7.6 stimulus/Stimulus# |
| 572 | } |
| 573 | |
| 574 | impl_mixrust-analyzer cargo palette 0.7.6 macros/mix/impl_mix!!(Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#<S>); |
| 575 | impl_lightenrust-analyzer cargo palette 0.7.6 macros/lighten_saturate/impl_lighten!!(Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#<S> increase {luma => [Selfrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Luma<S, T>`][Lighten]::min_lumarust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Luma<S, T>`]min_luma().(), Selfrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Luma<S, T>`][Lighten]::max_lumarust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Luma<S, T>`]max_luma().()]} other {} phantom: standardrust-analyzer cargo palette 0.7.6 luma/luma/Luma#standard. where T: Stimulusrust-analyzer cargo palette 0.7.6 stimulus/Stimulus#); |
| 576 | impl_premultiplyrust-analyzer cargo palette 0.7.6 macros/blend/impl_premultiply!!(Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#<S> {lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#luma.} phantom: standardrust-analyzer cargo palette 0.7.6 luma/luma/Luma#standard.); |
| 577 | impl_euclidean_distancerust-analyzer cargo palette 0.7.6 macros/color_difference/impl_euclidean_distance!!(Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#<S> {lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#luma.}); |
| 578 | |
| 579 | impl<S, T> StimulusColorrust-analyzer cargo palette 0.7.6 stimulus/StimulusColor# for Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#<S, T> where T: Stimulusrust-analyzer cargo palette 0.7.6 stimulus/Stimulus# {} |
| 580 | |
| 581 | impl<S, T> HasBoolMaskrust-analyzer cargo palette 0.7.6 bool_mask/HasBoolMask# for Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#<S, T> |
| 582 | where |
| 583 | T: HasBoolMaskrust-analyzer cargo palette 0.7.6 bool_mask/HasBoolMask#, |
| 584 | { |
| 585 | type Maskrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Luma<S, T>`][HasBoolMask]Mask# = T::Maskrust-analyzer cargo palette 0.7.6 bool_mask/HasBoolMask#Mask#; |
| 586 | } |
| 587 | |
| 588 | impl<S, T> Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default# for Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#<S, T> |
| 589 | where |
| 590 | T: Stimulusrust-analyzer cargo palette 0.7.6 stimulus/Stimulus#, |
| 591 | { |
| 592 | fn defaultrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Luma<S, T>`][Default]default().() -> Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#<S, T> { |
| 593 | Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#::newrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Luma<S, T>`]new().(Selfrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Luma<S, T>`][Default]::min_lumarust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Luma<S, T>`]min_luma().()) |
| 594 | } |
| 595 | } |
| 596 | |
| 597 | impl_color_addrust-analyzer cargo palette 0.7.6 macros/arithmetics/impl_color_add!!(Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#<S>, [lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#luma.], standardrust-analyzer cargo palette 0.7.6 luma/luma/Luma#standard.); |
| 598 | impl_color_subrust-analyzer cargo palette 0.7.6 macros/arithmetics/impl_color_sub!!(Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#<S>, [lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#luma.], standardrust-analyzer cargo palette 0.7.6 luma/luma/Luma#standard.); |
| 599 | impl_color_mulrust-analyzer cargo palette 0.7.6 macros/arithmetics/impl_color_mul!!(Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#<S>, [lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#luma.], standardrust-analyzer cargo palette 0.7.6 luma/luma/Luma#standard.); |
| 600 | impl_color_divrust-analyzer cargo palette 0.7.6 macros/arithmetics/impl_color_div!!(Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#<S>, [lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#luma.], standardrust-analyzer cargo palette 0.7.6 luma/luma/Luma#standard.); |
| 601 | |
| 602 | impl_array_castsrust-analyzer cargo palette 0.7.6 macros/casting/impl_array_casts!!(Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#<S, T>, [T; 1]); |
| 603 | |
| 604 | impl<S, T> AsRefrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/AsRef#<T> for Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#<S, T> { |
| 605 | #[inline] |
| 606 | fn as_refrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Luma<S, T>`][`AsRef<T>`]as_ref().(&self) -> &T { |
| 607 | &self.lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#luma. |
| 608 | } |
| 609 | } |
| 610 | |
| 611 | impl<S, T> AsMutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/AsMut#<T> for Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#<S, T> { |
| 612 | #[inline] |
| 613 | fn as_mutrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Luma<S, T>`][`AsMut<T>`]as_mut().(&mut self) -> &mut T { |
| 614 | &mut self.lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#luma. |
| 615 | } |
| 616 | } |
| 617 | |
| 618 | impl<S, T> Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<T> for Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#<S, T> { |
| 619 | #[inline] |
| 620 | fn fromrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Luma<S, T>`][`From<T>`]from().(luma: T) -> Selfrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Luma<S, T>`][`From<T>`] { |
| 621 | Selfrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Luma<S, T>`][`From<T>`]::newrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Luma<S, T>`]new().(luma) |
| 622 | } |
| 623 | } |
| 624 | |
| 625 | macro_rules! impl_luma_cast_otherrust-analyzer cargo palette 0.7.6 luma/luma/impl_luma_cast_other! { |
| 626 | ($($other: ty),+) => { |
| 627 | $( |
| 628 | impl<'a, S> From<&'a $other> for &'a Luma<S, $other> |
| 629 | where |
| 630 | $other: AsRef<Luma<S, $other>>, |
| 631 | { |
| 632 | #[inline] |
| 633 | fn from(luma: &'a $other) -> Self { |
| 634 | luma.as_ref() |
| 635 | } |
| 636 | } |
| 637 | |
| 638 | impl<'a, S> From<&'a mut $other> for &'a mut Luma<S, $other> |
| 639 | where |
| 640 | $other: AsMut<Luma<S, $other>>, |
| 641 | { |
| 642 | #[inline] |
| 643 | fn from(luma: &'a mut $other) -> Self { |
| 644 | luma.as_mut() |
| 645 | } |
| 646 | } |
| 647 | |
| 648 | impl<S> AsRef<Luma<S, $other>> for $other { |
| 649 | #[inline] |
| 650 | fn as_ref(&self) -> &Luma<S, $other> { |
| 651 | core::slice::from_ref(self).try_into().unwrap() |
| 652 | } |
| 653 | } |
| 654 | |
| 655 | impl<S> AsMut<Luma<S, $other>> for $other { |
| 656 | #[inline] |
| 657 | fn as_mut(&mut self) -> &mut Luma<S, $other> { |
| 658 | core::slice::from_mut(self).try_into().unwrap() |
| 659 | } |
| 660 | } |
| 661 | |
| 662 | impl<S> From<Luma<S, $other>> for $other { |
| 663 | #[inline] |
| 664 | fn from(color: Luma<S, $other>) -> Self { |
| 665 | color.luma |
| 666 | } |
| 667 | } |
| 668 | |
| 669 | impl<'a, S> From<&'a Luma<S, $other>> for &'a $other { |
| 670 | #[inline] |
| 671 | fn from(color: &'a Luma<S, $other>) -> Self { |
| 672 | color.as_ref() |
| 673 | } |
| 674 | } |
| 675 | |
| 676 | impl<'a, S> From<&'a mut Luma<S, $other>> for &'a mut $other { |
| 677 | #[inline] |
| 678 | fn from(color: &'a mut Luma<S, $other>) -> Self { |
| 679 | color.as_mut() |
| 680 | } |
| 681 | } |
| 682 | )+ |
| 683 | }; |
| 684 | } |
| 685 | impl_luma_cast_otherrust-analyzer cargo palette 0.7.6 luma/luma/impl_luma_cast_other!!(u8, u16, u32, u64, u128, f32, f64); |
| 686 | |
| 687 | impl<S, T, P, O> Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#<S, T>> for Packedrust-analyzer cargo palette 0.7.6 cast/packed/Packed#<O, P> |
| 688 | where |
| 689 | O: ComponentOrderrust-analyzer cargo palette 0.7.6 cast/packed/ComponentOrder#<Lumaarust-analyzer cargo palette 0.7.6 luma/luma/Lumaa#<S, T>, P>, |
| 690 | Lumaarust-analyzer cargo palette 0.7.6 luma/luma/Lumaa#<S, T>: Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#<S, T>>, |
| 691 | { |
| 692 | #[inline] |
| 693 | fn fromrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Packed<O, P>`][`From<Luma<S, T>>`]from().(color: Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#<S, T>) -> Selfrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Packed<O, P>`][`From<Luma<S, T>>`] { |
| 694 | Selfrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Packed<O, P>`][`From<Luma<S, T>>`]::fromrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Packed<O, P>`][`From<Alpha<Luma<S, T>, T>>`]from().(Lumaarust-analyzer cargo palette 0.7.6 luma/luma/Lumaa#::fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#from().(color)) |
| 695 | } |
| 696 | } |
| 697 | |
| 698 | impl<S, T, O, P> Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<Lumaarust-analyzer cargo palette 0.7.6 luma/luma/Lumaa#<S, T>> for Packedrust-analyzer cargo palette 0.7.6 cast/packed/Packed#<O, P> |
| 699 | where |
| 700 | O: ComponentOrderrust-analyzer cargo palette 0.7.6 cast/packed/ComponentOrder#<Lumaarust-analyzer cargo palette 0.7.6 luma/luma/Lumaa#<S, T>, P>, |
| 701 | { |
| 702 | #[inline] |
| 703 | fn fromrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Packed<O, P>`][`From<Alpha<Luma<S, T>, T>>`]from().(color: Lumaarust-analyzer cargo palette 0.7.6 luma/luma/Lumaa#<S, T>) -> Selfrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Packed<O, P>`][`From<Alpha<Luma<S, T>, T>>`] { |
| 704 | Packedrust-analyzer cargo palette 0.7.6 cast/packed/Packed#::packrust-analyzer cargo palette 0.7.6 cast/packed/impl#[`Packed<O, P>`]pack().(color) |
| 705 | } |
| 706 | } |
| 707 | |
| 708 | impl<S, O, P> Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<Packedrust-analyzer cargo palette 0.7.6 cast/packed/Packed#<O, P>> for Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#<S, u8> |
| 709 | where |
| 710 | O: ComponentOrderrust-analyzer cargo palette 0.7.6 cast/packed/ComponentOrder#<Lumaarust-analyzer cargo palette 0.7.6 luma/luma/Lumaa#<S, u8>, P>, |
| 711 | { |
| 712 | #[inline] |
| 713 | fn fromrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Luma<S, u8>`][`From<Packed<O, P>>`]from().(packed: Packedrust-analyzer cargo palette 0.7.6 cast/packed/Packed#<O, P>) -> Selfrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Luma<S, u8>`][`From<Packed<O, P>>`] { |
| 714 | Lumaarust-analyzer cargo palette 0.7.6 luma/luma/Lumaa#::fromrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Alpha<Luma<S, T>, T>`][`From<Packed<O, P>>`]from().(packed).colorrust-analyzer cargo palette 0.7.6 alpha/alpha/Alpha#color. |
| 715 | } |
| 716 | } |
| 717 | |
| 718 | impl<S, T, O, P> Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<Packedrust-analyzer cargo palette 0.7.6 cast/packed/Packed#<O, P>> for Lumaarust-analyzer cargo palette 0.7.6 luma/luma/Lumaa#<S, T> |
| 719 | where |
| 720 | O: ComponentOrderrust-analyzer cargo palette 0.7.6 cast/packed/ComponentOrder#<Lumaarust-analyzer cargo palette 0.7.6 luma/luma/Lumaa#<S, T>, P>, |
| 721 | { |
| 722 | #[inline] |
| 723 | fn fromrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Alpha<Luma<S, T>, T>`][`From<Packed<O, P>>`]from().(packed: Packedrust-analyzer cargo palette 0.7.6 cast/packed/Packed#<O, P>) -> Selfrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Alpha<Luma<S, T>, T>`][`From<Packed<O, P>>`] { |
| 724 | packed.unpackrust-analyzer cargo palette 0.7.6 cast/packed/impl#[`Packed<O, P>`]unpack().() |
| 725 | } |
| 726 | } |
| 727 | |
| 728 | impl<S> Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<u16> for Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#<S, u8> { |
| 729 | #[inline] |
| 730 | fn fromrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Luma<S, u8>`][`From<u16>`]from().(color: u16) -> Selfrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Luma<S, u8>`][`From<u16>`] { |
| 731 | Selfrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Luma<S, u8>`][`From<u16>`]::from_u16rust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Luma<S, u8>`]from_u16().::<superrust-analyzer cargo palette 0.7.6 luma/::channelsrust-analyzer cargo palette 0.7.6 luma/channels/::Alrust-analyzer cargo palette 0.7.6 luma/channels/Al#>(color) |
| 732 | } |
| 733 | } |
| 734 | |
| 735 | impl<S> Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<u16> for Lumaarust-analyzer cargo palette 0.7.6 luma/luma/Lumaa#<S, u8> { |
| 736 | #[inline] |
| 737 | fn fromrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Alpha<Luma<S, u8>, u8>`][`From<u16>`]from().(color: u16) -> Selfrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Alpha<Luma<S, u8>, u8>`][`From<u16>`] { |
| 738 | Selfrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Alpha<Luma<S, u8>, u8>`][`From<u16>`]::from_u16rust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Alpha<Luma<S, u8>, u8>`]from_u16().::<superrust-analyzer cargo palette 0.7.6 luma/::channelsrust-analyzer cargo palette 0.7.6 luma/channels/::Larust-analyzer cargo palette 0.7.6 luma/channels/La#>(color) |
| 739 | } |
| 740 | } |
| 741 | |
| 742 | impl<S> Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#<S, u8>> for u16 { |
| 743 | #[inline] |
| 744 | fn fromrust-analyzer cargo palette 0.7.6 luma/luma/impl#[u16][`From<Luma<S, u8>>`]from().(color: Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#<S, u8>) -> Selfrust-analyzer cargo palette 0.7.6 luma/luma/impl#[u16][`From<Luma<S, u8>>`] { |
| 745 | Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#::into_u16rust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Luma<S, u8>`]into_u16().::<superrust-analyzer cargo palette 0.7.6 luma/::channelsrust-analyzer cargo palette 0.7.6 luma/channels/::Alrust-analyzer cargo palette 0.7.6 luma/channels/Al#>(color) |
| 746 | } |
| 747 | } |
| 748 | |
| 749 | impl<S> Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<Lumaarust-analyzer cargo palette 0.7.6 luma/luma/Lumaa#<S, u8>> for u16 { |
| 750 | #[inline] |
| 751 | fn fromrust-analyzer cargo palette 0.7.6 luma/luma/impl#[u16][`From<Alpha<Luma<S, u8>, u8>>`]from().(color: Lumaarust-analyzer cargo palette 0.7.6 luma/luma/Lumaa#<S, u8>) -> Selfrust-analyzer cargo palette 0.7.6 luma/luma/impl#[u16][`From<Alpha<Luma<S, u8>, u8>>`] { |
| 752 | Lumaarust-analyzer cargo palette 0.7.6 luma/luma/Lumaa#::into_u16rust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Alpha<Luma<S, u8>, u8>`]into_u16().::<superrust-analyzer cargo palette 0.7.6 luma/::channelsrust-analyzer cargo palette 0.7.6 luma/channels/::Larust-analyzer cargo palette 0.7.6 luma/channels/La#>(color) |
| 753 | } |
| 754 | } |
| 755 | |
| 756 | impl_simd_array_conversionrust-analyzer cargo palette 0.7.6 macros/simd/impl_simd_array_conversion!!(Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#<S>, [luma], standardrust-analyzer cargo palette 0.7.6 luma/luma/Luma#standard.); |
| 757 | impl_struct_of_array_traitsrust-analyzer cargo palette 0.7.6 macros/struct_of_arrays/impl_struct_of_array_traits!!(Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#<S>, [lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#luma.], standardrust-analyzer cargo palette 0.7.6 luma/luma/Luma#standard.); |
| 758 | |
| 759 | impl_copy_clonerust-analyzer cargo palette 0.7.6 macros/copy_clone/impl_copy_clone!!(Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#<S>, [lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#luma.], standardrust-analyzer cargo palette 0.7.6 luma/luma/Luma#standard.); |
| 760 | impl_eqrust-analyzer cargo palette 0.7.6 macros/equality/impl_eq!!(Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#<S>, [lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#luma.]); |
| 761 | |
| 762 | impl<S, T> fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::LowerHexrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/LowerHex# for Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#<S, T> |
| 763 | where |
| 764 | T: fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::LowerHexrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/LowerHex#, |
| 765 | { |
| 766 | fn fmtrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Luma<S, T>`][LowerHex]fmt().(&self, f: &mut fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#) -> fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# { |
| 767 | let size = f.widthrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]width().().unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap_or().(::corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::size_ofrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/size_of().::<T>() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().2); |
| 768 | writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(f, "{:0width$x}", self.lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#luma., width = size) |
| 769 | } |
| 770 | } |
| 771 | |
| 772 | impl<S, T> fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::UpperHexrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/UpperHex# for Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#<S, T> |
| 773 | where |
| 774 | T: fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::UpperHexrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/UpperHex#, |
| 775 | { |
| 776 | fn fmtrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Luma<S, T>`][UpperHex]fmt().(&self, f: &mut fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#) -> fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# { |
| 777 | let size = f.widthrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]width().().unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap_or().(::corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::size_ofrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/size_of().::<T>() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().2); |
| 778 | writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(f, "{:0width$X}", self.lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#luma., width = size) |
| 779 | } |
| 780 | } |
| 781 | |
| 782 | #[allow(deprecated)] |
| 783 | impl<S, T> craterust-analyzer cargo palette 0.7.6 crate/::RelativeContrastrust-analyzer cargo palette 0.7.6 relative_contrast/RelativeContrast# for Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#<S, T> |
| 784 | where |
| 785 | T: Realrust-analyzer cargo palette 0.7.6 num/Real# + Arithmeticsrust-analyzer cargo palette 0.7.6 num/Arithmetics# + PartialCmprust-analyzer cargo palette 0.7.6 num/PartialCmp#, |
| 786 | T::Maskrust-analyzer cargo palette 0.7.6 bool_mask/HasBoolMask#Mask#: LazySelectrust-analyzer cargo palette 0.7.6 bool_mask/LazySelect#<T>, |
| 787 | S: LumaStandardrust-analyzer cargo palette 0.7.6 luma/LumaStandard#, |
| 788 | S::TransferFnrust-analyzer cargo palette 0.7.6 luma/LumaStandard#TransferFn#: IntoLinearrust-analyzer cargo palette 0.7.6 encoding/IntoLinear#<T, T>, |
| 789 | { |
| 790 | type Scalarrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Luma<S, T>`][RelativeContrast]Scalar# = T; |
| 791 | |
| 792 | #[inline] |
| 793 | fn get_contrast_ratiorust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Luma<S, T>`][RelativeContrast]get_contrast_ratio().(self, other: Selfrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Luma<S, T>`][RelativeContrast]) -> T { |
| 794 | let luma1 = self.into_linearrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Luma<S, T>`]into_linear().(); |
| 795 | let luma2 = other.into_linearrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Luma<S, T>`]into_linear().(); |
| 796 | |
| 797 | craterust-analyzer cargo palette 0.7.6 crate/::contrast_ratiorust-analyzer cargo palette 0.7.6 relative_contrast/contrast_ratio().(luma1.lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#luma., luma2.lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#luma.) |
| 798 | } |
| 799 | } |
| 800 | |
| 801 | impl<S, T> Wcag21RelativeContrastrust-analyzer cargo palette 0.7.6 color_difference/Wcag21RelativeContrast# for Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#<S, T> |
| 802 | where |
| 803 | Selfrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Luma<S, T>`][Wcag21RelativeContrast]: IntoColorrust-analyzer cargo palette 0.7.6 convert/from_into_color/IntoColor#<Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#<Linearrust-analyzer cargo palette 0.7.6 encoding/linear/Linear#<D65rust-analyzer cargo palette 0.7.6 white_point/D65#>, T>>, |
| 804 | S: LumaStandardrust-analyzer cargo palette 0.7.6 luma/LumaStandard#<WhitePointrust-analyzer cargo palette 0.7.6 luma/LumaStandard#WhitePoint# = D65rust-analyzer cargo palette 0.7.6 white_point/D65#>, |
| 805 | T: Realrust-analyzer cargo palette 0.7.6 num/Real# + Addrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#<T, Outputrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/Add#Output# = T> + 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> + PartialCmprust-analyzer cargo palette 0.7.6 num/PartialCmp# + MinMaxrust-analyzer cargo palette 0.7.6 num/MinMax#, |
| 806 | { |
| 807 | type Scalarrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Luma<S, T>`][Wcag21RelativeContrast]Scalar# = T; |
| 808 | |
| 809 | fn relative_luminancerust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Luma<S, T>`][Wcag21RelativeContrast]relative_luminance().(self) -> Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#<Linearrust-analyzer cargo palette 0.7.6 encoding/linear/Linear#<D65rust-analyzer cargo palette 0.7.6 white_point/D65#>, Selfrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Luma<S, T>`][Wcag21RelativeContrast]::Scalarrust-analyzer cargo palette 0.7.6 color_difference/Wcag21RelativeContrast#Scalar#> { |
| 810 | self.into_colorrust-analyzer cargo palette 0.7.6 convert/from_into_color/IntoColor#into_color().() |
| 811 | } |
| 812 | } |
| 813 | |
| 814 | impl_rand_traits_cartesianrust-analyzer cargo palette 0.7.6 macros/random/impl_rand_traits_cartesian!!(UniformLumarust-analyzer cargo palette 0.7.6 luma/luma/UniformLuma#, Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#<S> {lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#luma.} phantom: standardrust-analyzer cargo palette 0.7.6 luma/luma/Luma#standard.: PhantomData<S>); |
| 815 | |
| 816 | #[cfg(feature = "bytemuck")] |
| 817 | unsafe impl<S, T> bytemuckrust-analyzer cargo bytemuck 1.25.2 crate/::Zeroablerust-analyzer cargo bytemuck 1.25.2 zeroable/Zeroable# for Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#<S, T> where T: bytemuckrust-analyzer cargo bytemuck 1.25.2 crate/::Zeroablerust-analyzer cargo bytemuck 1.25.2 zeroable/Zeroable# {} |
| 818 | |
| 819 | #[cfg(feature = "bytemuck")] |
| 820 | unsafe impl<S: 'static, T> bytemuckrust-analyzer cargo bytemuck 1.25.2 crate/::Podrust-analyzer cargo bytemuck 1.25.2 pod/Pod# for Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#<S, T> where T: bytemuckrust-analyzer cargo bytemuck 1.25.2 crate/::Podrust-analyzer cargo bytemuck 1.25.2 pod/Pod# {} |
| 821 | |
| 822 | #[cfg(test)] |
| 823 | mod testrust-analyzer cargo palette 0.7.6 luma/luma/test/ { |
| 824 | use craterust-analyzer cargo palette 0.7.6 crate/::encodingrust-analyzer cargo palette 0.7.6 encoding/::Srgbrust-analyzer cargo palette 0.7.6 encoding/srgb/Srgb#; |
| 825 | use craterust-analyzer cargo palette 0.7.6 crate/::Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#; |
| 826 | |
| 827 | test_convert_into_from_xyzrust-analyzer cargo palette 0.7.6 macros/convert/test_convert_into_from_xyz!!(Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#); |
| 828 | |
| 829 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 830 | fn rangesrust-analyzer cargo palette 0.7.6 luma/luma/test/ranges().() { |
| 831 | assert_rangesrust-analyzer cargo palette 0.7.6 macros/clamp/assert_ranges!! { |
| 832 | Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#<Srgbrust-analyzer cargo palette 0.7.6 encoding/srgb/Srgb#, f64>; |
| 833 | clamped { |
| 834 | luma: 0.0 => 1.0 |
| 835 | } |
| 836 | clamped_min {} |
| 837 | unclamped {} |
| 838 | } |
| 839 | } |
| 840 | |
| 841 | raw_pixel_conversion_testsrust-analyzer cargo palette 0.7.6 macros/casting/raw_pixel_conversion_tests!!(Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#<Srgbrust-analyzer cargo palette 0.7.6 encoding/srgb/Srgb#>: luma); |
| 842 | |
| 843 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 844 | fn lower_hexrust-analyzer cargo palette 0.7.6 luma/luma/test/lower_hex().() { |
| 845 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("{:x}", Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#::<Srgbrust-analyzer cargo palette 0.7.6 encoding/srgb/Srgb#, u8>::newrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Luma<S, T>`]new().(161)), "a1"); |
| 846 | } |
| 847 | |
| 848 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 849 | fn lower_hex_small_numbersrust-analyzer cargo palette 0.7.6 luma/luma/test/lower_hex_small_numbers().() { |
| 850 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("{:x}", Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#::<Srgbrust-analyzer cargo palette 0.7.6 encoding/srgb/Srgb#, u8>::newrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Luma<S, T>`]new().(1)), "01"); |
| 851 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("{:x}", Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#::<Srgbrust-analyzer cargo palette 0.7.6 encoding/srgb/Srgb#, u16>::newrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Luma<S, T>`]new().(1)), "0001"); |
| 852 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("{:x}", Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#::<Srgbrust-analyzer cargo palette 0.7.6 encoding/srgb/Srgb#, u32>::newrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Luma<S, T>`]new().(1)), "00000001"); |
| 853 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 854 | formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("{:x}", Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#::<Srgbrust-analyzer cargo palette 0.7.6 encoding/srgb/Srgb#, u64>::newrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Luma<S, T>`]new().(1)), |
| 855 | "0000000000000001" |
| 856 | ); |
| 857 | } |
| 858 | |
| 859 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 860 | fn lower_hex_custom_widthrust-analyzer cargo palette 0.7.6 luma/luma/test/lower_hex_custom_width().() { |
| 861 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("{:03x}", Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#::<Srgbrust-analyzer cargo palette 0.7.6 encoding/srgb/Srgb#, u8>::newrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Luma<S, T>`]new().(1)), "001"); |
| 862 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("{:03x}", Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#::<Srgbrust-analyzer cargo palette 0.7.6 encoding/srgb/Srgb#, u16>::newrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Luma<S, T>`]new().(1)), "001"); |
| 863 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("{:03x}", Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#::<Srgbrust-analyzer cargo palette 0.7.6 encoding/srgb/Srgb#, u32>::newrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Luma<S, T>`]new().(1)), "001"); |
| 864 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("{:03x}", Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#::<Srgbrust-analyzer cargo palette 0.7.6 encoding/srgb/Srgb#, u64>::newrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Luma<S, T>`]new().(1)), "001"); |
| 865 | } |
| 866 | |
| 867 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 868 | fn upper_hexrust-analyzer cargo palette 0.7.6 luma/luma/test/upper_hex().() { |
| 869 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("{:X}", Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#::<Srgbrust-analyzer cargo palette 0.7.6 encoding/srgb/Srgb#, u8>::newrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Luma<S, T>`]new().(161)), "A1"); |
| 870 | } |
| 871 | |
| 872 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 873 | fn upper_hex_small_numbersrust-analyzer cargo palette 0.7.6 luma/luma/test/upper_hex_small_numbers().() { |
| 874 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("{:X}", Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#::<Srgbrust-analyzer cargo palette 0.7.6 encoding/srgb/Srgb#, u8>::newrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Luma<S, T>`]new().(1)), "01"); |
| 875 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("{:X}", Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#::<Srgbrust-analyzer cargo palette 0.7.6 encoding/srgb/Srgb#, u16>::newrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Luma<S, T>`]new().(1)), "0001"); |
| 876 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("{:X}", Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#::<Srgbrust-analyzer cargo palette 0.7.6 encoding/srgb/Srgb#, u32>::newrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Luma<S, T>`]new().(1)), "00000001"); |
| 877 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 878 | formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("{:X}", Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#::<Srgbrust-analyzer cargo palette 0.7.6 encoding/srgb/Srgb#, u64>::newrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Luma<S, T>`]new().(1)), |
| 879 | "0000000000000001" |
| 880 | ); |
| 881 | } |
| 882 | |
| 883 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 884 | fn upper_hex_custom_widthrust-analyzer cargo palette 0.7.6 luma/luma/test/upper_hex_custom_width().() { |
| 885 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("{:03X}", Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#::<Srgbrust-analyzer cargo palette 0.7.6 encoding/srgb/Srgb#, u8>::newrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Luma<S, T>`]new().(1)), "001"); |
| 886 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("{:03X}", Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#::<Srgbrust-analyzer cargo palette 0.7.6 encoding/srgb/Srgb#, u16>::newrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Luma<S, T>`]new().(1)), "001"); |
| 887 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("{:03X}", Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#::<Srgbrust-analyzer cargo palette 0.7.6 encoding/srgb/Srgb#, u32>::newrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Luma<S, T>`]new().(1)), "001"); |
| 888 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("{:03X}", Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#::<Srgbrust-analyzer cargo palette 0.7.6 encoding/srgb/Srgb#, u64>::newrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Luma<S, T>`]new().(1)), "001"); |
| 889 | } |
| 890 | |
| 891 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 892 | fn check_min_max_componentsrust-analyzer cargo palette 0.7.6 luma/luma/test/check_min_max_components().() { |
| 893 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#::<Srgbrust-analyzer cargo palette 0.7.6 encoding/srgb/Srgb#, f32>::min_lumarust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Luma<S, T>`]min_luma().(), 0.0); |
| 894 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#::<Srgbrust-analyzer cargo palette 0.7.6 encoding/srgb/Srgb#, f32>::max_lumarust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Luma<S, T>`]max_luma().(), 1.0); |
| 895 | } |
| 896 | |
| 897 | struct_of_arrays_testsrust-analyzer cargo palette 0.7.6 macros/struct_of_arrays/struct_of_arrays_tests!!( |
| 898 | Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#<Srgbrust-analyzer cargo palette 0.7.6 encoding/srgb/Srgb#>[lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#luma.] phantom: standardrust-analyzer cargo palette 0.7.6 luma/luma/Luma#standard., |
| 899 | superrust-analyzer cargo palette 0.7.6 luma/luma/::Lumaarust-analyzer cargo palette 0.7.6 luma/luma/Lumaa#::newrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Alpha<Luma<S, T>, A>`]new().(0.1f32, 0.4), |
| 900 | superrust-analyzer cargo palette 0.7.6 luma/luma/::Lumaarust-analyzer cargo palette 0.7.6 luma/luma/Lumaa#::newrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Alpha<Luma<S, T>, A>`]new().(0.2, 0.5), |
| 901 | superrust-analyzer cargo palette 0.7.6 luma/luma/::Lumaarust-analyzer cargo palette 0.7.6 luma/luma/Lumaa#::newrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Alpha<Luma<S, T>, A>`]new().(0.3, 0.6) |
| 902 | ); |
| 903 | |
| 904 | #[cfg(feature = "serializing")] |
| 905 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 906 | fn serializerust-analyzer cargo palette 0.7.6 luma/luma/test/serialize().() { |
| 907 | let serialized = ::serde_jsonrust-analyzer cargo serde_json 1.0.116 crate/::to_stringrust-analyzer cargo serde_json 1.0.116 ser/to_string().(&Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#::<Srgbrust-analyzer cargo palette 0.7.6 encoding/srgb/Srgb#>::newrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Luma<S, T>`]new().(0.3)).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 908 | |
| 909 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(serialized, r#"{"luma":0.3}"#); |
| 910 | } |
| 911 | |
| 912 | #[cfg(feature = "serializing")] |
| 913 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 914 | fn deserializerust-analyzer cargo palette 0.7.6 luma/luma/test/deserialize().() { |
| 915 | let deserialized: Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#<Srgbrust-analyzer cargo palette 0.7.6 encoding/srgb/Srgb#> = ::serde_jsonrust-analyzer cargo serde_json 1.0.116 crate/::from_strrust-analyzer cargo serde_json 1.0.116 de/from_str().(r#"{"luma":0.3}"#).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 916 | |
| 917 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(deserialized, Lumarust-analyzer cargo palette 0.7.6 luma/luma/Luma#::<Srgbrust-analyzer cargo palette 0.7.6 encoding/srgb/Srgb#>::newrust-analyzer cargo palette 0.7.6 luma/luma/impl#[`Luma<S, T>`]new().(0.3)); |
| 918 | } |
| 919 | |
| 920 | test_uniform_distributionrust-analyzer cargo palette 0.7.6 macros/random/test_uniform_distribution!! { |
| 921 | Luma<Srgb, f32> { |
| 922 | luma: (0.0, 1.0) |
| 923 | }, |
| 924 | min: Luma::new(0.0f32), |
| 925 | max: Luma::new(1.0) |
| 926 | } |
| 927 | } |