Magnum::Trade::IcoImporter class new in 2020.06

ICO importer plugin.

Loads Windows icon/cursor (*.ico / *.cur) files with embedded PNGs.


This plugin depends on the Trade library and is built if MAGNUM_WITH_ICOIMPORTER is enabled when building Magnum Plugins. To use as a dynamic plugin, load "IcoImporter" via Corrade::PluginManager::Manager.

Additionally, if you're using Magnum as a CMake subproject, bundle the magnum-plugins repository and do the following:

add_subdirectory(magnum-plugins EXCLUDE_FROM_ALL)

# So the dynamically loaded plugin gets built implicitly
add_dependencies(your-app MagnumPlugins::IcoImporter)

To use as a static plugin or as a dependency of another plugin with CMake, put FindMagnumPlugins.cmake into your modules/ directory, request the IcoImporter component of the MagnumPlugins package in CMake and link to the MagnumPlugins::IcoImporter target:

find_package(MagnumPlugins REQUIRED IcoImporter)

# ...
target_link_libraries(your-app PRIVATE MagnumPlugins::IcoImporter)

See Downloading and building plugins, Plugin usage with CMake, Loading and using plugins and File format support for more information.

Behavior and limitations

The importer will report count of all icon sizes in image2DLevelCount() and you can then import each using the second parameter of image2D(). Currently, only embedded PNGs are supported — for them it will delegate loading to any plugin that provides PngImporter; for images that are BMPs, image2D() will fail. You can use DevIlImageImporter in that case instead, but please be aware of its limitations.

Base classes

class AbstractImporter
Base for importer plugins.

Constructors, destructors, conversion operators

IcoImporter() explicit
Default constructor.
IcoImporter(PluginManager::AbstractManager& manager, const Containers::StringView& plugin) explicit
Plugin manager constructor.