From a66964898fba7206855d8d91e23a57c255ed3368 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sat, 30 May 2020 23:36:26 +0200 Subject: [PATCH] AnyImageImporter: recognize *.ico and *.cur files. --- doc/changelog.dox | 2 ++ .../AnyImageImporter/AnyImageImporter.cpp | 3 +++ .../AnyImageImporter/AnyImageImporter.h | 2 ++ .../Test/AnyImageImporterTest.cpp | 1 + .../AnyImageImporter/Test/CMakeLists.txt | 1 + src/MagnumPlugins/AnyImageImporter/Test/pngs.ico | Bin 0 -> 974 bytes 6 files changed, 9 insertions(+) create mode 100644 src/MagnumPlugins/AnyImageImporter/Test/pngs.ico diff --git a/doc/changelog.dox b/doc/changelog.dox index 420007ee0..2e2f1a08d 100644 --- a/doc/changelog.dox +++ b/doc/changelog.dox @@ -459,6 +459,8 @@ See also: @ref Trade::AnimationTrackType out of it - New convenience @ref Trade::AnimationData constructors taking an @ref std::initializer_list of @ref Trade::AnimationTrackData +- Recognizing `*.ico` and `*.cur` files in + @ref Trade::AnyImageImporter "AnyImageImporter" @subsection changelog-latest-buildsystem Build system diff --git a/src/MagnumPlugins/AnyImageImporter/AnyImageImporter.cpp b/src/MagnumPlugins/AnyImageImporter/AnyImageImporter.cpp index 76a9da075..d4ab0636a 100644 --- a/src/MagnumPlugins/AnyImageImporter/AnyImageImporter.cpp +++ b/src/MagnumPlugins/AnyImageImporter/AnyImageImporter.cpp @@ -72,6 +72,9 @@ void AnyImageImporter::doOpenFile(const std::string& filename) { plugin = "GifImporter"; else if(Utility::String::endsWith(normalized, ".hdr")) plugin = "HdrImporter"; + else if(Utility::String::endsWith(normalized, ".ico") || + Utility::String::endsWith(normalized, ".cur")) + plugin = "IcoImporter"; else if(Utility::String::endsWith(normalized, ".jpg") || Utility::String::endsWith(normalized, ".jpeg") || Utility::String::endsWith(normalized, ".jpe")) diff --git a/src/MagnumPlugins/AnyImageImporter/AnyImageImporter.h b/src/MagnumPlugins/AnyImageImporter/AnyImageImporter.h index 110d172f3..8296e4719 100644 --- a/src/MagnumPlugins/AnyImageImporter/AnyImageImporter.h +++ b/src/MagnumPlugins/AnyImageImporter/AnyImageImporter.h @@ -67,6 +67,8 @@ tries to open the file with it. Supported formats: plugin that provides `OpenExrImporter` - Radiance HDR (`*.hdr` or data with corresponding signature), loaded with any plugin that provides `HdrImporter` +- Windows icon/cursor (`*.ico`, `*.cur`), loaded with @ref IcoImporter or any + other plugin that provides it - JPEG (`*.jpg`, `*.jpe`, `*.jpeg` or data with corresponding signature), loaded with @ref JpegImporter or any other plugin that provides it - JPEG 2000 (`*.jp2`), loaded with any plugin that provides diff --git a/src/MagnumPlugins/AnyImageImporter/Test/AnyImageImporterTest.cpp b/src/MagnumPlugins/AnyImageImporter/Test/AnyImageImporterTest.cpp index 87df72535..dd9f342be 100644 --- a/src/MagnumPlugins/AnyImageImporter/Test/AnyImageImporterTest.cpp +++ b/src/MagnumPlugins/AnyImageImporter/Test/AnyImageImporterTest.cpp @@ -85,6 +85,7 @@ constexpr struct { {"EXR data", "image.exr", fileCallback, "OpenExrImporter"}, {"HDR", "rgb.hdr", nullptr, "HdrImporter"}, {"HDR data", "rgb.hdr", fileCallback, "HdrImporter"}, + {"ICO", "pngs.ico", nullptr, "IcoImporter"}, {"DDS", "rgba_dxt1.dds", nullptr, "DdsImporter"}, {"DDS data", "rgba_dxt1.dds", fileCallback, "DdsImporter"}, {"BMP", "image.bmp", nullptr, "BmpImporter"}, diff --git a/src/MagnumPlugins/AnyImageImporter/Test/CMakeLists.txt b/src/MagnumPlugins/AnyImageImporter/Test/CMakeLists.txt index e11de6a81..f8d47fcc4 100644 --- a/src/MagnumPlugins/AnyImageImporter/Test/CMakeLists.txt +++ b/src/MagnumPlugins/AnyImageImporter/Test/CMakeLists.txt @@ -53,6 +53,7 @@ corrade_add_test(AnyImageImporterTest AnyImageImporterTest.cpp FILES gray.jpg image.exr + pngs.ico rgb.basis rgb.hdr rgb.png diff --git a/src/MagnumPlugins/AnyImageImporter/Test/pngs.ico b/src/MagnumPlugins/AnyImageImporter/Test/pngs.ico new file mode 100644 index 0000000000000000000000000000000000000000..695e1a0a6b253749abc1270a0d04fabcf1967f5a GIT binary patch literal 974 zcmZQzU}RusVB=r_gEk;(2E=R-E<+v@1H&F5o5=x40KpO<)?#L0=nU|4=jD>(0&;mh zJzRo-v;YuuZ~)aa)Qh}00HinzJR*x382Ao@Fyrz36)8YL$r9IylHmNblJdl&REF~M za=pyF?Be9af>gcyqV(DCY@~pSggspxLnJOIr~EkYAe10;)q$Ir;p!(2#`-rkyg+FN zPgg&ebxsLQn66+1$}%#5U2$2!-Vn$m+ZBwzL9VE{_4cwOC(vgH4t&*Ln{QlEz{$3n zO>Qy+a|7c6h6Dx!1_=fpU~o~JOB+)W?&YMF!=Y9*FsjfpctEyLKhR;pbDYUKi|=qDwqjlmF<+9D3WJ!=R|;vCEd&*Dvj4?13w$|%coRS@7{ YVQO?hrVegjpti<=@h$tLTx2%_03yo3IRF3v literal 0 HcmV?d00001