#ifndef PNM_JPEG_H #define PNM_JPEG_H #include #include #include #include #include #include #include #include namespace CVD { namespace JPEG { using CVD::Internal::Head; using CVD::Internal::TypeList; class ReadPimpl; class Reader { public: Reader(std::istream&); ~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 == 0xff; } 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 = 1; 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