Trait palette::FromComponent [−][src]
pub trait FromComponent<T: Component> { fn from_component(other: T) -> Self; }
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
[src]
Converts other
into Self
, while performing the appropriate scaling,
rounding and clamping.
Implementors
impl<T: Component, U: IntoComponent<T> + Component> FromComponent<U> for T
[src]
impl<T: Component, U: IntoComponent<T> + Component> FromComponent<U> for T
[src]