Trait palette::RgbPixel [] [src]

pub trait RgbPixel {
    fn from_rgba(red: f32, green: f32, blue: f32, alpha: f32) -> Self;
    fn to_rgba(&self) -> (f32, f32, f32, f32);
}

A conversion trait for RGB pixel types.

It makes conversion from Rgb to various pixel representations easy and extensible.

Required Methods

fn from_rgba(red: f32, green: f32, blue: f32, alpha: f32) -> Self

Create an instance of Self from red, green, blue and alpha values. These can be assumed to already be gamma corrected and belongs to the range [0.0, 1.0].

fn to_rgba(&self) -> (f32, f32, f32, f32)

Convert the red, green, blue and alpha values of self to values in the range [0.0, 1.0]. No gamma correction should be performed.

Implementors