Magnum::Trade::TgaImporter class

TGA importer plugin.

Supports Truevision TGA (*.tga, *.vda, *.icb, *.vst) BGR, BGRA or grayscale images with 8 bits per channel.


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

Additionally, if you're using Magnum as a CMake subproject, do the following:

add_subdirectory(magnum EXCLUDE_FROM_ALL)

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

To use as a static plugin or use this as a dependency of another plugin with CMake, you need to request the TgaImporter component of the Magnum package and link to the Magnum::TgaImporter target:

find_package(Magnum REQUIRED TgaImporter)

# ...
target_link_libraries(your-app PRIVATE Magnum::TgaImporter)

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

Behavior and limitations

The images are imported with PixelFormat::RGB8Unorm, PixelFormat::RGBA8Unorm or PixelFormat::R8Unorm, respectively. Images are imported with default PixelStorage parameters except for alignment, which may be changed to 1 if the data require it.

RLE compression is supported, paletted images are not.

If a TGA 2 footer is recognized in the file, the optional extension and developer area blocks at the end of the file are ignored.

Base classes

class AbstractImporter
Base for importer plugins.

Constructors, destructors, conversion operators

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