Browse Source

AnyImageImporter: support also BMP, GIF, HDR, JPEG, PIC and PSD formats.

pull/205/head
Vladimír Vondruš 12 years ago
parent
commit
990abf5022
  1. 18
      src/MagnumPlugins/AnyImageImporter/AnyImageImporter.cpp
  2. 17
      src/MagnumPlugins/AnyImageImporter/AnyImageImporter.h

18
src/MagnumPlugins/AnyImageImporter/AnyImageImporter.cpp

@ -52,12 +52,22 @@ void AnyImageImporter::doOpenFile(const std::string& filename) {
/* Detect type from extension */
std::string plugin;
if(Utility::String::endsWith(filename, ".tga"))
plugin = "TgaImporter";
else if(Utility::String::endsWith(filename, ".png"))
plugin = "PngImporter";
if(Utility::String::endsWith(filename, ".bmp"))
plugin = "BmpImporter";
else if(Utility::String::endsWith(filename, ".gif"))
plugin = "GifImporter";
else if(Utility::String::endsWith(filename, ".hdr"))
plugin = "HdrImporter";
else if(Utility::String::endsWith(filename, ".jpg") || Utility::String::endsWith(filename, ".jpeg"))
plugin = "JpegImporter";
else if(Utility::String::endsWith(filename, ".pic"))
plugin = "PicImporter";
else if(Utility::String::endsWith(filename, ".png"))
plugin = "PngImporter";
else if(Utility::String::endsWith(filename, ".psd"))
plugin = "PsdImporter";
else if(Utility::String::endsWith(filename, ".tga"))
plugin = "TgaImporter";
else {
Error() << "Trade::AnyImageImporter::openFile(): cannot determine type of file" << filename;
return;

17
src/MagnumPlugins/AnyImageImporter/AnyImageImporter.h

@ -46,9 +46,20 @@ namespace Magnum { namespace Trade {
/**
@brief Any image importer plugin
Detects file type based on file extension, then loads either
@ref TgaImporter, @ref PngImporter or @ref JpegImporter and tries to open the
file with it. See documentation of each particular plugin for more information.
Detects file type based on file extension, loads corresponding plugin and then
tries to open the file with it. Supported formats:
- BMP (`*.bmp`), loaded with any plugin that provides `%BmpImporter`
- GIF (`*.gif`), loaded with any plugin that provides `%GifImporter`
- HDR (`*.hdr`), loaded with any plugin that provides `%HdrImporter`
- JPEG (`*.jpg`, `*.jpeg`), loaded with @ref JpegImporter or any other plugin
that provides it
- PIC (`*.pic`), loaded with any plugin that provides `%PicImporter`
- PNG (`*.png`), loaded with @ref PngImporter or any other plugin that
provides it
- PSD (`*.psd`), loaded with any plugin that provides `%PsdImporter`
- TGA (`*.tga`), loaded with @ref TgaImporter or any other plugin that
provides it
Only loading from files is supported.
*/

Loading…
Cancel
Save