From b25ab9d8098a34c775d46d58e9739f98f6aea293 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sat, 31 Jul 2021 10:41:48 +0200 Subject: [PATCH] AnyImageConverter: recognize KTX2 files. Preparing for the soon-to-be-merged KTX files. Not hooking up 1D/3D and the compressed APIs yet, doing that only when the plugins get merged so I have a way to test. --- src/MagnumPlugins/AnyImageConverter/AnyImageConverter.cpp | 2 ++ src/MagnumPlugins/AnyImageConverter/AnyImageConverter.h | 2 ++ .../AnyImageConverter/Test/AnyImageConverterTest.cpp | 1 + 3 files changed, 5 insertions(+) diff --git a/src/MagnumPlugins/AnyImageConverter/AnyImageConverter.cpp b/src/MagnumPlugins/AnyImageConverter/AnyImageConverter.cpp index 0f16b87eb..b68381258 100644 --- a/src/MagnumPlugins/AnyImageConverter/AnyImageConverter.cpp +++ b/src/MagnumPlugins/AnyImageConverter/AnyImageConverter.cpp @@ -92,6 +92,8 @@ bool AnyImageConverter::doConvertToFile(const ImageView2D& image, const Containe normalized.hasSuffix(".jpeg"_s) || normalized.hasSuffix(".jpe"_s)) plugin = "JpegImageConverter"_s; + else if(normalized.hasSuffix(".ktx2"_s)) + plugin = "KtxImageConverter"_s; else if(normalized.hasSuffix(".png"_s)) plugin = "PngImageConverter"_s; else if(normalized.hasSuffix(".tga"_s) || diff --git a/src/MagnumPlugins/AnyImageConverter/AnyImageConverter.h b/src/MagnumPlugins/AnyImageConverter/AnyImageConverter.h index 21fa44fac..715997a5f 100644 --- a/src/MagnumPlugins/AnyImageConverter/AnyImageConverter.h +++ b/src/MagnumPlugins/AnyImageConverter/AnyImageConverter.h @@ -66,6 +66,8 @@ tries to convert the file with it. Supported formats for uncompressed data: `HdrImageConverter` - JPEG (`*.jpg`, `*.jpe`, `*.jpeg`), converted with @ref JpegImageConverter or any other plugin that provides it +- KTX2 (`*.ktx2`), converted with any plugin that provides + `KtxImageConverter` - Portable Network Graphics (`*.png`), converted with @ref PngImageConverter or any other plugin that provides it - Truevision TGA (`*.tga`, `*.vda`, `*.icb`, `*.vst`), converted with diff --git a/src/MagnumPlugins/AnyImageConverter/Test/AnyImageConverterTest.cpp b/src/MagnumPlugins/AnyImageConverter/Test/AnyImageConverterTest.cpp index d9ccaafba..0d93c44a5 100644 --- a/src/MagnumPlugins/AnyImageConverter/Test/AnyImageConverterTest.cpp +++ b/src/MagnumPlugins/AnyImageConverter/Test/AnyImageConverterTest.cpp @@ -153,6 +153,7 @@ constexpr struct { {"JPEG", "file.jpg", "JpegImageConverter"}, {"JPEG weird extension", "file.jpe", "JpegImageConverter"}, {"JPEG uppercase", "output.JPG", "JpegImageConverter"}, + {"KTX2", "foo.ktx2", "KtxImageConverter"}, {"PNG", "file.png", "PngImageConverter"} };