Color

Trait Color 

Source
pub trait Color: Debug + Copy {
    // Required methods
    fn red(&self) -> f64;
    fn green(&self) -> f64;
    fn blue(&self) -> f64;
    fn alpha(&self) -> f64;
    fn red8(&self) -> u8;
    fn green8(&self) -> u8;
    fn blue8(&self) -> u8;
    fn alpha8(&self) -> u8;
    fn is_premultiplied(&self) -> bool;

    // Provided methods
    fn is_transparent(&self) -> bool { ... }
    fn is_opaque(&self) -> bool { ... }
}
Expand description

Access Color properties and compoents

Required Methods§

Source

fn red(&self) -> f64

Get red value [0,1] as f64

Source

fn green(&self) -> f64

Get green value [0,1] as f64

Source

fn blue(&self) -> f64

Get blue value [0,1] as f64

Source

fn alpha(&self) -> f64

Get alpha value [0,1] as f64

Source

fn red8(&self) -> u8

Get red value [0,255] as u8

Source

fn green8(&self) -> u8

Get green value [0,255] as u8

Source

fn blue8(&self) -> u8

Get blue value [0,255] as u8

Source

fn alpha8(&self) -> u8

Get alpha value [0,255] as u8

Source

fn is_premultiplied(&self) -> bool

Return if the color has been premultiplied

Provided Methods§

Source

fn is_transparent(&self) -> bool

Return if the color is completely transparent, alpha = 0.0

Source

fn is_opaque(&self) -> bool

Return if the color is completely opaque, alpha = 1.0

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§