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
impl<T: Float> RgbPixel<T> for (f32, f32, f32, f32)
impl<T: Float> RgbPixel<T> for (f32, f32, f32)
impl<T: Float> RgbPixel<T> for (f64, f64, f64, f64)
impl<T: Float> RgbPixel<T> for (f64, f64, f64)
impl<T: Float> RgbPixel<T> for (u8, u8, u8, u8)
impl<T: Float> RgbPixel<T> for (u8, u8, u8)
impl<T: Float> RgbPixel<T> for [f32; 4]
impl<T: Float> RgbPixel<T> for [f32; 3]
impl<T: Float> RgbPixel<T> for [f64; 4]
impl<T: Float> RgbPixel<T> for [f64; 3]
impl<T: Float> RgbPixel<T> for [u8; 4]
impl<T: Float> RgbPixel<T> for [u8; 3]