AnyImageImporter class
Any image importer plugin.
Detects file type based on file extension or a signature at the start of the file, loads corresponding plugin and then tries to open the file with it. Supported formats:
- Adaptive Scalable Texture Compression (
*.astcor data with corresponding signature), loaded with AstcImporter or any other plugin that provides it - Basis Universal (
*.basisor data with corresponding signature), loaded with BasisImporter or any other plugin that provides it - Windows Bitmap (
*.bmpor data with corresponding signature), loaded with any plugin that providesBmpImporter - DirectDraw Surface (
*.ddsor data with corresponding signature), loaded with DdsImporter or any other plugin that provides it - Graphics Interchange Format (
*.gif), loaded with any plugin that providesGifImporter - OpenEXR (
*.exror data with corresponding signature), loaded with OpenExrImporter or any other plugin that provides it - Radiance HDR (
*.hdror data with corresponding signature), loaded with any plugin that providesHdrImporter - Windows icon/cursor (
*.ico,*.cur), loaded with IcoImporter or any other plugin that provides it - JPEG (
*.jpg,*.jpe,*.jpegor data with corresponding signature), loaded with JpegImporter or any other plugin that provides it - JPEG 2000 (
*.jp2), loaded with any plugin that providesJpeg2000Importer - KTX2 (
*.ktx2or data with corresponding signature), loaded with KtxImporter or any other plugin that provides it. If not found, BasisImporter is tried as a fallback. - Multiple-image Network Graphics (
*.mng), loaded with any plugin that providesMngImporter - Portable Bitmap, Graymap, Pixmap, Anymap (
*.pbm,*.pgm,*.ppm,*.pnm), loaded with any plugin that providesPbmImporter,PgmImporter,PpmImporterorPnmImporter, respectively - ZSoft PCX (
*.pcx), loaded with any plugin that providesPcxImporter - Softimage PIC (
*.pic), loaded with any plugin that providesPicImporter - Portable Network Graphics (
*.pngor data with corresponding signature), loaded with PngImporter or any other plugin that provides it - Adobe Photoshop (
*.psd), loaded with any plugin that providesPsdImporter - Silicon Graphics (
*.sgi,*.bw,*.rgb,*.rgba), loaded with any plugin that providesSgiImporter - Scalable Vector Graphics (
*.svg,*.svgz), loaded with any plugin that providesSvgImporter - Tagged Image File Format (
*.tif,*.tiffor data with corresponding signature), loaded with any plugin that providesTiffImporter - Truevision TGA (
*.tga,*.vda,*.icb,*.vstor data with corresponding signature), loaded with TgaImporter or any other plugin that provides it - OpenVDB (
*.vdb), loaded with any plugin that providesOpenVdbImporter - WebP (
*.webpor data with corresponding signature), loaded with WebPImporter or any other plugin that provides it
Detecting file type through openData() is supported only for a subset of formats that are marked as such in the list above. ImporterFeature::
Usage
This plugin depends on the Trade library and is built if MAGNUM_WITH_ANYIMAGEIMPORTER is enabled when building Magnum. To use as a dynamic plugin, load "AnyImageImporter" via Corrade::
Additionally, if you're using Magnum as a CMake subproject, do the following:
set(MAGNUM_WITH_ANYIMAGEIMPORTER ON CACHE BOOL "" FORCE) add_subdirectory(magnum EXCLUDE_FROM_ALL) # So the dynamically loaded plugin gets built implicitly add_dependencies(your-app Magnum::AnyImageImporter)
To use as a static plugin or as a dependency of another plugin with CMake, you need to request the AnyImageImporter component of the Magnum package and link to the Magnum::AnyImageImporter target:
find_package(Magnum REQUIRED AnyImageImporter) # ... target_link_libraries(your-app PRIVATE Magnum::AnyImageImporter)
See Downloading and building, Usage with CMake, Loading and using plugins and File format support for more information.
Interface proxying and option propagation
On a call to openFile() / openData(), a file format is detected from the extension / file signature and a corresponding plugin is loaded. After that, flags set via setFlags(), file callbacks set via setFileCallback() and options set through configuration() are propagated to the concrete implementation. A warning is emitted in case an option set is not present in the default configuration of the target plugin.
Calls to the image1DCount() / image2DCount() / image3DCount(), image1DLevelCount() / image2DLevelCount() / image3DLevelCount(), image1D() / image2D() / image3D() and importerState() functions are then proxied to the concrete implementation. The close() function closes and discards the internally instantiated plugin; isOpened() works as usual.
Besides delegating the flags, the AnyImageImporter itself recognizes ImporterFlag::
Base classes
- class AbstractImporter
- Base for importer plugins.
Constructors, destructors, conversion operators
-
AnyImageImporter(PluginManager::
Manager<AbstractImporter>& manager) explicit - Constructor with access to plugin manager.
-
AnyImageImporter(PluginManager::
AbstractManager& manager, const Containers:: StringView& plugin) explicit - Plugin manager constructor.
- AnyImageImporter(const AnyImageImporter&) deleted
- Copying is not allowed.
- AnyImageImporter(AnyImageImporter&&) noexcept
- Move constructor.
Public functions
- auto operator=(const AnyImageImporter&) -> AnyImageImporter& deleted
- Copying is not allowed.
- auto operator=(AnyImageImporter&&) -> AnyImageImporter& deleted
- Only move construction is allowed.
Function documentation
Magnum:: Trade:: AnyImageImporter:: AnyImageImporter(AnyImageImporter&&) noexcept
Move constructor.
See Corrade::