Browse Source

TgaImporter, TgaImageConverter: use generic pixel formats.

And adapt the dependencies as well.
pull/233/head
Vladimír Vondruš 8 years ago
parent
commit
20799c1b17
  1. 10
      doc/changelog.dox
  2. 2
      src/MagnumPlugins/AnyImageConverter/Test/Test.cpp
  3. 2
      src/MagnumPlugins/MagnumFontConverter/MagnumFontConverter.cpp
  4. 3
      src/MagnumPlugins/MagnumFontConverter/Test/MagnumFontConverterGLTest.cpp
  5. 44
      src/MagnumPlugins/TgaImageConverter/Test/TgaImageConverterTest.cpp
  6. 38
      src/MagnumPlugins/TgaImageConverter/TgaImageConverter.cpp
  7. 5
      src/MagnumPlugins/TgaImageConverter/TgaImageConverter.h
  8. 13
      src/MagnumPlugins/TgaImporter/Test/TgaImporterTest.cpp
  9. 24
      src/MagnumPlugins/TgaImporter/TgaImporter.cpp
  10. 13
      src/MagnumPlugins/TgaImporter/TgaImporter.h

10
doc/changelog.dox

@ -135,6 +135,13 @@ See also:
now expect that the mesh is indexed (instead of silently not doing now expect that the mesh is indexed (instead of silently not doing
anything) anything)
@subsubsection changelog-latest-changes-plugins Plugins
- @ref Trade::TgaImporter "TgaImporter" and
@ref Trade::TgaImageConverter "TgaImageConverter" plugins now operate on
the generic @ref PixelFormat instead of GL-specific @ref GL::PixelFormat /
@ref GL::PixelType
@subsection changelog-latest-buildsystem Build system @subsection changelog-latest-buildsystem Build system
- The core @ref Magnum library is not depending on OpenGL anymore, all - The core @ref Magnum library is not depending on OpenGL anymore, all
@ -321,6 +328,9 @@ See also:
- Configuration value reader/writers are now for only - Configuration value reader/writers are now for only
@ref Magnum::MeshPrimitive and @ref Magnum::MeshIndexType, not for @ref Magnum::MeshPrimitive and @ref Magnum::MeshIndexType, not for
@ref GL::MeshPrimitive or @ref GL::MeshIndexType @ref GL::MeshPrimitive or @ref GL::MeshIndexType
- The @ref Trade::TgaImageConverter "TgaImageConverter" plugin no longer
accepts GL-specific pixel formats, only the non-deprecated values from the
generic @ref PixelFormat enum
- The @ref Image::pixelSize(), @ref ImageView::pixelSize(), - The @ref Image::pixelSize(), @ref ImageView::pixelSize(),
@ref Trade::ImageData::pixelSize() and @ref BufferImage::pixelSize() @ref Trade::ImageData::pixelSize() and @ref BufferImage::pixelSize()
functions now return @ref UnsignedInt instead of @cpp std::size_t @ce. functions now return @ref UnsignedInt instead of @cpp std::size_t @ce.

2
src/MagnumPlugins/AnyImageConverter/Test/Test.cpp

@ -73,7 +73,7 @@ namespace {
5, 6, 7, 6, 7, 8, 0, 0 5, 6, 7, 6, 7, 8, 0, 0
}; };
const ImageView2D Image{PixelFormat::RGB, PixelType::UnsignedByte, {2, 3}, Data}; const ImageView2D Image{PixelFormat::RGB8Unorm, {2, 3}, Data};
} }
void AnyImageConverterTest::tga() { void AnyImageConverterTest::tga() {

2
src/MagnumPlugins/MagnumFontConverter/MagnumFontConverter.cpp

@ -102,7 +102,7 @@ std::vector<std::pair<std::string, Containers::Array<char>>> MagnumFontConverter
std::copy(confStr.begin(), confStr.end(), confData.begin()); std::copy(confStr.begin(), confStr.end(), confData.begin());
/* Save cache image */ /* Save cache image */
Image2D image(PixelFormat::Red, PixelType::UnsignedByte); Image2D image{PixelFormat::R8Unorm};
cache.texture().image(0, image); cache.texture().image(0, image);
auto tgaData = Trade::TgaImageConverter().exportToData(image); auto tgaData = Trade::TgaImageConverter().exportToData(image);

3
src/MagnumPlugins/MagnumFontConverter/Test/MagnumFontConverterGLTest.cpp

@ -136,8 +136,7 @@ void MagnumFontConverterGLTest::exportFont() {
Containers::Optional<Trade::ImageData2D> image = importer->image2D(0); Containers::Optional<Trade::ImageData2D> image = importer->image2D(0);
CORRADE_VERIFY(image); CORRADE_VERIFY(image);
CORRADE_COMPARE(image->size(), Vector2i(256)); CORRADE_COMPARE(image->size(), Vector2i(256));
CORRADE_COMPARE(image->format(), PixelFormat::Red); CORRADE_COMPARE(image->format(), PixelFormat::R8Unorm);
CORRADE_COMPARE(image->type(), PixelType::UnsignedByte);
} }
}}} }}}

