Trait Color

Source
pub trait Color<T> {
    const MIN: T;
    const MAX: T;
    const BLACK: Self;
    const WHITE: Self;
    const RED: Self;
    const GREEN: Self;
    const BLUE: Self;
    const YELLOW: Self;
    const MAGENTA: Self;
    const CYAN: Self;

    // Required methods
    fn r(&self) -> T;
    fn g(&self) -> T;
    fn b(&self) -> T;
    fn a(&self) -> T;
    fn gray(&self) -> T;
    fn gray_alpha(&self) -> Self;
    fn premultiply(&self) -> Self;
    fn blend(&self, src: Self, mode: BlendMode) -> Self;
}
Expand description

common color interface

Required Associated Constants§

Source

const MIN: T

Source

const MAX: T

Source

const BLACK: Self

Source

const WHITE: Self

Source

const RED: Self

Source

const GREEN: Self

Source

const BLUE: Self

Source

const YELLOW: Self

Source

const MAGENTA: Self

Source

const CYAN: Self

Required Methods§

Source

fn r(&self) -> T

Source

fn g(&self) -> T

Source

fn b(&self) -> T

Source

fn a(&self) -> T

Source

fn gray(&self) -> T

converts the color to gray scale.

Source

fn gray_alpha(&self) -> Self

converts the color to gray maintaining alpha.

Source

fn premultiply(&self) -> Self

premultiplies the alpha.

Source

fn blend(&self, src: Self, mode: BlendMode) -> Self

color blending.

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§

Source§

impl Color<f32> for ColorF

Source§

const MIN: f32 = 0f32

Source§

const MAX: f32 = 1f32

Source§

const BLACK: Self

Source§

const WHITE: Self

Source§

const RED: Self

Source§

const GREEN: Self

Source§

const BLUE: Self

Source§

const YELLOW: Self

Source§

const MAGENTA: Self

Source§

const CYAN: Self

Source§

impl Color<u8> for Color8

Source§

const MIN: u8 = 0u8

Source§

const MAX: u8 = 255u8

Source§

const BLACK: Self

Source§

const WHITE: Self

Source§

const RED: Self

Source§

const GREEN: Self

Source§

const BLUE: Self

Source§

const YELLOW: Self

Source§

const MAGENTA: Self

Source§

const CYAN: Self

Source§

impl Color<u16> for Color16

Source§

const MIN: u16 = 0u16

Source§

const MAX: u16 = 65_535u16

Source§

const BLACK: Self

Source§

const WHITE: Self

Source§

const RED: Self

Source§

const GREEN: Self

Source§

const BLUE: Self

Source§

const YELLOW: Self

Source§

const MAGENTA: Self

Source§

const CYAN: Self