31 #ifndef PNGPP_READER_HPP_INCLUDED
32 #define PNGPP_READER_HPP_INCLUDED
64 template<
class istream >
74 :
io_base(png_create_read_struct(PNG_LIBPNG_VER_STRING,
79 png_set_read_fn(
m_png, & stream, read_data);
84 png_destroy_read_struct(&
m_png,
95 if (setjmp(png_jmpbuf(
m_png)))
110 if (setjmp(png_jmpbuf(
m_png)))
122 if (setjmp(png_jmpbuf(
m_png)))
126 png_read_row(
m_png, bytes, 0);
134 if (setjmp(png_jmpbuf(
m_png)))
147 static void read_data(png_struct* png,
byte* data,
size_t length)
152 istream* stream =
reinterpret_cast< istream*
>(png_get_io_ptr(png));
155 stream->read(reinterpret_cast< char* >(data), length);
161 catch (std::exception
const& error)
167 assert(!
"read_data: caught something wrong");
168 rd->
set_error(
"read_data: caught something wrong");
179 #endif // PNGPP_READER_HPP_INCLUDED