| 1 | //! Channel orders for packed RGBA types. |
| 2 | |
| 3 | use craterust-analyzer cargo palette 0.7.6 crate/::{castrust-analyzer cargo palette 0.7.6 cast/::ComponentOrderrust-analyzer cargo palette 0.7.6 cast/packed/ComponentOrder#, rgbrust-analyzer cargo palette 0.7.6 rgb/}; |
| 4 | |
| 5 | /// RGBA color packed in ABGR order. |
| 6 | /// |
| 7 | /// See [Packed](crate::cast::Packed) for more details. |
| 8 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy:, Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:)] |
| 9 | pub struct Abgrrust-analyzer cargo palette 0.7.6 rgb/channels/Abgr#; |
| 10 | |
| 11 | impl<S, T> ComponentOrderrust-analyzer cargo palette 0.7.6 cast/packed/ComponentOrder#<rgbrust-analyzer cargo palette 0.7.6 rgb/::Rgbarust-analyzer cargo palette 0.7.6 rgb/rgb/Rgba#<S, T>, [T; 4]> for Abgrrust-analyzer cargo palette 0.7.6 rgb/channels/Abgr# { |
| 12 | #[inline] |
| 13 | fn packrust-analyzer cargo palette 0.7.6 rgb/channels/impl#[Abgr][`ComponentOrder<crate::Alpha<rgb::Rgb<S, T>, T>, [T; 4]>`]pack().(color: rgbrust-analyzer cargo palette 0.7.6 rgb/::Rgbarust-analyzer cargo palette 0.7.6 rgb/rgb/Rgba#<S, T>) -> [T; 4] { |
| 14 | let [red, green, blue, alpha]: [T; 4] = color.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(); |
| 15 | [alpha, blue, green, red] |
| 16 | } |
| 17 | |
| 18 | #[inline] |
| 19 | fn unpackrust-analyzer cargo palette 0.7.6 rgb/channels/impl#[Abgr][`ComponentOrder<crate::Alpha<rgb::Rgb<S, T>, T>, [T; 4]>`]unpack().(packed: [T; 4]) -> rgbrust-analyzer cargo palette 0.7.6 rgb/::Rgbarust-analyzer cargo palette 0.7.6 rgb/rgb/Rgba#<S, T> { |
| 20 | let [alpha, blue, green, red] = packed; |
| 21 | rgbrust-analyzer cargo palette 0.7.6 rgb/::Rgbarust-analyzer cargo palette 0.7.6 rgb/rgb/Rgba#::newrust-analyzer cargo palette 0.7.6 rgb/rgb/impl#[`Alpha<Rgb<S, T>, A>`]new().(red, green, blue, alpha) |
| 22 | } |
| 23 | } |
| 24 | |
| 25 | /// RGBA color packed in ARGB order. |
| 26 | /// |
| 27 | /// See [Packed](crate::cast::Packed) for more details. |
| 28 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy:, Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:)] |
| 29 | pub struct Argbrust-analyzer cargo palette 0.7.6 rgb/channels/Argb#; |
| 30 | |
| 31 | impl<S, T> ComponentOrderrust-analyzer cargo palette 0.7.6 cast/packed/ComponentOrder#<rgbrust-analyzer cargo palette 0.7.6 rgb/::Rgbarust-analyzer cargo palette 0.7.6 rgb/rgb/Rgba#<S, T>, [T; 4]> for Argbrust-analyzer cargo palette 0.7.6 rgb/channels/Argb# { |
| 32 | #[inline] |
| 33 | fn packrust-analyzer cargo palette 0.7.6 rgb/channels/impl#[Argb][`ComponentOrder<crate::Alpha<rgb::Rgb<S, T>, T>, [T; 4]>`]pack().(color: rgbrust-analyzer cargo palette 0.7.6 rgb/::Rgbarust-analyzer cargo palette 0.7.6 rgb/rgb/Rgba#<S, T>) -> [T; 4] { |
| 34 | let [red, green, blue, alpha]: [T; 4] = color.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(); |
| 35 | [alpha, red, green, blue] |
| 36 | } |
| 37 | |
| 38 | #[inline] |
| 39 | fn unpackrust-analyzer cargo palette 0.7.6 rgb/channels/impl#[Argb][`ComponentOrder<crate::Alpha<rgb::Rgb<S, T>, T>, [T; 4]>`]unpack().(packed: [T; 4]) -> rgbrust-analyzer cargo palette 0.7.6 rgb/::Rgbarust-analyzer cargo palette 0.7.6 rgb/rgb/Rgba#<S, T> { |
| 40 | let [alpha, red, green, blue] = packed; |
| 41 | rgbrust-analyzer cargo palette 0.7.6 rgb/::Rgbarust-analyzer cargo palette 0.7.6 rgb/rgb/Rgba#::newrust-analyzer cargo palette 0.7.6 rgb/rgb/impl#[`Alpha<Rgb<S, T>, A>`]new().(red, green, blue, alpha) |
| 42 | } |
| 43 | } |
| 44 | |
| 45 | /// RGBA color packed in BGRA order. |
| 46 | /// |
| 47 | /// See [Packed](crate::cast::Packed) for more details. |
| 48 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy:, Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:)] |
| 49 | pub struct Bgrarust-analyzer cargo palette 0.7.6 rgb/channels/Bgra#; |
| 50 | |
| 51 | impl<S, T> ComponentOrderrust-analyzer cargo palette 0.7.6 cast/packed/ComponentOrder#<rgbrust-analyzer cargo palette 0.7.6 rgb/::Rgbarust-analyzer cargo palette 0.7.6 rgb/rgb/Rgba#<S, T>, [T; 4]> for Bgrarust-analyzer cargo palette 0.7.6 rgb/channels/Bgra# { |
| 52 | #[inline] |
| 53 | fn packrust-analyzer cargo palette 0.7.6 rgb/channels/impl#[Bgra][`ComponentOrder<crate::Alpha<rgb::Rgb<S, T>, T>, [T; 4]>`]pack().(color: rgbrust-analyzer cargo palette 0.7.6 rgb/::Rgbarust-analyzer cargo palette 0.7.6 rgb/rgb/Rgba#<S, T>) -> [T; 4] { |
| 54 | let [red, green, blue, alpha]: [T; 4] = color.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(); |
| 55 | [blue, green, red, alpha] |
| 56 | } |
| 57 | |
| 58 | #[inline] |
| 59 | fn unpackrust-analyzer cargo palette 0.7.6 rgb/channels/impl#[Bgra][`ComponentOrder<crate::Alpha<rgb::Rgb<S, T>, T>, [T; 4]>`]unpack().(packed: [T; 4]) -> rgbrust-analyzer cargo palette 0.7.6 rgb/::Rgbarust-analyzer cargo palette 0.7.6 rgb/rgb/Rgba#<S, T> { |
| 60 | let [blue, green, red, alpha] = packed; |
| 61 | rgbrust-analyzer cargo palette 0.7.6 rgb/::Rgbarust-analyzer cargo palette 0.7.6 rgb/rgb/Rgba#::newrust-analyzer cargo palette 0.7.6 rgb/rgb/impl#[`Alpha<Rgb<S, T>, A>`]new().(red, green, blue, alpha) |
| 62 | } |
| 63 | } |
| 64 | |
| 65 | /// RGBA color packed in RGBA order. |
| 66 | /// |
| 67 | /// See [Packed](crate::cast::Packed) for more details. |
| 68 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy:, Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:)] |
| 69 | pub struct Rgbarust-analyzer cargo palette 0.7.6 rgb/channels/Rgba#; |
| 70 | |
| 71 | impl<S, T> ComponentOrderrust-analyzer cargo palette 0.7.6 cast/packed/ComponentOrder#<rgbrust-analyzer cargo palette 0.7.6 rgb/::Rgbarust-analyzer cargo palette 0.7.6 rgb/rgb/Rgba#<S, T>, [T; 4]> for Rgbarust-analyzer cargo palette 0.7.6 rgb/channels/Rgba# { |
| 72 | #[inline] |
| 73 | fn packrust-analyzer cargo palette 0.7.6 rgb/channels/impl#[Rgba][`ComponentOrder<crate::Alpha<rgb::Rgb<S, T>, T>, [T; 4]>`]pack().(color: rgbrust-analyzer cargo palette 0.7.6 rgb/::Rgbarust-analyzer cargo palette 0.7.6 rgb/rgb/Rgba#<S, T>) -> [T; 4] { |
| 74 | let [red, green, blue, alpha]: [T; 4] = color.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(); |
| 75 | [red, green, blue, alpha] |
| 76 | } |
| 77 | |
| 78 | #[inline] |
| 79 | fn unpackrust-analyzer cargo palette 0.7.6 rgb/channels/impl#[Rgba][`ComponentOrder<crate::Alpha<rgb::Rgb<S, T>, T>, [T; 4]>`]unpack().(packed: [T; 4]) -> rgbrust-analyzer cargo palette 0.7.6 rgb/::Rgbarust-analyzer cargo palette 0.7.6 rgb/rgb/Rgba#<S, T> { |
| 80 | let [red, green, blue, alpha] = packed; |
| 81 | rgbrust-analyzer cargo palette 0.7.6 rgb/::Rgbarust-analyzer cargo palette 0.7.6 rgb/rgb/Rgba#::newrust-analyzer cargo palette 0.7.6 rgb/rgb/impl#[`Alpha<Rgb<S, T>, A>`]new().(red, green, blue, alpha) |
| 82 | } |
| 83 | } |
| 84 | |
| 85 | #[cfg(feature = "approx")] |
| 86 | #[cfg(test)] |
| 87 | mod testrust-analyzer cargo palette 0.7.6 rgb/channels/test/ { |
| 88 | use superrust-analyzer cargo palette 0.7.6 rgb/channels/::{Abgrrust-analyzer cargo palette 0.7.6 rgb/channels/Abgr#, Argbrust-analyzer cargo palette 0.7.6 rgb/channels/Argb#, Bgrarust-analyzer cargo palette 0.7.6 rgb/channels/Bgra#, Rgbarust-analyzer cargo palette 0.7.6 rgb/channels/Rgba#}; |
| 89 | use craterust-analyzer cargo palette 0.7.6 crate/::{castrust-analyzer cargo palette 0.7.6 cast/::Packedrust-analyzer cargo palette 0.7.6 cast/packed/Packed#, Srgbrust-analyzer cargo palette 0.7.6 rgb/Srgb#, Srgbarust-analyzer cargo palette 0.7.6 rgb/Srgba#}; |
| 90 | |
| 91 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 92 | fn rgbarust-analyzer cargo palette 0.7.6 rgb/channels/test/rgba().() { |
| 93 | let a1: Packedrust-analyzer cargo palette 0.7.6 cast/packed/Packed#<Rgbarust-analyzer cargo palette 0.7.6 rgb/channels/Rgba#, u32> = Srgbrust-analyzer cargo palette 0.7.6 rgb/Srgb#::newrust-analyzer cargo palette 0.7.6 rgb/rgb/impl#[`Rgb<S, T>`]new().(0.5, 0.0, 0.0).into_formatrust-analyzer cargo palette 0.7.6 rgb/rgb/impl#[`Rgb<S, T>`]into_format().().intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(); |
| 94 | let a2: Packedrust-analyzer cargo palette 0.7.6 cast/packed/Packed#<Rgbarust-analyzer cargo palette 0.7.6 rgb/channels/Rgba#, u32> = Srgbrust-analyzer cargo palette 0.7.6 rgb/Srgb#::newrust-analyzer cargo palette 0.7.6 rgb/rgb/impl#[`Rgb<S, T>`]new().(0.0, 1.0, 0.0).into_formatrust-analyzer cargo palette 0.7.6 rgb/rgb/impl#[`Rgb<S, T>`]into_format().().intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(); |
| 95 | let a3: Packedrust-analyzer cargo palette 0.7.6 cast/packed/Packed#<Rgbarust-analyzer cargo palette 0.7.6 rgb/channels/Rgba#, u32> = Srgbrust-analyzer cargo palette 0.7.6 rgb/Srgb#::newrust-analyzer cargo palette 0.7.6 rgb/rgb/impl#[`Rgb<S, T>`]new().(0.0, 0.0, 0.5).into_formatrust-analyzer cargo palette 0.7.6 rgb/rgb/impl#[`Rgb<S, T>`]into_format().().intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(); |
| 96 | let x1: u32 = 0x8000_00FF; |
| 97 | let x2: u32 = 0x00FF_00FF; |
| 98 | let x3: u32 = 0x0000_80FF; |
| 99 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(a1.colorrust-analyzer cargo palette 0.7.6 cast/packed/Packed#color., x1); |
| 100 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(a2.colorrust-analyzer cargo palette 0.7.6 cast/packed/Packed#color., x2); |
| 101 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(a3.colorrust-analyzer cargo palette 0.7.6 cast/packed/Packed#color., x3); |
| 102 | |
| 103 | let unpacked: Srgbrust-analyzer cargo palette 0.7.6 rgb/Srgb#<u8> = Packedrust-analyzer cargo palette 0.7.6 cast/packed/Packed#::<Rgbarust-analyzer cargo palette 0.7.6 rgb/channels/Rgba#, u32>::fromrust-analyzer cargo palette 0.7.6 cast/packed/impl#[`Packed<O, P>`][`From<P>`]from().(0x80FF_80FF).intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(); |
| 104 | assert_relative_eqrust-analyzer cargo approx 0.5.1 macros/assert_relative_eq!!( |
| 105 | Srgbrust-analyzer cargo palette 0.7.6 rgb/Srgb#::newrust-analyzer cargo palette 0.7.6 rgb/rgb/impl#[`Rgb<S, T>`]new().(0.5, 1.0, 0.5), |
| 106 | unpacked.into_formatrust-analyzer cargo palette 0.7.6 rgb/rgb/impl#[`Rgb<S, T>`]into_format().(), |
| 107 | epsilonrust-analyzer cargo approx 0.5.1 impl#[`Relative<A, B>`]epsilon(). = 0.01 |
| 108 | ); |
| 109 | |
| 110 | let b1: Packedrust-analyzer cargo palette 0.7.6 cast/packed/Packed#<Rgbarust-analyzer cargo palette 0.7.6 rgb/channels/Rgba#, u32> = Srgbarust-analyzer cargo palette 0.7.6 rgb/Srgba#::newrust-analyzer cargo palette 0.7.6 rgb/rgb/impl#[`Alpha<Rgb<S, T>, A>`]new().(0.5, 0.0, 0.0, 0.0).into_formatrust-analyzer cargo palette 0.7.6 rgb/rgb/impl#[`Alpha<Rgb<S, T>, A>`]into_format().().intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(); |
| 111 | let b2: Packedrust-analyzer cargo palette 0.7.6 cast/packed/Packed#<Rgbarust-analyzer cargo palette 0.7.6 rgb/channels/Rgba#, u32> = Srgbarust-analyzer cargo palette 0.7.6 rgb/Srgba#::newrust-analyzer cargo palette 0.7.6 rgb/rgb/impl#[`Alpha<Rgb<S, T>, A>`]new().(0.0, 1.0, 0.0, 0.0).into_formatrust-analyzer cargo palette 0.7.6 rgb/rgb/impl#[`Alpha<Rgb<S, T>, A>`]into_format().().intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(); |
| 112 | let b3: Packedrust-analyzer cargo palette 0.7.6 cast/packed/Packed#<Rgbarust-analyzer cargo palette 0.7.6 rgb/channels/Rgba#, u32> = Srgbarust-analyzer cargo palette 0.7.6 rgb/Srgba#::newrust-analyzer cargo palette 0.7.6 rgb/rgb/impl#[`Alpha<Rgb<S, T>, A>`]new().(0.0, 0.0, 0.5, 0.0).into_formatrust-analyzer cargo palette 0.7.6 rgb/rgb/impl#[`Alpha<Rgb<S, T>, A>`]into_format().().intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(); |
| 113 | let b4: Packedrust-analyzer cargo palette 0.7.6 cast/packed/Packed#<Rgbarust-analyzer cargo palette 0.7.6 rgb/channels/Rgba#, u32> = Srgbarust-analyzer cargo palette 0.7.6 rgb/Srgba#::newrust-analyzer cargo palette 0.7.6 rgb/rgb/impl#[`Alpha<Rgb<S, T>, A>`]new().(0.0, 0.0, 0.0, 1.0).into_formatrust-analyzer cargo palette 0.7.6 rgb/rgb/impl#[`Alpha<Rgb<S, T>, A>`]into_format().().intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(); |
| 114 | let y1: u32 = 0x8000_0000; |
| 115 | let y2: u32 = 0x00FF_0000; |
| 116 | let y3: u32 = 0x0000_8000; |
| 117 | let y4: u32 = 0x0000_00FF; |
| 118 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(b1.colorrust-analyzer cargo palette 0.7.6 cast/packed/Packed#color., y1); |
| 119 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(b2.colorrust-analyzer cargo palette 0.7.6 cast/packed/Packed#color., y2); |
| 120 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(b3.colorrust-analyzer cargo palette 0.7.6 cast/packed/Packed#color., y3); |
| 121 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(b4.colorrust-analyzer cargo palette 0.7.6 cast/packed/Packed#color., y4); |
| 122 | |
| 123 | let unpacked: Srgbarust-analyzer cargo palette 0.7.6 rgb/Srgba#<u8> = Packedrust-analyzer cargo palette 0.7.6 cast/packed/Packed#::<Rgbarust-analyzer cargo palette 0.7.6 rgb/channels/Rgba#, u32>::fromrust-analyzer cargo palette 0.7.6 cast/packed/impl#[`Packed<O, P>`][`From<P>`]from().(0x80FF_80FF).intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(); |
| 124 | assert_relative_eqrust-analyzer cargo approx 0.5.1 macros/assert_relative_eq!!( |
| 125 | Srgbarust-analyzer cargo palette 0.7.6 rgb/Srgba#::newrust-analyzer cargo palette 0.7.6 rgb/rgb/impl#[`Alpha<Rgb<S, T>, A>`]new().(0.5, 1.0, 0.5, 1.0), |
| 126 | unpacked.into_formatrust-analyzer cargo palette 0.7.6 rgb/rgb/impl#[`Alpha<Rgb<S, T>, A>`]into_format().(), |
| 127 | epsilonrust-analyzer cargo approx 0.5.1 impl#[`Relative<A, B>`]epsilon(). = 0.01 |
| 128 | ); |
| 129 | } |
| 130 | |
| 131 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 132 | fn argbrust-analyzer cargo palette 0.7.6 rgb/channels/test/argb().() { |
| 133 | let a1: Packedrust-analyzer cargo palette 0.7.6 cast/packed/Packed#<Argbrust-analyzer cargo palette 0.7.6 rgb/channels/Argb#, u32> = Srgbrust-analyzer cargo palette 0.7.6 rgb/Srgb#::newrust-analyzer cargo palette 0.7.6 rgb/rgb/impl#[`Rgb<S, T>`]new().(0.5, 0.0, 0.0).into_formatrust-analyzer cargo palette 0.7.6 rgb/rgb/impl#[`Rgb<S, T>`]into_format().().intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(); |
| 134 | let a2: Packedrust-analyzer cargo palette 0.7.6 cast/packed/Packed#<Argbrust-analyzer cargo palette 0.7.6 rgb/channels/Argb#, u32> = Srgbrust-analyzer cargo palette 0.7.6 rgb/Srgb#::newrust-analyzer cargo palette 0.7.6 rgb/rgb/impl#[`Rgb<S, T>`]new().(0.0, 1.0, 0.0).into_formatrust-analyzer cargo palette 0.7.6 rgb/rgb/impl#[`Rgb<S, T>`]into_format().().intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(); |
| 135 | let a3: Packedrust-analyzer cargo palette 0.7.6 cast/packed/Packed#<Argbrust-analyzer cargo palette 0.7.6 rgb/channels/Argb#, u32> = Srgbrust-analyzer cargo palette 0.7.6 rgb/Srgb#::newrust-analyzer cargo palette 0.7.6 rgb/rgb/impl#[`Rgb<S, T>`]new().(0.0, 0.0, 0.5).into_formatrust-analyzer cargo palette 0.7.6 rgb/rgb/impl#[`Rgb<S, T>`]into_format().().intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(); |
| 136 | let x1: u32 = 0xFF80_0000; |
| 137 | let x2: u32 = 0xFF00_FF00; |
| 138 | let x3: u32 = 0xFF00_0080; |
| 139 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(a1.colorrust-analyzer cargo palette 0.7.6 cast/packed/Packed#color., x1); |
| 140 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(a2.colorrust-analyzer cargo palette 0.7.6 cast/packed/Packed#color., x2); |
| 141 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(a3.colorrust-analyzer cargo palette 0.7.6 cast/packed/Packed#color., x3); |
| 142 | |
| 143 | let unpacked: Srgbrust-analyzer cargo palette 0.7.6 rgb/Srgb#<u8> = Packedrust-analyzer cargo palette 0.7.6 cast/packed/Packed#::<Argbrust-analyzer cargo palette 0.7.6 rgb/channels/Argb#, u32>::fromrust-analyzer cargo palette 0.7.6 cast/packed/impl#[`Packed<O, P>`][`From<P>`]from().(0x80FF_80FF).intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(); |
| 144 | assert_relative_eqrust-analyzer cargo approx 0.5.1 macros/assert_relative_eq!!( |
| 145 | Srgbrust-analyzer cargo palette 0.7.6 rgb/Srgb#::newrust-analyzer cargo palette 0.7.6 rgb/rgb/impl#[`Rgb<S, T>`]new().(1.0, 0.5, 1.0), |
| 146 | unpacked.into_formatrust-analyzer cargo palette 0.7.6 rgb/rgb/impl#[`Rgb<S, T>`]into_format().(), |
| 147 | epsilonrust-analyzer cargo approx 0.5.1 impl#[`Relative<A, B>`]epsilon(). = 0.01 |
| 148 | ); |
| 149 | |
| 150 | let b1: Packedrust-analyzer cargo palette 0.7.6 cast/packed/Packed#<Argbrust-analyzer cargo palette 0.7.6 rgb/channels/Argb#, u32> = Srgbarust-analyzer cargo palette 0.7.6 rgb/Srgba#::newrust-analyzer cargo palette 0.7.6 rgb/rgb/impl#[`Alpha<Rgb<S, T>, A>`]new().(0.5, 0.0, 0.0, 0.0).into_formatrust-analyzer cargo palette 0.7.6 rgb/rgb/impl#[`Alpha<Rgb<S, T>, A>`]into_format().().intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(); |
| 151 | let b2: Packedrust-analyzer cargo palette 0.7.6 cast/packed/Packed#<Argbrust-analyzer cargo palette 0.7.6 rgb/channels/Argb#, u32> = Srgbarust-analyzer cargo palette 0.7.6 rgb/Srgba#::newrust-analyzer cargo palette 0.7.6 rgb/rgb/impl#[`Alpha<Rgb<S, T>, A>`]new().(0.0, 1.0, 0.0, 0.0).into_formatrust-analyzer cargo palette 0.7.6 rgb/rgb/impl#[`Alpha<Rgb<S, T>, A>`]into_format().().intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(); |
| 152 | let b3: Packedrust-analyzer cargo palette 0.7.6 cast/packed/Packed#<Argbrust-analyzer cargo palette 0.7.6 rgb/channels/Argb#, u32> = Srgbarust-analyzer cargo palette 0.7.6 rgb/Srgba#::newrust-analyzer cargo palette 0.7.6 rgb/rgb/impl#[`Alpha<Rgb<S, T>, A>`]new().(0.0, 0.0, 0.5, 0.0).into_formatrust-analyzer cargo palette 0.7.6 rgb/rgb/impl#[`Alpha<Rgb<S, T>, A>`]into_format().().intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(); |
| 153 | let b4: Packedrust-analyzer cargo palette 0.7.6 cast/packed/Packed#<Argbrust-analyzer cargo palette 0.7.6 rgb/channels/Argb#, u32> = Srgbarust-analyzer cargo palette 0.7.6 rgb/Srgba#::newrust-analyzer cargo palette 0.7.6 rgb/rgb/impl#[`Alpha<Rgb<S, T>, A>`]new().(0.0, 0.0, 0.0, 1.0).into_formatrust-analyzer cargo palette 0.7.6 rgb/rgb/impl#[`Alpha<Rgb<S, T>, A>`]into_format().().intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(); |
| 154 | let y1: u32 = 0x0080_0000; |
| 155 | let y2: u32 = 0x0000_FF00; |
| 156 | let y3: u32 = 0x0000_0080; |
| 157 | let y4: u32 = 0xFF00_0000; |
| 158 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(b1.colorrust-analyzer cargo palette 0.7.6 cast/packed/Packed#color., y1); |
| 159 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(b2.colorrust-analyzer cargo palette 0.7.6 cast/packed/Packed#color., y2); |
| 160 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(b3.colorrust-analyzer cargo palette 0.7.6 cast/packed/Packed#color., y3); |
| 161 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(b4.colorrust-analyzer cargo palette 0.7.6 cast/packed/Packed#color., y4); |
| 162 | |
| 163 | let unpacked: Srgbarust-analyzer cargo palette 0.7.6 rgb/Srgba#<u8> = Packedrust-analyzer cargo palette 0.7.6 cast/packed/Packed#::<Argbrust-analyzer cargo palette 0.7.6 rgb/channels/Argb#, u32>::fromrust-analyzer cargo palette 0.7.6 cast/packed/impl#[`Packed<O, P>`][`From<P>`]from().(0x80FF_80FF).intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(); |
| 164 | assert_relative_eqrust-analyzer cargo approx 0.5.1 macros/assert_relative_eq!!( |
| 165 | Srgbarust-analyzer cargo palette 0.7.6 rgb/Srgba#::newrust-analyzer cargo palette 0.7.6 rgb/rgb/impl#[`Alpha<Rgb<S, T>, A>`]new().(1.0, 0.5, 1.0, 0.5), |
| 166 | unpacked.into_formatrust-analyzer cargo palette 0.7.6 rgb/rgb/impl#[`Alpha<Rgb<S, T>, A>`]into_format().(), |
| 167 | epsilonrust-analyzer cargo approx 0.5.1 impl#[`Relative<A, B>`]epsilon(). = 0.01 |
| 168 | ); |
| 169 | } |
| 170 | |
| 171 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 172 | fn bgrarust-analyzer cargo palette 0.7.6 rgb/channels/test/bgra().() { |
| 173 | let a1: Packedrust-analyzer cargo palette 0.7.6 cast/packed/Packed#<Bgrarust-analyzer cargo palette 0.7.6 rgb/channels/Bgra#, u32> = Srgbrust-analyzer cargo palette 0.7.6 rgb/Srgb#::newrust-analyzer cargo palette 0.7.6 rgb/rgb/impl#[`Rgb<S, T>`]new().(0.5, 0.0, 0.0).into_formatrust-analyzer cargo palette 0.7.6 rgb/rgb/impl#[`Rgb<S, T>`]into_format().().intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(); |
| 174 | let a2: Packedrust-analyzer cargo palette 0.7.6 cast/packed/Packed#<Bgrarust-analyzer cargo palette 0.7.6 rgb/channels/Bgra#, u32> = Srgbrust-analyzer cargo palette 0.7.6 rgb/Srgb#::newrust-analyzer cargo palette 0.7.6 rgb/rgb/impl#[`Rgb<S, T>`]new().(0.0, 1.0, 0.0).into_formatrust-analyzer cargo palette 0.7.6 rgb/rgb/impl#[`Rgb<S, T>`]into_format().().intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(); |
| 175 | let a3: Packedrust-analyzer cargo palette 0.7.6 cast/packed/Packed#<Bgrarust-analyzer cargo palette 0.7.6 rgb/channels/Bgra#, u32> = Srgbrust-analyzer cargo palette 0.7.6 rgb/Srgb#::newrust-analyzer cargo palette 0.7.6 rgb/rgb/impl#[`Rgb<S, T>`]new().(0.0, 0.0, 0.5).into_formatrust-analyzer cargo palette 0.7.6 rgb/rgb/impl#[`Rgb<S, T>`]into_format().().intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(); |
| 176 | let x1: u32 = 0x0000_80FF; |
| 177 | let x2: u32 = 0x00FF_00FF; |
| 178 | let x3: u32 = 0x8000_00FF; |
| 179 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(a1.colorrust-analyzer cargo palette 0.7.6 cast/packed/Packed#color., x1); |
| 180 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(a2.colorrust-analyzer cargo palette 0.7.6 cast/packed/Packed#color., x2); |
| 181 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(a3.colorrust-analyzer cargo palette 0.7.6 cast/packed/Packed#color., x3); |
| 182 | |
| 183 | let unpacked: Srgbrust-analyzer cargo palette 0.7.6 rgb/Srgb#<u8> = Packedrust-analyzer cargo palette 0.7.6 cast/packed/Packed#::<Bgrarust-analyzer cargo palette 0.7.6 rgb/channels/Bgra#, u32>::fromrust-analyzer cargo palette 0.7.6 cast/packed/impl#[`Packed<O, P>`][`From<P>`]from().(0x80FF_FF80).intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(); |
| 184 | assert_relative_eqrust-analyzer cargo approx 0.5.1 macros/assert_relative_eq!!( |
| 185 | Srgbrust-analyzer cargo palette 0.7.6 rgb/Srgb#::newrust-analyzer cargo palette 0.7.6 rgb/rgb/impl#[`Rgb<S, T>`]new().(1.0, 1.0, 0.5), |
| 186 | unpacked.into_formatrust-analyzer cargo palette 0.7.6 rgb/rgb/impl#[`Rgb<S, T>`]into_format().(), |
| 187 | epsilonrust-analyzer cargo approx 0.5.1 impl#[`Relative<A, B>`]epsilon(). = 0.01 |
| 188 | ); |
| 189 | |
| 190 | let b1: Packedrust-analyzer cargo palette 0.7.6 cast/packed/Packed#<Bgrarust-analyzer cargo palette 0.7.6 rgb/channels/Bgra#, u32> = Srgbarust-analyzer cargo palette 0.7.6 rgb/Srgba#::newrust-analyzer cargo palette 0.7.6 rgb/rgb/impl#[`Alpha<Rgb<S, T>, A>`]new().(0.5, 0.0, 0.0, 0.0).into_formatrust-analyzer cargo palette 0.7.6 rgb/rgb/impl#[`Alpha<Rgb<S, T>, A>`]into_format().().intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(); |
| 191 | let b2: Packedrust-analyzer cargo palette 0.7.6 cast/packed/Packed#<Bgrarust-analyzer cargo palette 0.7.6 rgb/channels/Bgra#, u32> = Srgbarust-analyzer cargo palette 0.7.6 rgb/Srgba#::newrust-analyzer cargo palette 0.7.6 rgb/rgb/impl#[`Alpha<Rgb<S, T>, A>`]new().(0.0, 1.0, 0.0, 0.0).into_formatrust-analyzer cargo palette 0.7.6 rgb/rgb/impl#[`Alpha<Rgb<S, T>, A>`]into_format().().intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(); |
| 192 | let b3: Packedrust-analyzer cargo palette 0.7.6 cast/packed/Packed#<Bgrarust-analyzer cargo palette 0.7.6 rgb/channels/Bgra#, u32> = Srgbarust-analyzer cargo palette 0.7.6 rgb/Srgba#::newrust-analyzer cargo palette 0.7.6 rgb/rgb/impl#[`Alpha<Rgb<S, T>, A>`]new().(0.0, 0.0, 0.5, 0.0).into_formatrust-analyzer cargo palette 0.7.6 rgb/rgb/impl#[`Alpha<Rgb<S, T>, A>`]into_format().().intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(); |
| 193 | let b4: Packedrust-analyzer cargo palette 0.7.6 cast/packed/Packed#<Bgrarust-analyzer cargo palette 0.7.6 rgb/channels/Bgra#, u32> = Srgbarust-analyzer cargo palette 0.7.6 rgb/Srgba#::newrust-analyzer cargo palette 0.7.6 rgb/rgb/impl#[`Alpha<Rgb<S, T>, A>`]new().(0.0, 0.0, 0.0, 1.0).into_formatrust-analyzer cargo palette 0.7.6 rgb/rgb/impl#[`Alpha<Rgb<S, T>, A>`]into_format().().intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(); |
| 194 | let y1: u32 = 0x0000_8000; |
| 195 | let y2: u32 = 0x00FF_0000; |
| 196 | let y3: u32 = 0x8000_0000; |
| 197 | let y4: u32 = 0x0000_00FF; |
| 198 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(b1.colorrust-analyzer cargo palette 0.7.6 cast/packed/Packed#color., y1); |
| 199 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(b2.colorrust-analyzer cargo palette 0.7.6 cast/packed/Packed#color., y2); |
| 200 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(b3.colorrust-analyzer cargo palette 0.7.6 cast/packed/Packed#color., y3); |
| 201 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(b4.colorrust-analyzer cargo palette 0.7.6 cast/packed/Packed#color., y4); |
| 202 | |
| 203 | let unpacked: Srgbarust-analyzer cargo palette 0.7.6 rgb/Srgba#<u8> = Packedrust-analyzer cargo palette 0.7.6 cast/packed/Packed#::<Bgrarust-analyzer cargo palette 0.7.6 rgb/channels/Bgra#, u32>::fromrust-analyzer cargo palette 0.7.6 cast/packed/impl#[`Packed<O, P>`][`From<P>`]from().(0x80FF_FF80).intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(); |
| 204 | assert_relative_eqrust-analyzer cargo approx 0.5.1 macros/assert_relative_eq!!( |
| 205 | Srgbarust-analyzer cargo palette 0.7.6 rgb/Srgba#::newrust-analyzer cargo palette 0.7.6 rgb/rgb/impl#[`Alpha<Rgb<S, T>, A>`]new().(1.0, 1.0, 0.5, 0.5), |
| 206 | unpacked.into_formatrust-analyzer cargo palette 0.7.6 rgb/rgb/impl#[`Alpha<Rgb<S, T>, A>`]into_format().(), |
| 207 | epsilonrust-analyzer cargo approx 0.5.1 impl#[`Relative<A, B>`]epsilon(). = 0.01 |
| 208 | ); |
| 209 | } |
| 210 | |
| 211 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 212 | fn abgrrust-analyzer cargo palette 0.7.6 rgb/channels/test/abgr().() { |
| 213 | let a1: Packedrust-analyzer cargo palette 0.7.6 cast/packed/Packed#<Abgrrust-analyzer cargo palette 0.7.6 rgb/channels/Abgr#, u32> = Srgbrust-analyzer cargo palette 0.7.6 rgb/Srgb#::newrust-analyzer cargo palette 0.7.6 rgb/rgb/impl#[`Rgb<S, T>`]new().(0.5, 0.0, 0.0).into_formatrust-analyzer cargo palette 0.7.6 rgb/rgb/impl#[`Rgb<S, T>`]into_format().().intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(); |
| 214 | let a2: Packedrust-analyzer cargo palette 0.7.6 cast/packed/Packed#<Abgrrust-analyzer cargo palette 0.7.6 rgb/channels/Abgr#, u32> = Srgbrust-analyzer cargo palette 0.7.6 rgb/Srgb#::newrust-analyzer cargo palette 0.7.6 rgb/rgb/impl#[`Rgb<S, T>`]new().(0.0, 1.0, 0.0).into_formatrust-analyzer cargo palette 0.7.6 rgb/rgb/impl#[`Rgb<S, T>`]into_format().().intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(); |
| 215 | let a3: Packedrust-analyzer cargo palette 0.7.6 cast/packed/Packed#<Abgrrust-analyzer cargo palette 0.7.6 rgb/channels/Abgr#, u32> = Srgbrust-analyzer cargo palette 0.7.6 rgb/Srgb#::newrust-analyzer cargo palette 0.7.6 rgb/rgb/impl#[`Rgb<S, T>`]new().(0.0, 0.0, 0.5).into_formatrust-analyzer cargo palette 0.7.6 rgb/rgb/impl#[`Rgb<S, T>`]into_format().().intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(); |
| 216 | let x1: u32 = 0xFF00_0080; |
| 217 | let x2: u32 = 0xFF00_FF00; |
| 218 | let x3: u32 = 0xFF80_0000; |
| 219 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(a1.colorrust-analyzer cargo palette 0.7.6 cast/packed/Packed#color., x1); |
| 220 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(a2.colorrust-analyzer cargo palette 0.7.6 cast/packed/Packed#color., x2); |
| 221 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(a3.colorrust-analyzer cargo palette 0.7.6 cast/packed/Packed#color., x3); |
| 222 | |
| 223 | let unpacked: Srgbrust-analyzer cargo palette 0.7.6 rgb/Srgb#<u8> = Packedrust-analyzer cargo palette 0.7.6 cast/packed/Packed#::<Abgrrust-analyzer cargo palette 0.7.6 rgb/channels/Abgr#, u32>::fromrust-analyzer cargo palette 0.7.6 cast/packed/impl#[`Packed<O, P>`][`From<P>`]from().(0x80FF_FF80).intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(); |
| 224 | assert_relative_eqrust-analyzer cargo approx 0.5.1 macros/assert_relative_eq!!( |
| 225 | Srgbrust-analyzer cargo palette 0.7.6 rgb/Srgb#::newrust-analyzer cargo palette 0.7.6 rgb/rgb/impl#[`Rgb<S, T>`]new().(0.5, 1.0, 1.0), |
| 226 | unpacked.into_formatrust-analyzer cargo palette 0.7.6 rgb/rgb/impl#[`Rgb<S, T>`]into_format().(), |
| 227 | epsilonrust-analyzer cargo approx 0.5.1 impl#[`Relative<A, B>`]epsilon(). = 0.01 |
| 228 | ); |
| 229 | |
| 230 | let b1: Packedrust-analyzer cargo palette 0.7.6 cast/packed/Packed#<Abgrrust-analyzer cargo palette 0.7.6 rgb/channels/Abgr#, u32> = Srgbarust-analyzer cargo palette 0.7.6 rgb/Srgba#::newrust-analyzer cargo palette 0.7.6 rgb/rgb/impl#[`Alpha<Rgb<S, T>, A>`]new().(0.5, 0.0, 0.0, 0.0).into_formatrust-analyzer cargo palette 0.7.6 rgb/rgb/impl#[`Alpha<Rgb<S, T>, A>`]into_format().().intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(); |
| 231 | let b2: Packedrust-analyzer cargo palette 0.7.6 cast/packed/Packed#<Abgrrust-analyzer cargo palette 0.7.6 rgb/channels/Abgr#, u32> = Srgbarust-analyzer cargo palette 0.7.6 rgb/Srgba#::newrust-analyzer cargo palette 0.7.6 rgb/rgb/impl#[`Alpha<Rgb<S, T>, A>`]new().(0.0, 1.0, 0.0, 0.0).into_formatrust-analyzer cargo palette 0.7.6 rgb/rgb/impl#[`Alpha<Rgb<S, T>, A>`]into_format().().intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(); |
| 232 | let b3: Packedrust-analyzer cargo palette 0.7.6 cast/packed/Packed#<Abgrrust-analyzer cargo palette 0.7.6 rgb/channels/Abgr#, u32> = Srgbarust-analyzer cargo palette 0.7.6 rgb/Srgba#::newrust-analyzer cargo palette 0.7.6 rgb/rgb/impl#[`Alpha<Rgb<S, T>, A>`]new().(0.0, 0.0, 0.5, 0.0).into_formatrust-analyzer cargo palette 0.7.6 rgb/rgb/impl#[`Alpha<Rgb<S, T>, A>`]into_format().().intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(); |
| 233 | let b4: Packedrust-analyzer cargo palette 0.7.6 cast/packed/Packed#<Abgrrust-analyzer cargo palette 0.7.6 rgb/channels/Abgr#, u32> = Srgbarust-analyzer cargo palette 0.7.6 rgb/Srgba#::newrust-analyzer cargo palette 0.7.6 rgb/rgb/impl#[`Alpha<Rgb<S, T>, A>`]new().(0.0, 0.0, 0.0, 1.0).into_formatrust-analyzer cargo palette 0.7.6 rgb/rgb/impl#[`Alpha<Rgb<S, T>, A>`]into_format().().intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(); |
| 234 | let y1: u32 = 0x0000_0080; |
| 235 | let y2: u32 = 0x0000_FF00; |
| 236 | let y3: u32 = 0x0080_0000; |
| 237 | let y4: u32 = 0xFF00_0000; |
| 238 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(b1.colorrust-analyzer cargo palette 0.7.6 cast/packed/Packed#color., y1); |
| 239 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(b2.colorrust-analyzer cargo palette 0.7.6 cast/packed/Packed#color., y2); |
| 240 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(b3.colorrust-analyzer cargo palette 0.7.6 cast/packed/Packed#color., y3); |
| 241 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(b4.colorrust-analyzer cargo palette 0.7.6 cast/packed/Packed#color., y4); |
| 242 | |
| 243 | let unpacked: Srgbarust-analyzer cargo palette 0.7.6 rgb/Srgba#<u8> = Packedrust-analyzer cargo palette 0.7.6 cast/packed/Packed#::<Abgrrust-analyzer cargo palette 0.7.6 rgb/channels/Abgr#, u32>::fromrust-analyzer cargo palette 0.7.6 cast/packed/impl#[`Packed<O, P>`][`From<P>`]from().(0x80FF_FF80).intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(); |
| 244 | assert_relative_eqrust-analyzer cargo approx 0.5.1 macros/assert_relative_eq!!( |
| 245 | Srgbarust-analyzer cargo palette 0.7.6 rgb/Srgba#::newrust-analyzer cargo palette 0.7.6 rgb/rgb/impl#[`Alpha<Rgb<S, T>, A>`]new().(0.5, 1.0, 1.0, 0.5), |
| 246 | unpacked.into_formatrust-analyzer cargo palette 0.7.6 rgb/rgb/impl#[`Alpha<Rgb<S, T>, A>`]into_format().(), |
| 247 | epsilonrust-analyzer cargo approx 0.5.1 impl#[`Relative<A, B>`]epsilon(). = 0.01 |
| 248 | ); |
| 249 | } |
| 250 | |
| 251 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 252 | fn u32_to_colorrust-analyzer cargo palette 0.7.6 rgb/channels/test/u32_to_color().() { |
| 253 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(0xFFFF_FF80, u32::fromrust-analyzer cargo palette 0.7.6 rgb/rgb/impl#[u32][`From<Rgb<S, u8>>`]from().(Srgbrust-analyzer cargo palette 0.7.6 rgb/Srgb#::newrust-analyzer cargo palette 0.7.6 rgb/rgb/impl#[`Rgb<S, T>`]new().(255u8, 255, 128))); |
| 254 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(0x7FFF_FF80, u32::fromrust-analyzer cargo palette 0.7.6 rgb/rgb/impl#[u32][`From<Alpha<Rgb<S, u8>, u8>>`]from().(Srgbarust-analyzer cargo palette 0.7.6 rgb/Srgba#::newrust-analyzer cargo palette 0.7.6 rgb/rgb/impl#[`Alpha<Rgb<S, T>, A>`]new().(127u8, 255u8, 255, 128))); |
| 255 | } |
| 256 | } |