pub type Lumaa<S = Srgb, T = f32> = Alpha<Luma<S, T>, T>;
Expand description
Luminance with an alpha component. See the Lumaa
implementation
in Alpha
.
Aliased Type§
struct Lumaa<S = Srgb, T = f32> {
pub color: Luma<S, T>,
pub alpha: T,
}
Fields§
§color: Luma<S, T>
The color.
alpha: T
The transparency component. 0.0 (or 0u8) is fully transparent and 1.0 (or 255u8) is fully opaque.
Implementations§
source§impl<S> Lumaa<S, u8>
impl<S> Lumaa<S, u8>
sourcepub fn into_u16<O>(self) -> u16
pub fn into_u16<O>(self) -> u16
Convert to a packed u16
with with a specific component order.
use palette::{luma, SrgbLumaa};
let integer = SrgbLumaa::new(96u8, 255).into_u16::<luma::channels::Al>();
assert_eq!(0xFF60, integer);
It’s also possible to use From
and Into
, which defaults to the
0xLLAA
component order:
use palette::SrgbLumaa;
let integer = u16::from(SrgbLumaa::new(96u8, 255));
assert_eq!(0x60FF, integer);
See Packed for more details.
sourcepub fn from_u16<O>(color: u16) -> Self
pub fn from_u16<O>(color: u16) -> Self
Convert from a packed u16
with a specific component order.
use palette::{luma, SrgbLumaa};
let luma = SrgbLumaa::from_u16::<luma::channels::Al>(0xFF60);
assert_eq!(SrgbLumaa::new(96u8, 255), luma);
It’s also possible to use From
and Into
, which defaults to the
0xLLAA
component order:
use palette::SrgbLumaa;
let luma = SrgbLumaa::from(0x60FF);
assert_eq!(SrgbLumaa::new(96u8, 255), luma);
See Packed for more details.