frame/video: implement Component for a couple more types

This commit is contained in:
meh 2015-08-04 14:38:42 +02:00
parent 67b683169c
commit c1b1a5b722

View File

@ -314,3 +314,33 @@ impl Component for ::image::Rgba<u8> {
format == format::Pixel::RGBA
}
}
impl Component for [u8; 3] {
fn is_valid(format: format::Pixel) -> bool {
format == format::Pixel::RGB24 || format == format::Pixel::BGR24
}
}
impl Component for (u8, u8, u8) {
fn is_valid(format: format::Pixel) -> bool {
format == format::Pixel::RGB24 || format == format::Pixel::BGR24
}
}
impl Component for [u8; 4] {
fn is_valid(format: format::Pixel) -> bool {
format == format::Pixel::RGBA || format == format::Pixel::BGRA ||
format == format::Pixel::ARGB || format == format::Pixel::ABGR ||
format == format::Pixel::RGBZ || format == format::Pixel::BGRZ ||
format == format::Pixel::ZRGB || format == format::Pixel::ZBGR
}
}
impl Component for (u8, u8, u8, u8) {
fn is_valid(format: format::Pixel) -> bool {
format == format::Pixel::RGBA || format == format::Pixel::BGRA ||
format == format::Pixel::ARGB || format == format::Pixel::ABGR ||
format == format::Pixel::RGBZ || format == format::Pixel::BGRZ ||
format == format::Pixel::ZRGB || format == format::Pixel::ZBGR
}
}