diff --git a/src/Plugins/MagnumFont/MagnumFont.cpp b/src/Plugins/MagnumFont/MagnumFont.cpp index 94590c4f2..e3a98809c 100644 --- a/src/Plugins/MagnumFont/MagnumFont.cpp +++ b/src/Plugins/MagnumFont/MagnumFont.cpp @@ -106,14 +106,13 @@ void MagnumFont::doOpenData(const std::vector image = importer.image2D(0); if(!image) { Error() << "Text::MagnumFont::openData(): cannot load image file"; return; } openInternal(std::move(conf), std::move(*image)); - delete image; } void MagnumFont::doOpenFile(const std::string& filename, Float) { @@ -138,14 +137,13 @@ void MagnumFont::doOpenFile(const std::string& filename, Float) { Error() << "Text::MagnumFont::openFile(): cannot open image file" << imageFilename; return; } - Trade::ImageData2D* image = importer.image2D(0); + std::optional image = importer.image2D(0); if(!image) { Error() << "Text::MagnumFont::openFile(): cannot load image file"; return; } openInternal(std::move(conf), std::move(*image)); - delete image; } void MagnumFont::openInternal(Utility::Configuration&& conf, Trade::ImageData2D&& image) { @@ -229,8 +227,8 @@ std::tuple MagnumFontLayouter::renderGlyph(Unsign const Rectangle texturePosition = Rectangle::fromSize(Vector2(position)/fontSize, Vector2(rectangle.size())/fontSize); - const Rectangle textureCoordinates(Vector2(rectangle.bottomLeft())/cache.textureSize(), - Vector2(rectangle.topRight())/cache.textureSize()); + const Rectangle textureCoordinates(Vector2(rectangle.bottomLeft())/Vector2(cache.textureSize()), + Vector2(rectangle.topRight())/Vector2(cache.textureSize())); /* Absolute quad position, composed from cursor position, glyph offset and texture position, denormalized to requested text size */ diff --git a/src/Plugins/MagnumFont/MagnumFont.h b/src/Plugins/MagnumFont/MagnumFont.h index 760eef1f7..18690b750 100644 --- a/src/Plugins/MagnumFont/MagnumFont.h +++ b/src/Plugins/MagnumFont/MagnumFont.h @@ -34,7 +34,15 @@ namespace Magnum { namespace Text { /** -@brief Simple bitmap font +@brief Simple bitmap font plugin + +This plugin depends on @ref Trade::TgaImporter "TgaImporter" plugin and is +built if `WITH_MAGNUMFONT` is enabled in CMake. To use dynamic plugin, you need +to load `%MagnumFont` plugin from `fonts/` subdirectory of your plugin dir. To +use static plugin or use this as a dependency of another plugin, you need to +request `%MagnumFont` component in CMake and link to +`${MAGNUMPLUGINS_MAGNUMFONT_LIBRARIES}`. See @ref building-plugins and +@ref cmake-plugins for more information. The font consists of two files, one text file containing character and glyph info and one TGA file containing the glyphs in distance field format. The font @@ -102,7 +110,7 @@ class MagnumFont: public AbstractFont { ~MagnumFont(); private: - class Data; + struct Data; Features doFeatures() const override; diff --git a/src/Plugins/MagnumFontConverter/MagnumFontConverter.cpp b/src/Plugins/MagnumFontConverter/MagnumFontConverter.cpp index 364f4745d..0e841fca3 100644 --- a/src/Plugins/MagnumFontConverter/MagnumFontConverter.cpp +++ b/src/Plugins/MagnumFontConverter/MagnumFontConverter.cpp @@ -27,8 +27,8 @@ #include #include #include +#include #include -#include #include #include #include @@ -43,7 +43,12 @@ auto MagnumFontConverter::doFeatures() const -> Features { return Feature::ExportFont|Feature::ConvertData|Feature::MultiFile; } -std::vector>> MagnumFontConverter::doExportFontToData(AbstractFont& font, GlyphCache& cache, const std::string& filename, const std::u32string& characters) const { +#ifndef _WIN32 +std::vector>> MagnumFontConverter::doExportFontToData(AbstractFont& font, GlyphCache& cache, const std::string& filename, const std::u32string& characters) const +#else +std::vector>> MagnumFontConverter::doExportFontToData(AbstractFont& font, GlyphCache& cache, const std::string& filename, const std::vector& characters) const +#endif +{ Utility::Configuration configuration; configuration.setValue("version", 1); @@ -97,7 +102,7 @@ std::vector>> MagnumFont std::copy(confStr.begin(), confStr.end(), confData.begin()); /* Save cache image */ - Image2D image(ImageFormat::Red, ImageType::UnsignedByte); + Image2D image(ColorFormat::Red, ColorType::UnsignedByte); cache.texture().image(0, image); auto tgaData = Trade::TgaImageConverter().exportToData(image); diff --git a/src/Plugins/MagnumFontConverter/MagnumFontConverter.h b/src/Plugins/MagnumFontConverter/MagnumFontConverter.h index 7b1be2ad2..8c363f84b 100644 --- a/src/Plugins/MagnumFontConverter/MagnumFontConverter.h +++ b/src/Plugins/MagnumFontConverter/MagnumFontConverter.h @@ -33,10 +33,20 @@ namespace Magnum { namespace Text { /** -@brief Converter to MagnumFont +@brief MagnumFont converter plugin Expects filename prefix, creates two files, `prefix.conf` and `prefix.tga`. See -MagnumFont for more information about the font. +@ref MagnumFont for more information about the font. + +This plugin is available only on desktop OpenGL, as it uses @ref Texture::image() +to read back the generated data. It depends on +@ref Trade::TgaImageConverter "TgaImageConverter" plugin and is built if +`WITH_MAGNUMFONTCONVERTER` is enabled in CMake. To use dynamic plugin, you need +to load `%MagnumFontConverter` plugin from `fontconverters/` subdirectory of +your plugin dir. To use static plugin or use this as a dependency of another +plugin, you need to request `%MagnumFontConverter` component in CMake and link +to `${MAGNUMPLUGINS_MAGNUMFONTCONVERTER_LIBRARIES}`. See @ref building-plugins +and @ref cmake-plugins for more information. */ class MagnumFontConverter: public Text::AbstractFontConverter { public: @@ -48,7 +58,11 @@ class MagnumFontConverter: public Text::AbstractFontConverter { private: Features doFeatures() const override; + #ifndef _WIN32 std::vector>> doExportFontToData(AbstractFont& font, GlyphCache& cache, const std::string& filename, const std::u32string& characters) const override; + #else + std::vector>> doExportFontToData(AbstractFont& font, GlyphCache& cache, const std::string& filename, const std::vector& characters) const override; + #endif }; }} diff --git a/src/Plugins/MagnumFontConverter/Test/MagnumFontConverterTest.cpp b/src/Plugins/MagnumFontConverter/Test/MagnumFontConverterTest.cpp index 2ef161a5a..9e00c415c 100644 --- a/src/Plugins/MagnumFontConverter/Test/MagnumFontConverterTest.cpp +++ b/src/Plugins/MagnumFontConverter/Test/MagnumFontConverterTest.cpp @@ -24,8 +24,8 @@ #include #include +#include #include -#include #include #include #include @@ -88,10 +88,11 @@ void MagnumFontConverterTest::exportFont() { /* Verify font image, no need to test image contents, as the image is garbage anyway */ Trade::TgaImporter importer; CORRADE_VERIFY(importer.openFile(Utility::Directory::join(MAGNUMFONTCONVERTER_TEST_WRITE_DIR, "font.tga"))); - Trade::ImageData2D* image = importer.image2D(0); + std::optional image = importer.image2D(0); + CORRADE_VERIFY(image); CORRADE_COMPARE(image->size(), Vector2i(256)); - CORRADE_COMPARE(image->format(), ImageFormat::Red); - CORRADE_COMPARE(image->type(), ImageType::UnsignedByte); + CORRADE_COMPARE(image->format(), ColorFormat::Red); + CORRADE_COMPARE(image->type(), ColorType::UnsignedByte); } }}} diff --git a/src/Plugins/TgaImageConverter/Test/TgaImageConverterTest.cpp b/src/Plugins/TgaImageConverter/Test/TgaImageConverterTest.cpp index e8ee0b5fb..20e1a5c77 100644 --- a/src/Plugins/TgaImageConverter/Test/TgaImageConverterTest.cpp +++ b/src/Plugins/TgaImageConverter/Test/TgaImageConverterTest.cpp @@ -27,8 +27,8 @@ #include #include #include +#include #include -#include #include #include #include @@ -49,9 +49,9 @@ class TgaImageConverterTest: public TestSuite::Tester { namespace { #ifndef MAGNUM_TARGET_GLES - const Image2D original(ImageFormat::BGR, ImageType::UnsignedByte, {2, 3}, new char[18] + const Image2D original(ColorFormat::BGR, ColorType::UnsignedByte, {2, 3}, new char[18] #else - const Image2D original(ImageFormat::RGB, ImageType::UnsignedByte, {2, 3}, new char[18] + const Image2D original(ColorFormat::RGB, ColorType::UnsignedByte, {2, 3}, new char[18] #endif { 1, 2, 3, 2, 3, 4, @@ -68,25 +68,25 @@ TgaImageConverterTest::TgaImageConverterTest() { } void TgaImageConverterTest::wrongFormat() { - ImageReference2D image(ImageFormat::RG, ImageType::UnsignedByte, {}, nullptr); + ImageReference2D image(ColorFormat::RG, ColorType::UnsignedByte, {}, nullptr); std::ostringstream out; Error::setOutput(&out); const auto data = TgaImageConverter().exportToData(image); CORRADE_VERIFY(!data); - CORRADE_COMPARE(out.str(), "Trade::TgaImageConverter::convertToData(): unsupported image format ImageFormat::RG\n"); + CORRADE_COMPARE(out.str(), "Trade::TgaImageConverter::convertToData(): unsupported image format ColorFormat::RG\n"); } void TgaImageConverterTest::wrongType() { - ImageReference2D image(ImageFormat::Red, ImageType::Float, {}, nullptr); + ImageReference2D image(ColorFormat::Red, ColorType::Float, {}, nullptr); std::ostringstream out; Error::setOutput(&out); const auto data = TgaImageConverter().exportToData(image); CORRADE_VERIFY(!data); - CORRADE_COMPARE(out.str(), "Trade::TgaImageConverter::convertToData(): unsupported image type ImageType::Float\n"); + CORRADE_COMPARE(out.str(), "Trade::TgaImageConverter::convertToData(): unsupported image type ColorType::Float\n"); } void TgaImageConverterTest::data() { @@ -94,16 +94,16 @@ void TgaImageConverterTest::data() { TgaImporter importer; CORRADE_VERIFY(importer.openData(data)); - Trade::ImageData2D* converted = importer.image2D(0); + std::optional converted = importer.image2D(0); CORRADE_VERIFY(converted); CORRADE_COMPARE(converted->size(), Vector2i(2, 3)); #ifndef MAGNUM_TARGET_GLES - CORRADE_COMPARE(converted->format(), ImageFormat::BGR); + CORRADE_COMPARE(converted->format(), ColorFormat::BGR); #else - CORRADE_COMPARE(converted->format(), ImageFormat::RGB); + CORRADE_COMPARE(converted->format(), ColorFormat::RGB); #endif - CORRADE_COMPARE(converted->type(), ImageType::UnsignedByte); + CORRADE_COMPARE(converted->type(), ColorType::UnsignedByte); CORRADE_COMPARE(std::string(reinterpret_cast(converted->data()), 2*3*3), std::string(reinterpret_cast(original.data()), 2*3*3)); } diff --git a/src/Plugins/TgaImageConverter/TgaImageConverter.cpp b/src/Plugins/TgaImageConverter/TgaImageConverter.cpp index 1e259fdc0..e273226ae 100644 --- a/src/Plugins/TgaImageConverter/TgaImageConverter.cpp +++ b/src/Plugins/TgaImageConverter/TgaImageConverter.cpp @@ -28,8 +28,8 @@ #include #include #include +#include #include -#include #ifdef MAGNUM_TARGET_GLES #include @@ -48,20 +48,20 @@ auto TgaImageConverter::doFeatures() const -> Features { return Feature::Convert Containers::Array TgaImageConverter::doExportToData(const ImageReference2D& image) const { #ifndef MAGNUM_TARGET_GLES - if(image.format() != ImageFormat::BGR && - image.format() != ImageFormat::BGRA && - image.format() != ImageFormat::Red) + if(image.format() != ColorFormat::BGR && + image.format() != ColorFormat::BGRA && + image.format() != ColorFormat::Red) #else - if(image.format() != ImageFormat::RGB && - image.format() != ImageFormat::RGBA && - image.format() != ImageFormat::Red) + if(image.format() != ColorFormat::RGB && + image.format() != ColorFormat::RGBA && + image.format() != ColorFormat::Red) #endif { Error() << "Trade::TgaImageConverter::convertToData(): unsupported image format" << image.format(); return nullptr; } - if(image.type() != ImageType::UnsignedByte) { + if(image.type() != ColorType::UnsignedByte) { Error() << "Trade::TgaImageConverter::convertToData(): unsupported image type" << image.type(); return nullptr; } @@ -72,7 +72,7 @@ Containers::Array TgaImageConverter::doExportToData(const ImageRe /* Fill header */ auto header = reinterpret_cast(data.begin()); - header->imageType = image.format() == ImageFormat::Red ? 3 : 2; + header->imageType = image.format() == ColorFormat::Red ? 3 : 2; header->bpp = pixelSize*8; header->width = Utility::Endianness::littleEndian(image.size().x()); header->height = Utility::Endianness::littleEndian(image.size().y()); @@ -81,11 +81,11 @@ Containers::Array TgaImageConverter::doExportToData(const ImageRe std::copy(image.data(), image.data()+pixelSize*image.size().product(), data.begin()+sizeof(TgaHeader)); #ifdef MAGNUM_TARGET_GLES - if(image->format() == ImageFormat::RGB) { + if(image->format() == ColorFormat::RGB) { auto pixels = reinterpret_cast*>(data.begin()+sizeof(TgaHeader)); std::transform(pixels, pixels + image.size().product(), pixels, [](Math::Vector3 pixel) { return swizzle<'b', 'g', 'r'>(pixel); }); - } else if(image.format() == ImageFormat::RGBA) { + } else if(image.format() == ColorFormat::RGBA) { auto pixels = reinterpret_cast*>(data.begin()+sizeof(TgaHeader)); std::transform(pixels, pixels + image.size().product(), pixels, [](Math::Vector4 pixel) { return swizzle<'b', 'g', 'r', 'a'>(pixel); }); diff --git a/src/Plugins/TgaImageConverter/TgaImageConverter.h b/src/Plugins/TgaImageConverter/TgaImageConverter.h index 1379582cb..face4c643 100644 --- a/src/Plugins/TgaImageConverter/TgaImageConverter.h +++ b/src/Plugins/TgaImageConverter/TgaImageConverter.h @@ -42,10 +42,17 @@ namespace Magnum { namespace Trade { /** -@brief TGA image converter +@brief TGA image converter plugin -Supports images with format @ref ImageFormat::BGR, @ref ImageFormat::BGRA or -@ref ImageFormat::Red and type @ref ImageType::UnsignedByte. +Supports images with format @ref ColorFormat::BGR, @ref ColorFormat::BGRA or +@ref ColorFormat::Red and type @ref ColorType::UnsignedByte. + +This plugin is built if `WITH_TGAIMAGECONVERTER` is enabled in CMake. To use +dynamic plugin, you need to load `%TgaImageConverter` plugin from +`imageconverters/` subdirectory of your plugin dir. To use static plugin or use +this as a dependency of another plugin, you need to request `%TgaImageConverter` +component in CMake and link to `${MAGNUMPLUGINS_TGAIMAGECONVERTER_LIBRARIES}`. +See @ref building-plugins and @ref cmake-plugins for more information. */ class MAGNUM_TRADE_TGAIMAGECONVERTER_EXPORT TgaImageConverter: public AbstractImageConverter { public: diff --git a/src/Plugins/TgaImporter/Test/TgaImporterTest.cpp b/src/Plugins/TgaImporter/Test/TgaImporterTest.cpp index fb9738344..7f08d8c62 100644 --- a/src/Plugins/TgaImporter/Test/TgaImporterTest.cpp +++ b/src/Plugins/TgaImporter/Test/TgaImporterTest.cpp @@ -26,7 +26,7 @@ #include #include #include -#include +#include #include #include "TgaImporter/TgaImporter.h" @@ -142,18 +142,16 @@ void TgaImporterTest::colorBits24() { #endif CORRADE_VERIFY(importer.openData(data)); - Trade::ImageData2D* image = importer.image2D(0); + std::optional image = importer.image2D(0); CORRADE_VERIFY(image); #ifndef MAGNUM_TARGET_GLES - CORRADE_COMPARE(image->format(), ImageFormat::BGR); + CORRADE_COMPARE(image->format(), ColorFormat::BGR); #else - CORRADE_COMPARE(image->format(), ImageFormat::RGB); + CORRADE_COMPARE(image->format(), ColorFormat::RGB); #endif CORRADE_COMPARE(image->size(), Vector2i(2, 3)); - CORRADE_COMPARE(image->type(), ImageType::UnsignedByte); + CORRADE_COMPARE(image->type(), ColorType::UnsignedByte); CORRADE_COMPARE(std::string(reinterpret_cast(image->data()), 2*3*3), std::string(pixels, 2*3*3)); - - delete image; } void TgaImporterTest::colorBits32() { @@ -175,18 +173,16 @@ void TgaImporterTest::colorBits32() { #endif CORRADE_VERIFY(importer.openData(data)); - Trade::ImageData2D* image = importer.image2D(0); + std::optional image = importer.image2D(0); CORRADE_VERIFY(image); #ifndef MAGNUM_TARGET_GLES - CORRADE_COMPARE(image->format(), ImageFormat::BGRA); + CORRADE_COMPARE(image->format(), ColorFormat::BGRA); #else - CORRADE_COMPARE(image->format(), ImageFormat::RGBA); + CORRADE_COMPARE(image->format(), ColorFormat::RGBA); #endif CORRADE_COMPARE(image->size(), Vector2i(2, 3)); - CORRADE_COMPARE(image->type(), ImageType::UnsignedByte); + CORRADE_COMPARE(image->type(), ColorType::UnsignedByte); CORRADE_COMPARE(std::string(reinterpret_cast(image->data()), 2*3*3), std::string(pixels, 2*3*3)); - - delete image; } void TgaImporterTest::grayscaleBits8() { @@ -199,11 +195,11 @@ void TgaImporterTest::grayscaleBits8() { }; CORRADE_VERIFY(importer.openData(data)); - Trade::ImageData2D* image = importer.image2D(0); + std::optional image = importer.image2D(0); CORRADE_VERIFY(image); - CORRADE_COMPARE(image->format(), ImageFormat::Red); + CORRADE_COMPARE(image->format(), ColorFormat::Red); CORRADE_COMPARE(image->size(), Vector2i(2, 3)); - CORRADE_COMPARE(image->type(), ImageType::UnsignedByte); + CORRADE_COMPARE(image->type(), ColorType::UnsignedByte); CORRADE_COMPARE(std::string(reinterpret_cast(image->data()), 2*3), std::string(reinterpret_cast(data) + 18, 2*3)); } @@ -229,11 +225,11 @@ void TgaImporterTest::file() { }; CORRADE_VERIFY(importer.openFile(Utility::Directory::join(TGAIMPORTER_TEST_DIR, "file.tga"))); - Trade::ImageData2D* image = importer.image2D(0); + std::optional image = importer.image2D(0); CORRADE_VERIFY(image); - CORRADE_COMPARE(image->format(), ImageFormat::Red); + CORRADE_COMPARE(image->format(), ColorFormat::Red); CORRADE_COMPARE(image->size(), Vector2i(2, 3)); - CORRADE_COMPARE(image->type(), ImageType::UnsignedByte); + CORRADE_COMPARE(image->type(), ColorType::UnsignedByte); CORRADE_COMPARE(std::string(reinterpret_cast(image->data()), 2*3), std::string(reinterpret_cast(data) + 18, 2*3)); } diff --git a/src/Plugins/TgaImporter/TgaImporter.cpp b/src/Plugins/TgaImporter/TgaImporter.cpp index 555b6b83f..b941d19c3 100644 --- a/src/Plugins/TgaImporter/TgaImporter.cpp +++ b/src/Plugins/TgaImporter/TgaImporter.cpp @@ -28,7 +28,7 @@ #include #include #include -#include +#include #include #ifdef MAGNUM_TARGET_GLES @@ -81,14 +81,14 @@ void TgaImporter::doClose() { UnsignedInt TgaImporter::doImage2DCount() const { return 1; } -ImageData2D* TgaImporter::doImage2D(UnsignedInt) { +std::optional TgaImporter::doImage2D(UnsignedInt) { /* Check if the file is long enough */ in->seekg(0, std::istream::end); std::streampos filesize = in->tellg(); in->seekg(0, std::istream::beg); if(filesize < std::streampos(sizeof(TgaHeader))) { Error() << "Trade::TgaImporter::image2D(): the file is too short:" << filesize << "bytes"; - return nullptr; + return std::nullopt; } TgaHeader header; @@ -99,10 +99,10 @@ ImageData2D* TgaImporter::doImage2D(UnsignedInt) { header.height = Utility::Endianness::littleEndian(header.height); /* Image format */ - ImageFormat format; + ColorFormat format; if(header.colorMapType != 0) { Error() << "Trade::TgaImporter::image2D(): paletted files are not supported"; - return nullptr; + return std::nullopt; } /* Color */ @@ -110,40 +110,40 @@ ImageData2D* TgaImporter::doImage2D(UnsignedInt) { switch(header.bpp) { case 24: #ifndef MAGNUM_TARGET_GLES - format = ImageFormat::BGR; + format = ColorFormat::BGR; #else - format = ImageFormat::RGB; + format = ColorFormat::RGB; #endif break; case 32: #ifndef MAGNUM_TARGET_GLES - format = ImageFormat::BGRA; + format = ColorFormat::BGRA; #else - format = ImageFormat::RGBA; + format = ColorFormat::RGBA; #endif break; default: Error() << "Trade::TgaImporter::image2D(): unsupported color bits-per-pixel:" << header.bpp; - return nullptr; + return std::nullopt; } /* Grayscale */ } else if(header.imageType == 3) { #ifdef MAGNUM_TARGET_GLES format = Context::current() && Context::current()->isExtensionSupported() ? - ImageFormat::Red : ImageFormat::Luminance; + ColorFormat::Red : ColorFormat::Luminance; #else - format = ImageFormat::Red; + format = ColorFormat::Red; #endif if(header.bpp != 8) { Error() << "Trade::TgaImporter::image2D(): unsupported grayscale bits-per-pixel:" << header.bpp; - return nullptr; + return std::nullopt; } /* Compressed files */ } else { Error() << "Trade::TgaImporter::image2D(): unsupported (compressed?) image type:" << header.imageType; - return nullptr; + return std::nullopt; } const std::size_t dataSize = header.width*header.height*header.bpp/8; @@ -153,16 +153,16 @@ ImageData2D* TgaImporter::doImage2D(UnsignedInt) { Vector2i size(header.width, header.height); #ifdef MAGNUM_TARGET_GLES - if(format == ImageFormat::RGB) { + if(format == ColorFormat::RGB) { auto pixels = reinterpret_cast*>(data); std::transform(pixels, pixels + size.product(), pixels, bgr); - } else if(format == ImageFormat::RGBA) { + } else if(format == ColorFormat::RGBA) { auto pixels = reinterpret_cast*>(data); std::transform(pixels, pixels + size.product(), pixels, bgra); } #endif - return new ImageData2D(format, ImageType::UnsignedByte, size, data); + return ImageData2D(format, ColorType::UnsignedByte, size, data); } }} diff --git a/src/Plugins/TgaImporter/TgaImporter.h b/src/Plugins/TgaImporter/TgaImporter.h index 0e08b168d..95deeeebb 100644 --- a/src/Plugins/TgaImporter/TgaImporter.h +++ b/src/Plugins/TgaImporter/TgaImporter.h @@ -43,18 +43,25 @@ namespace Magnum { namespace Trade { /** -@brief TGA image importer +@brief TGA importer plugin Supports uncompressed BGR, BGRA or grayscale images with 8 bits per channel. -The images are imported with @ref ImageType::UnsignedByte and @ref ImageFormat::BGR, -@ref ImageFormat::BGRA or @ref ImageFormat::Red, respectively. Grayscale images +This plugin is built if `WITH_TGAIMPORTER` is enabled in CMake. To use dynamic +plugin, you need to load `%TgaImporter` plugin from `importers/` subdirectory +of your plugin dir. To use static plugin or use this as a dependency of another +plugin, you need to request `%TgaImporter` component in CMake and link to +`${MAGNUMPLUGINS_TGAIMPORTER_LIBRARIES}`. See @ref building-plugins and +@ref cmake-plugins for more information. + +The images are imported with @ref ColorType::UnsignedByte and @ref ColorFormat::BGR, +@ref ColorFormat::BGRA or @ref ColorFormat::Red, respectively. Grayscale images require extension @extension{ARB,texture_rg}. -In OpenGL ES BGR and BGRA images are converted to @ref ImageFormat::RGB -and @ref ImageFormat::RGBA. In OpenGL ES 2.0, if @es_extension{EXT,texture_rg} -is not supported, grayscale images use @ref ImageFormat::Luminance instead of -@ref ImageFormat::Red. +In OpenGL ES BGR and BGRA images are converted to @ref ColorFormat::RGB +and @ref ColorFormat::RGBA. In OpenGL ES 2.0, if @es_extension{EXT,texture_rg} +is not supported, grayscale images use @ref ColorFormat::Luminance instead of +@ref ColorFormat::Red. */ class MAGNUM_TRADE_TGAIMPORTER_EXPORT TgaImporter: public AbstractImporter { public: @@ -73,7 +80,7 @@ class MAGNUM_TRADE_TGAIMPORTER_EXPORT TgaImporter: public AbstractImporter { void MAGNUM_TRADE_TGAIMPORTER_LOCAL doOpenFile(const std::string& filename) override; void MAGNUM_TRADE_TGAIMPORTER_LOCAL doClose() override; UnsignedInt MAGNUM_TRADE_TGAIMPORTER_LOCAL doImage2DCount() const override; - ImageData2D MAGNUM_TRADE_TGAIMPORTER_LOCAL * doImage2D(UnsignedInt id) override; + std::optional MAGNUM_TRADE_TGAIMPORTER_LOCAL doImage2D(UnsignedInt id) override; std::istream* in; }; diff --git a/src/Plugins/WavAudioImporter/CMakeLists.txt b/src/Plugins/WavAudioImporter/CMakeLists.txt index 0d2e69d3d..71bce608f 100644 --- a/src/Plugins/WavAudioImporter/CMakeLists.txt +++ b/src/Plugins/WavAudioImporter/CMakeLists.txt @@ -40,7 +40,7 @@ add_plugin(WavAudioImporter ${MAGNUM_PLUGINS_AUDIOIMPORTER_INSTALL_DIR} WavAudioImporter.conf $ pluginRegistrationWavAudioImporter.cpp) -target_link_libraries(WavAudioImporter ${MAGNUM_AUDIO_LIBRARIES}) +target_link_libraries(WavAudioImporter ${MAGNUM_LIBRARIES} ${MAGNUM_AUDIO_LIBRARIES}) install(FILES ${WavAudioImporter_HEADERS} DESTINATION ${MAGNUM_PLUGINS_INCLUDE_INSTALL_DIR}/WavAudioImporter) diff --git a/src/Plugins/WavAudioImporter/WavImporter.h b/src/Plugins/WavAudioImporter/WavImporter.h index 770461bbb..fe7f8010e 100644 --- a/src/Plugins/WavAudioImporter/WavImporter.h +++ b/src/Plugins/WavAudioImporter/WavImporter.h @@ -35,11 +35,18 @@ namespace Magnum { namespace Audio { /** -@brief WAV importer +@brief WAV importer plugin Supports mono and stereo PCM files with 8 or 16 bits per channel. The files are imported with @ref Buffer::Format::Mono8, @ref Buffer::Format::Mono16, @ref Buffer::Format::Stereo8 or @ref Buffer::Format::Stereo16, respectively. + +This plugin is built if `WITH_WAVAUDIOIMPORTER` is enabled in CMake. To use +dynamic plugin, you need to load `%WavAudioImporter` plugin from `audioimporters/` +subdirectory of your plugin dir. To use static plugin or or use this as a +dependency of another plugin, you need to request `%WavAudioImporter` component +in CMake and link to `${MAGNUMPLUGINS_WAVAUDIOIMPORTER_LIBRARIES}`. See +@ref building-plugins and @ref cmake-plugins for more information. */ class WavImporter: public AbstractImporter { public: