if(ext==".png")
{
IO::BufferedFile file(fn);
- load_png(file, *priv);
+ load_png(file, *priv, 0, 0);
}
else
#endif
(void)fn;
}
-void Image::load_memory(const void *data, unsigned size)
+void Image::load_io(IO::Base &io)
{
+ char sig_buf[8];
+ unsigned sig_len = io.read(sig_buf, sizeof(sig_buf));
#ifdef WITH_LIBPNG
- if(size>=8 && is_png(data, 8))
- {
- IO::Memory mem(reinterpret_cast<const char *>(data), size);
- load_png(mem, *priv);
- }
+ if(sig_len==sizeof(sig_buf) && is_png(sig_buf, sig_len))
+ load_png(io, *priv, sig_buf, sig_len);
else
#endif
{
#ifdef WITH_DEVIL
- load_devil_mem(data, size, *priv);
+ load_devil_io(io, *priv, sig_buf, sig_len);
#else
throw unsupported_image_format("DevIL needed for non-PNG images");
#endif
}
- (void)data;
- (void)size;
}
PixelFormat Image::get_format() const