-#ifdef WITH_LIBPNG
- if(fn.size()>4 && !fn.compare(fn.size()-4, 4, ".png"))
- {
- IO::BufferedFile file(fn);
- load_png(file, *priv);
- }
- else
-#endif
- {
-#ifdef WITH_DEVIL
- ensure_devil_image(priv->id);
- ilBindImage(priv->id);
- if(!ilLoadImage(const_cast<char *>(fn.c_str())))
- throw bad_image_data("IL error");
-#else
- throw unsupported_image_format("DevIL needed for non-PNG images");
-#endif
- }
- (void)fn;
-}
-
-void Image::load_memory(const void *data, unsigned size)
-{
-#ifdef WITH_LIBPNG
- if(!png_sig_cmp(reinterpret_cast<png_byte *>(const_cast<void *>(data)), 0, 8))
- {
- IO::Memory mem(reinterpret_cast<const char *>(data), size);
- load_png(mem, *priv);
- }
- else
-#endif
- {
-#ifdef WITH_DEVIL
- ensure_devil_image(priv->id);
- ilBindImage(priv->id);
- if(!ilLoadL(IL_TYPE_UNKNOWN, const_cast<void *>(data), size))
- throw bad_image_data("IL error");
-#else
- throw unsupported_image_format("DevIL needed for non-PNG images");
-#endif
- }
- (void)data;
- (void)size;