| 1 | //! Channel orders for packed Luma 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#, lumarust-analyzer cargo palette 0.7.6 luma/}; |
| 4 | |
| 5 | /// Luma+Alpha color packed in LA 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 Larust-analyzer cargo palette 0.7.6 luma/channels/La#; |
| 10 | |
| 11 | impl<S, T> ComponentOrderrust-analyzer cargo palette 0.7.6 cast/packed/ComponentOrder#<lumarust-analyzer cargo palette 0.7.6 luma/::Lumaarust-analyzer cargo palette 0.7.6 luma/luma/Lumaa#<S, T>, [T; 2]> for Larust-analyzer cargo palette 0.7.6 luma/channels/La# { |
| 12 | #[inline] |
| 13 | fn packrust-analyzer cargo palette 0.7.6 luma/channels/impl#[La][`ComponentOrder<crate::Alpha<luma::Luma<S, T>, T>, [T; 2]>`]pack().(color: lumarust-analyzer cargo palette 0.7.6 luma/::Lumaarust-analyzer cargo palette 0.7.6 luma/luma/Lumaa#<S, T>) -> [T; 2] { |
| 14 | color.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().() |
| 15 | } |
| 16 | |
| 17 | #[inline] |
| 18 | fn unpackrust-analyzer cargo palette 0.7.6 luma/channels/impl#[La][`ComponentOrder<crate::Alpha<luma::Luma<S, T>, T>, [T; 2]>`]unpack().(packed: [T; 2]) -> lumarust-analyzer cargo palette 0.7.6 luma/::Lumaarust-analyzer cargo palette 0.7.6 luma/luma/Lumaa#<S, T> { |
| 19 | packed.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().() |
| 20 | } |
| 21 | } |
| 22 | |
| 23 | /// Luma+Alpha color packed in AL order. |
| 24 | /// |
| 25 | /// See [Packed](crate::cast::Packed) for more details. |
| 26 | #[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:)] |
| 27 | pub struct Alrust-analyzer cargo palette 0.7.6 luma/channels/Al#; |
| 28 | |
| 29 | impl<S, T> ComponentOrderrust-analyzer cargo palette 0.7.6 cast/packed/ComponentOrder#<lumarust-analyzer cargo palette 0.7.6 luma/::Lumaarust-analyzer cargo palette 0.7.6 luma/luma/Lumaa#<S, T>, [T; 2]> for Alrust-analyzer cargo palette 0.7.6 luma/channels/Al# { |
| 30 | #[inline] |
| 31 | fn packrust-analyzer cargo palette 0.7.6 luma/channels/impl#[Al][`ComponentOrder<crate::Alpha<luma::Luma<S, T>, T>, [T; 2]>`]pack().(color: lumarust-analyzer cargo palette 0.7.6 luma/::Lumaarust-analyzer cargo palette 0.7.6 luma/luma/Lumaa#<S, T>) -> [T; 2] { |
| 32 | let [luma, alpha]: [T; 2] = color.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(); |
| 33 | [alpha, luma] |
| 34 | } |
| 35 | |
| 36 | #[inline] |
| 37 | fn unpackrust-analyzer cargo palette 0.7.6 luma/channels/impl#[Al][`ComponentOrder<crate::Alpha<luma::Luma<S, T>, T>, [T; 2]>`]unpack().(packed: [T; 2]) -> lumarust-analyzer cargo palette 0.7.6 luma/::Lumaarust-analyzer cargo palette 0.7.6 luma/luma/Lumaa#<S, T> { |
| 38 | let [alpha, luma] = packed; |
| 39 | lumarust-analyzer cargo palette 0.7.6 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().(luma, alpha) |
| 40 | } |
| 41 | } |