use float::Float;
use core::any::Any;
use {Component, Yxy};
use white_point::WhitePoint;
use encoding::{Linear, TransferFn};
pub use self::rgb::{Rgb, Rgba};
mod rgb;
pub type Srgb<T = f32> = Rgb<::encoding::Srgb, T>;
pub type Srgba<T = f32> = Rgba<::encoding::Srgb, T>;
pub type LinSrgb<T = f32> = Rgb<Linear<::encoding::Srgb>, T>;
pub type LinSrgba<T = f32> = Rgba<Linear<::encoding::Srgb>, T>;
pub type GammaSrgb<T = f32> = Rgb<::encoding::Gamma<::encoding::Srgb>, T>;
pub type GammaSrgba<T = f32> = Rgba<::encoding::Gamma<::encoding::Srgb>, T>;
pub trait RgbStandard {
type Space: RgbSpace;
type TransferFn: TransferFn;
}
impl<S: RgbSpace, T: TransferFn> RgbStandard for (S, T) {
type Space = S;
type TransferFn = T;
}
impl<P: Primaries, W: WhitePoint, T: TransferFn> RgbStandard for (P, W, T) {
type Space = (P, W);
type TransferFn = T;
}
pub trait RgbSpace {
type Primaries: Primaries;
type WhitePoint: WhitePoint;
}
impl<P: Primaries, W: WhitePoint> RgbSpace for (P, W) {
type Primaries = P;
type WhitePoint = W;
}
pub trait Primaries: Any {
fn red<Wp: WhitePoint, T: Component + Float>() -> Yxy<Wp, T>;
fn green<Wp: WhitePoint, T: Component + Float>() -> Yxy<Wp, T>;
fn blue<Wp: WhitePoint, T: Component + Float>() -> Yxy<Wp, T>;
}