Trait palette::FromComponent
source · [−]pub trait FromComponent<T: Component> {
fn from_component(other: T) -> Self;
}
Expand description
Converts from a color component type, while performing the appropriate scaling, rounding and clamping.
use palette::FromComponent;
// Scales the value up to u8::MAX while converting.
let u8_component = u8::from_component(1.0f32);
assert_eq!(u8_component, 255);
Required Methods
fn from_component(other: T) -> Self
fn from_component(other: T) -> Self
Converts other
into Self
, while performing the appropriate scaling,
rounding and clamping.