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 */ /* Detect type from extension */
std::string plugin; std::string plugin;
if(Utility::String::endsWith(filename, ".tga")) if(Utility::String::endsWith(filename, ".bmp"))
plugin = "TgaImporter"; plugin = "BmpImporter";
else if(Utility::String::endsWith(filename, ".png")) else if(Utility::String::endsWith(filename, ".gif"))
plugin = "PngImporter"; plugin = "GifImporter";
else if(Utility::String::endsWith(filename, ".hdr"))
plugin = "HdrImporter";
else if(Utility::String::endsWith(filename, ".jpg") || Utility::String::endsWith(filename, ".jpeg")) else if(Utility::String::endsWith(filename, ".jpg") || Utility::String::endsWith(filename, ".jpeg"))
plugin = "JpegImporter"; 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 { else {
Error() << "Trade::AnyImageImporter::openFile(): cannot determine type of file" << filename; Error() << "Trade::AnyImageImporter::openFile(): cannot determine type of file" << filename;
return; return;

17
src/MagnumPlugins/AnyImageImporter/AnyImageImporter.h

@ -46,9 +46,20 @@ namespace Magnum { namespace Trade {
/** /**
@brief Any image importer plugin @brief Any image importer plugin
Detects file type based on file extension, then loads either Detects file type based on file extension, loads corresponding plugin and then
@ref TgaImporter, @ref PngImporter or @ref JpegImporter and tries to open the tries to open the file with it. Supported formats:
file with it. See documentation of each particular plugin for more information.
- 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. Only loading from files is supported.
*/ */

Loading…
Cancel
Save