#ifndef BMP_H #define BMP_H #include #include #include #include #include #include #include #include namespace CVD { namespace BMP { using Internal::Head; using Internal::TypeList; class ReadPimpl; class Reader { public: Reader(std::istream& i); ~Reader(); ImageRef size(); bool top_row_first(); void get_raw_pixel_line(unsigned char*); void get_raw_pixel_line(Rgb*); std::string datatype(); std::string name(); typedef TypeList, Head>> Types; static bool first_byte_matches(const int b) { return b == 'B'; } private: std::unique_ptr t; }; class WritePimpl; class Writer { public: Writer(std::ostream&, ImageRef size, const std::string& type, const std::map>& p); ~Writer(); void write_raw_pixel_line(const byte*); void write_raw_pixel_line(const Rgb*); template struct Outgoing { typedef byte type; }; static const int top_row_first = 0; protected: std::unique_ptr t; }; template struct Writer::Outgoing> { typedef Rgb type; }; template struct Writer::Outgoing> { typedef Rgb type; }; template <> struct Writer::Outgoing { typedef Rgb type; }; } } #endif