44
src/MagnumPlugins/TgaImageConverter/Test/TgaImageConverterTest.cpp

@ -44,7 +44,6 @@ struct TgaImageConverterTest: TestSuite::Tester {
explicit TgaImageConverterTest(); explicit TgaImageConverterTest();
void wrongFormat(); void wrongFormat();
void wrongType();
void rgb(); void rgb();
void rgba(); void rgba();
@ -71,19 +70,18 @@ namespace {
}; };
const ImageView2D OriginalRGB{PixelStorage{}.setSkip({0, 1, 0}), const ImageView2D OriginalRGB{PixelStorage{}.setSkip({0, 1, 0}),
PixelFormat::RGB, PixelType::UnsignedByte, {2, 3}, OriginalDataRGB}; PixelFormat::RGB8Unorm, {2, 3}, OriginalDataRGB};
constexpr char OriginalDataRGBA[] = { constexpr char OriginalDataRGBA[] = {
1, 2, 3, 4, 2, 3, 4, 5, 1, 2, 3, 4, 2, 3, 4, 5,
3, 4, 5, 6, 4, 5, 6, 7, 3, 4, 5, 6, 4, 5, 6, 7,
5, 6, 7, 8, 6, 7, 8, 9 5, 6, 7, 8, 6, 7, 8, 9
}; };
const ImageView2D OriginalRGBA{PixelFormat::RGBA, PixelType::UnsignedByte, {2, 3}, OriginalDataRGBA}; const ImageView2D OriginalRGBA{PixelFormat::RGBA8Unorm, {2, 3}, OriginalDataRGBA};
} }
TgaImageConverterTest::TgaImageConverterTest() { TgaImageConverterTest::TgaImageConverterTest() {
addTests({&TgaImageConverterTest::wrongFormat, addTests({&TgaImageConverterTest::wrongFormat,
&TgaImageConverterTest::wrongType,
&TgaImageConverterTest::rgb, &TgaImageConverterTest::rgb,
&TgaImageConverterTest::rgba}); &TgaImageConverterTest::rgba});
@ -100,13 +98,7 @@ TgaImageConverterTest::TgaImageConverterTest() {
} }
void TgaImageConverterTest::wrongFormat() { void TgaImageConverterTest::wrongFormat() {
ImageView2D image{ ImageView2D image{PixelFormat::RG8Unorm, {}, nullptr};
#if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2))
PixelFormat::RG,
#else
PixelFormat::LuminanceAlpha,
#endif
PixelType::UnsignedByte, {}, nullptr};
std::ostringstream out; std::ostringstream out;
Error redirectError{&out}; Error redirectError{&out};
@ -114,29 +106,7 @@ void TgaImageConverterTest::wrongFormat() {
std::unique_ptr<AbstractImageConverter> converter = _converterManager.instantiate("TgaImageConverter"); std::unique_ptr<AbstractImageConverter> converter = _converterManager.instantiate("TgaImageConverter");
const auto data = converter->exportToData(image); const auto data = converter->exportToData(image);
CORRADE_VERIFY(!data); CORRADE_VERIFY(!data);
#if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2)) CORRADE_COMPARE(out.str(), "Trade::TgaImageConverter::exportToData(): unsupported pixel format PixelFormat::RG8Unorm\n");
CORRADE_COMPARE(out.str(), "Trade::TgaImageConverter::exportToData(): unsupported color format GL::PixelFormat::RG\n");
#else
CORRADE_COMPARE(out.str(), "Trade::TgaImageConverter::exportToData(): unsupported color format GL::PixelFormat::LuminanceAlpha\n");
#endif
}
void TgaImageConverterTest::wrongType() {
ImageView2D image{
#if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2))
PixelFormat::Red,
#else
PixelFormat::Luminance,
#endif
PixelType::Float, {}, nullptr};
std::ostringstream out;
Error redirectError{&out};
std::unique_ptr<AbstractImageConverter> converter = _converterManager.instantiate("TgaImageConverter");
const auto data = converter->exportToData(image);
CORRADE_VERIFY(!data);
CORRADE_COMPARE(out.str(), "Trade::TgaImageConverter::exportToData(): unsupported color type GL::PixelType::Float\n");
} }
void TgaImageConverterTest::rgb() { void TgaImageConverterTest::rgb() {
@ -154,8 +124,7 @@ void TgaImageConverterTest::rgb() {
CORRADE_COMPARE(converted->storage().alignment(), 1); CORRADE_COMPARE(converted->storage().alignment(), 1);
CORRADE_COMPARE(converted->size(), Vector2i(2, 3)); CORRADE_COMPARE(converted->size(), Vector2i(2, 3));
CORRADE_COMPARE(converted->format(), PixelFormat::RGB); CORRADE_COMPARE(converted->format(), PixelFormat::RGB8Unorm);
CORRADE_COMPARE(converted->type(), PixelType::UnsignedByte);
CORRADE_COMPARE_AS(converted->data(), Containers::arrayView(ConvertedDataRGB), CORRADE_COMPARE_AS(converted->data(), Containers::arrayView(ConvertedDataRGB),
TestSuite::Compare::Container); TestSuite::Compare::Container);
} }
@ -175,8 +144,7 @@ void TgaImageConverterTest::rgba() {
CORRADE_COMPARE(converted->storage().alignment(), 4); CORRADE_COMPARE(converted->storage().alignment(), 4);
CORRADE_COMPARE(converted->size(), Vector2i(2, 3)); CORRADE_COMPARE(converted->size(), Vector2i(2, 3));
CORRADE_COMPARE(converted->format(), PixelFormat::RGBA); CORRADE_COMPARE(converted->format(), PixelFormat::RGBA8Unorm);
CORRADE_COMPARE(converted->type(), PixelType::UnsignedByte);
CORRADE_COMPARE_AS(converted->data(), Containers::arrayView(OriginalDataRGBA), CORRADE_COMPARE_AS(converted->data(), Containers::arrayView(OriginalDataRGBA),
TestSuite::Compare::Container); TestSuite::Compare::Container);
} }

38
src/MagnumPlugins/TgaImageConverter/TgaImageConverter.cpp

@ -46,25 +46,6 @@ TgaImageConverter::TgaImageConverter(PluginManager::AbstractManager& manager, co
auto TgaImageConverter::doFeatures() const -> Features { return Feature::ConvertData; } auto TgaImageConverter::doFeatures() const -> Features { return Feature::ConvertData; }
Containers::Array<char> TgaImageConverter::doExportToData(const ImageView2D& image) { Containers::Array<char> TgaImageConverter::doExportToData(const ImageView2D& image) {
if(image.format() != PixelFormat::RGB &&
image.format() != PixelFormat::RGBA
#if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2))
&& image.format() != PixelFormat::Red
#endif
#ifdef MAGNUM_TARGET_GLES2
&& image.format() != PixelFormat::Luminance
#endif
)
{
Error() << "Trade::TgaImageConverter::exportToData(): unsupported color format" << image.format();
return nullptr;
}
if(image.type() != PixelType::UnsignedByte) {
Error() << "Trade::TgaImageConverter::exportToData(): unsupported color type" << image.type();
return nullptr;
}
/* Initialize data buffer */ /* Initialize data buffer */
const auto pixelSize = UnsignedByte(image.pixelSize()); const auto pixelSize = UnsignedByte(image.pixelSize());
Containers::Array<char> data{Containers::ValueInit, sizeof(Implementation::TgaHeader) + pixelSize*image.size().product()}; Containers::Array<char> data{Containers::ValueInit, sizeof(Implementation::TgaHeader) + pixelSize*image.size().product()};
@ -72,19 +53,16 @@ Containers::Array<char> TgaImageConverter::doExportToData(const ImageView2D& ima
/* Fill header */ /* Fill header */
auto header = reinterpret_cast<Implementation::TgaHeader*>(data.begin()); auto header = reinterpret_cast<Implementation::TgaHeader*>(data.begin());
switch(image.format()) { switch(image.format()) {
case PixelFormat::RGB: case PixelFormat::RGB8Unorm:
case PixelFormat::RGBA: case PixelFormat::RGBA8Unorm:
header->imageType = 2; header->imageType = 2;
break; break;
#if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2)) case PixelFormat::R8Unorm:
case PixelFormat::Red:
#endif
#ifdef MAGNUM_TARGET_GLES2
case PixelFormat::Luminance:
#endif
header->imageType = 3; header->imageType = 3;
break; break;
default: CORRADE_ASSERT_UNREACHABLE(); /* LCOV_EXCL_LINE */ default:
Error() << "Trade::TgaImageConverter::exportToData(): unsupported pixel format" << image.format();
return nullptr;
} }
header->bpp = pixelSize*8; header->bpp = pixelSize*8;
header->width = UnsignedShort(Utility::Endianness::littleEndian(image.size().x())); header->width = UnsignedShort(Utility::Endianness::littleEndian(image.size().x()));
@ -101,11 +79,11 @@ Containers::Array<char> TgaImageConverter::doExportToData(const ImageView2D& ima
std::copy_n(imageData + y*rowStride, rowSize, data.begin() + sizeof(Implementation::TgaHeader) + y*rowSize); std::copy_n(imageData + y*rowStride, rowSize, data.begin() + sizeof(Implementation::TgaHeader) + y*rowSize);
} else std::copy_n(imageData, pixelSize*image.size().product(), data.begin() + sizeof(Implementation::TgaHeader)); } else std::copy_n(imageData, pixelSize*image.size().product(), data.begin() + sizeof(Implementation::TgaHeader));
if(image.format() == PixelFormat::RGB) { if(image.format() == PixelFormat::RGB8Unorm) {
auto pixels = reinterpret_cast<Math::Vector3<UnsignedByte>*>(data.begin()+sizeof(Implementation::TgaHeader)); auto pixels = reinterpret_cast<Math::Vector3<UnsignedByte>*>(data.begin()+sizeof(Implementation::TgaHeader));
std::transform(pixels, pixels + image.size().product(), pixels, std::transform(pixels, pixels + image.size().product(), pixels,
[](Math::Vector3<UnsignedByte> pixel) { return Math::swizzle<'b', 'g', 'r'>(pixel); }); [](Math::Vector3<UnsignedByte> pixel) { return Math::swizzle<'b', 'g', 'r'>(pixel); });
} else if(image.format() == PixelFormat::RGBA) { } else if(image.format() == PixelFormat::RGBA8Unorm) {
auto pixels = reinterpret_cast<Math::Vector4<UnsignedByte>*>(data.begin()+sizeof(Implementation::TgaHeader)); auto pixels = reinterpret_cast<Math::Vector4<UnsignedByte>*>(data.begin()+sizeof(Implementation::TgaHeader));
std::transform(pixels, pixels + image.size().product(), pixels, std::transform(pixels, pixels + image.size().product(), pixels,
[](Math::Vector4<UnsignedByte> pixel) { return Math::swizzle<'b', 'g', 'r', 'a'>(pixel); }); [](Math::Vector4<UnsignedByte> pixel) { return Math::swizzle<'b', 'g', 'r', 'a'>(pixel); });

5
src/MagnumPlugins/TgaImageConverter/TgaImageConverter.h

@ -55,9 +55,8 @@ namespace Magnum { namespace Trade {
@brief TGA image converter plugin @brief TGA image converter plugin
Creates Truevision TGA (`*.tga`) files from images with format Creates Truevision TGA (`*.tga`) files from images with format
@ref PixelFormat::RGB, @ref PixelFormat::RGBA or @ref PixelFormat::Red (or @ref PixelFormat::RGB8Unorm, @ref PixelFormat::RGBA8Unorm or
@ref PixelFormat::Luminance in OpenGL ES 2.0 and WebGL 1.0) and type @ref PixelFormat::R8Unorm.
@ref PixelType::UnsignedByte.
This plugin depends on the @ref Trade library and is built if This plugin depends on the @ref Trade library and is built if
`WITH_TGAIMAGECONVERTER` is enabled when building Magnum. To use as a dynamic `WITH_TGAIMAGECONVERTER` is enabled when building Magnum. To use as a dynamic

13
src/MagnumPlugins/TgaImporter/Test/TgaImporterTest.cpp

@ -140,9 +140,8 @@ void TgaImporterTest::colorBits24() {
Containers::Optional<Trade::ImageData2D> image = importer->image2D(0); Containers::Optional<Trade::ImageData2D> image = importer->image2D(0);
CORRADE_VERIFY(image); CORRADE_VERIFY(image);
CORRADE_COMPARE(image->storage().alignment(), 1); CORRADE_COMPARE(image->storage().alignment(), 1);
CORRADE_COMPARE(image->format(), PixelFormat::RGB); CORRADE_COMPARE(image->format(), PixelFormat::RGB8Unorm);
CORRADE_COMPARE(image->size(), Vector2i(2, 3)); CORRADE_COMPARE(image->size(), Vector2i(2, 3));
CORRADE_COMPARE(image->type(), PixelType::UnsignedByte);
CORRADE_COMPARE_AS(image->data(), Containers::arrayView(pixels), CORRADE_COMPARE_AS(image->data(), Containers::arrayView(pixels),
TestSuite::Compare::Container); TestSuite::Compare::Container);
} }
@ -165,9 +164,8 @@ void TgaImporterTest::colorBits32() {
Containers::Optional<Trade::ImageData2D> image = importer->image2D(0); Containers::Optional<Trade::ImageData2D> image = importer->image2D(0);
CORRADE_VERIFY(image); CORRADE_VERIFY(image);
CORRADE_COMPARE(image->storage().alignment(), 4); CORRADE_COMPARE(image->storage().alignment(), 4);
CORRADE_COMPARE(image->format(), PixelFormat::RGBA); CORRADE_COMPARE(image->format(), PixelFormat::RGBA8Unorm);
CORRADE_COMPARE(image->size(), Vector2i(2, 3)); CORRADE_COMPARE(image->size(), Vector2i(2, 3));
CORRADE_COMPARE(image->type(), PixelType::UnsignedByte);
CORRADE_COMPARE_AS(image->data(), Containers::arrayView(pixels), CORRADE_COMPARE_AS(image->data(), Containers::arrayView(pixels),
TestSuite::Compare::Container); TestSuite::Compare::Container);
} }
@ -185,13 +183,8 @@ void TgaImporterTest::grayscaleBits8() {
Containers::Optional<Trade::ImageData2D> image = importer->image2D(0); Containers::Optional<Trade::ImageData2D> image = importer->image2D(0);
CORRADE_VERIFY(image); CORRADE_VERIFY(image);
CORRADE_COMPARE(image->storage().alignment(), 1); CORRADE_COMPARE(image->storage().alignment(), 1);
#ifndef MAGNUM_TARGET_GLES2 CORRADE_COMPARE(image->format(), PixelFormat::R8Unorm);
CORRADE_COMPARE(image->format(), PixelFormat::Red);
#else
CORRADE_COMPARE(image->format(), PixelFormat::Luminance);
#endif
CORRADE_COMPARE(image->size(), Vector2i(2, 3)); CORRADE_COMPARE(image->size(), Vector2i(2, 3));
CORRADE_COMPARE(image->type(), PixelType::UnsignedByte);
CORRADE_COMPARE_AS(image->data(), Containers::arrayView(data).suffix(18), CORRADE_COMPARE_AS(image->data(), Containers::arrayView(data).suffix(18),
TestSuite::Compare::Container); TestSuite::Compare::Container);
} }

24
src/MagnumPlugins/TgaImporter/TgaImporter.cpp

@ -37,11 +37,6 @@
#include "Magnum/Trade/ImageData.h" #include "Magnum/Trade/ImageData.h"
#include "MagnumPlugins/TgaImporter/TgaHeader.h" #include "MagnumPlugins/TgaImporter/TgaHeader.h"
#ifdef MAGNUM_TARGET_GLES2
#include "Magnum/Context.h"
#include "Magnum/Extensions.h"
#endif
namespace Magnum { namespace Trade { namespace Magnum { namespace Trade {
TgaImporter::TgaImporter() = default; TgaImporter::TgaImporter() = default;
@ -87,10 +82,10 @@ Containers::Optional<ImageData2D> TgaImporter::doImage2D(UnsignedInt) {
if(header.imageType == 2) { if(header.imageType == 2) {
switch(header.bpp) { switch(header.bpp) {
case 24: case 24:
format = PixelFormat::RGB; format = PixelFormat::RGB8Unorm;
break; break;
case 32: case 32:
format = PixelFormat::RGBA; format = PixelFormat::RGBA8Unorm;
break; break;
default: default:
Error() << "Trade::TgaImporter::image2D(): unsupported color bits-per-pixel:" << header.bpp; Error() << "Trade::TgaImporter::image2D(): unsupported color bits-per-pixel:" << header.bpp;
@ -99,14 +94,7 @@ Containers::Optional<ImageData2D> TgaImporter::doImage2D(UnsignedInt) {
/* Grayscale */ /* Grayscale */
} else if(header.imageType == 3) { } else if(header.imageType == 3) {
#if defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL) format = PixelFormat::R8Unorm;
format = Context::hasCurrent() && Context::current().isExtensionSupported<Extensions::GL::EXT::texture_rg>() ?
PixelFormat::Red : PixelFormat::Luminance;
#elif !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2))
format = PixelFormat::Red;
#else
format = PixelFormat::Luminance;
#endif
if(header.bpp != 8) { if(header.bpp != 8) {
Error() << "Trade::TgaImporter::image2D(): unsupported grayscale bits-per-pixel:" << header.bpp; Error() << "Trade::TgaImporter::image2D(): unsupported grayscale bits-per-pixel:" << header.bpp;
return Containers::NullOpt; return Containers::NullOpt;
@ -126,17 +114,17 @@ Containers::Optional<ImageData2D> TgaImporter::doImage2D(UnsignedInt) {
if((size.x()*header.bpp/8)%4 != 0) if((size.x()*header.bpp/8)%4 != 0)
storage.setAlignment(1); storage.setAlignment(1);
if(format == PixelFormat::RGB) { if(format == PixelFormat::RGB8Unorm) {
auto pixels = reinterpret_cast<Math::Vector3<UnsignedByte>*>(data.data()); auto pixels = reinterpret_cast<Math::Vector3<UnsignedByte>*>(data.data());
std::transform(pixels, pixels + size.product(), pixels, std::transform(pixels, pixels + size.product(), pixels,
[](Math::Vector3<UnsignedByte> pixel) { return Math::swizzle<'b', 'g', 'r'>(pixel); }); [](Math::Vector3<UnsignedByte> pixel) { return Math::swizzle<'b', 'g', 'r'>(pixel); });
} else if(format == PixelFormat::RGBA) { } else if(format == PixelFormat::RGBA8Unorm) {
auto pixels = reinterpret_cast<Math::Vector4<UnsignedByte>*>(data.data()); auto pixels = reinterpret_cast<Math::Vector4<UnsignedByte>*>(data.data());
std::transform(pixels, pixels + size.product(), pixels, std::transform(pixels, pixels + size.product(), pixels,
[](Math::Vector4<UnsignedByte> pixel) { return Math::swizzle<'b', 'g', 'r', 'a'>(pixel); }); [](Math::Vector4<UnsignedByte> pixel) { return Math::swizzle<'b', 'g', 'r', 'a'>(pixel); });
} }
return ImageData2D{storage, format, PixelType::UnsignedByte, size, std::move(data)}; return ImageData2D{storage, format, size, std::move(data)};
} }
}} }}

13
src/MagnumPlugins/TgaImporter/TgaImporter.h

@ -68,15 +68,10 @@ need to request the `TgaImporter` component of the `Magnum` package and link to
the `Magnum::TgaImporter` target. See @ref building, @ref cmake and the `Magnum::TgaImporter` target. See @ref building, @ref cmake and
@ref plugins for more information. @ref plugins for more information.
The images are imported with @ref PixelType::UnsignedByte and @ref PixelFormat::RGB, The images are imported with @ref PixelFormat::RGB8Unorm,
@ref PixelFormat::RGBA or @ref PixelFormat::Red, respectively. Grayscale images @ref PixelFormat::RGBA8Unorm or @ref PixelFormat::R8Unorm, respectively. Images
require extension @extension{ARB,texture_rg}. Images are imported with default are imported with default @ref PixelStorage parameters except for alignment,
@ref PixelStorage parameters except for alignment, which may be changed to `1` which may be changed to `1` if the data require it.
if the data require it.
In OpenGL ES 2.0, if @extension{EXT,texture_rg} is not supported and in
WebGL 1.0, grayscale images use @ref PixelFormat::Luminance instead of
@ref PixelFormat::Red.
*/ */
class MAGNUM_TGAIMPORTER_EXPORT TgaImporter: public AbstractImporter { class MAGNUM_TGAIMPORTER_EXPORT TgaImporter: public AbstractImporter {
public: public:

Loading…
Cancel
Save