1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
//! Pixel color

mod binary_color;
mod conversion;
mod gray_color;
mod rgb_color;

pub use binary_color::*;
pub use gray_color::*;
pub use rgb_color::*;

use core::fmt;

/// Pixel color trait
pub trait PixelColor: Clone + Copy + PartialEq + fmt::Debug {}

/// Convert raw data to color structs.
///
/// This trait is used to generically convert raw color data with different
/// bitdepth to specific color types. If the number of bits required to build
/// the color is less than 32 the upper bits are ignored.
pub trait FromRawData {
    /// Convert raw data to color.
    fn from_raw_data(data: u32) -> Self;
}