Trait palette::pixel::RgbPixel [] [src]

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

A conversion trait for RGB pixel formats.

It provided methods for encoding and decoding RGB colors as pixel storage formats, and is intended as a bridge between Palette and image processing libraries.

Required Methods

fn from_rgba(red: T, green: T, blue: T, alpha: T) -> 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) -> (T, T, T, T)

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