Trait nannou::color::Component

source ·
pub trait Component: Copy + Zero + PartialOrd + NumCast {
    const LIMITED: bool;

    // Required methods
    fn max_intensity() -> Self;
    fn convert<T>(&self) -> T
       where T: Component;
}
Expand description

Common trait for color components.

Required Associated Constants§

source

const LIMITED: bool

True if the max intensity is also the highest possible value of the type. Conversion to limited types requires clamping.

Required Methods§

source

fn max_intensity() -> Self

The highest displayable value this component type can reach. Higher values are allowed, but they may be lowered to this before converting to another format.

source

fn convert<T>(&self) -> T
where T: Component,

Convert into another color component type, including scaling.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl Component for f32

source§

const LIMITED: bool = false

source§

fn max_intensity() -> f32

source§

fn convert<T>(&self) -> T
where T: Component,

source§

impl Component for f64

source§

const LIMITED: bool = false

source§

fn max_intensity() -> f64

source§

fn convert<T>(&self) -> T
where T: Component,

source§

impl Component for u8

source§

const LIMITED: bool = true

source§

fn max_intensity() -> u8

source§

fn convert<T>(&self) -> T
where T: Component,

source§

impl Component for u16

source§

const LIMITED: bool = true

source§

fn max_intensity() -> u16

source§

fn convert<T>(&self) -> T
where T: Component,

source§

impl Component for u32

source§

const LIMITED: bool = true

source§

fn max_intensity() -> u32

source§

fn convert<T>(&self) -> T
where T: Component,

source§

impl Component for u64

source§

const LIMITED: bool = true

source§

fn max_intensity() -> u64

source§

fn convert<T>(&self) -> T
where T: Component,

Implementors§