#ifndef CVD_CONVERT_IMAGE_H #define CVD_CONVERT_IMAGE_H #include #include #include #include namespace CVD { // The most general case: one row at a time template ::type, int both_pod = std::is_trivially_copyable::value&& std::is_trivially_copyable::value> struct ConvertImage { static void convert(const BasicImage& from, BasicImage& to) { for(int r = 0; r < from.size().y; r++) Pixel::ConvertPixels::convert(from[r], to[r], from.size().x); }; }; // The blat case: memcpy all data at once template struct ConvertImage, 1> { static void convert(const BasicImage& from, BasicImage& to) { for(int y = 0; y < from.size().y; y++) memcpy(to[y], from[y], from.size().x * sizeof(T)); }; }; template <> struct ConvertImage, byte, Pixel::CIE, byte>, 1> { static void convert(const BasicImage>& from, BasicImage& to); }; template void convert_image(const BasicImage& from, BasicImage& to) { if(from.size() != to.size()) throw Exceptions::Image::IncompatibleImageSizes(__FUNCTION__); ConvertImage::convert(from, to); } template