Magnum::Trade::DdsImporter class

DDS image importer plugin.

Supports DirectDraw Surface images (*.dds) in the following formats:

  • DDS uncompressed RGB, RGBA, BGR, BGRA, grayscale
  • DDS compressed DXT1, DXT3, DXT5
  • DDS DXT10 with the following DXGI formats (TYPELESS formats are loaded as either PixelType::UnsignedByte, PixelType::UnsignedShort or PixelType::UnsignedInt):
    • D32_FLOAT
    • D16_UNORM
    • R8G8B8A8_(TYPELESS|UINT|SINT|UNORM|UNORM_SRGB|SNORM) (Notion of sRGB is discarded)
    • A8_UNORM (Loaded as PixelFormat::Red)

This plugin depends on the Trade library and is built if WITH_DDSIMPORTER is enabled when building Magnum Plugins. To use as a dynamic plugin, you need to load the "DdsImporter" plugin from MAGNUM_PLUGINS_IMPORTER_DIR. To use as a static plugin or as a dependency of another plugin with CMake, you need to request the DdsImporter component of the MagnumPlugins package in CMake and link to the MagnumPlugins::DdsImporter target. See Downloading and building plugins, Plugin usage with CMake and Loading and using plugins for more information.

The images are imported with PixelType::UnsignedByte type and PixelFormat::RGB, PixelFormat::RGBA, PixelFormat::Red for grayscale. BGR and BGRA images are converted to PixelFormat::RGB, PixelFormat::RGBA respectively. If the image is compressed, they are imported with CompressedPixelFormat::RGBAS3tcDxt1, CompressedPixelFormat::RGBAS3tcDxt3 and CompressedPixelFormat::RGBAS3tcDxt5.

In OpenGL ES 2.0 and WebGL 1.0, single- and two-component images use PixelFormat::Luminance and PixelFormat::LuminanceAlpha instead of PixelFormat::Red / PixelFormat::RG.

Note: Mipmaps are currently imported under separate image data ids. You may access them via image2D(UnsignedInt)/image3D(UnsignedInt) which will return the n-th mip, a bigger n indicating a smaller mip.

Base classes

class AbstractImporter
Base for importer plugins.

Constructors, destructors, conversion operators

DdsImporter() explicit
Default constructor.
DdsImporter(PluginManager::AbstractManager& manager, const std::string& plugin) explicit
Plugin manager constructor.

Private functions

auto doFeatures() const override -> Features virtual
Implementation for features()
auto doIsOpened() const override -> bool virtual
Implementation for isOpened()
void doClose() override virtual
Implementation for close()
void doOpenData(Containers::ArrayView<const char> data) override virtual
Implementation for openData()
auto doImage2DCount() const override -> UnsignedInt virtual
Implementation for image2DCount()
auto doImage2D(UnsignedInt id) override -> Containers::Optional<ImageData2D> virtual
Implementation for image2D()
auto doImage3DCount() const override -> UnsignedInt virtual
Implementation for image3DCount()
auto doImage3D(UnsignedInt id) override -> Containers::Optional<ImageData3D> virtual
Implementation for image3D()

Function documentation

UnsignedInt Magnum::Trade::DdsImporter::doImage2DCount() const override virtual private

Implementation for image2DCount()

Default implementation returns 0.

UnsignedInt Magnum::Trade::DdsImporter::doImage3DCount() const override virtual private

Implementation for image3DCount()

Default implementation returns 0.