Browse Source

AnyImageImporter: recognize *.ico and *.cur files.

pull/449/head
Vladimír Vondruš 6 years ago
parent
commit
a66964898f
  1. 2
      doc/changelog.dox
  2. 3
      src/MagnumPlugins/AnyImageImporter/AnyImageImporter.cpp
  3. 2
      src/MagnumPlugins/AnyImageImporter/AnyImageImporter.h
  4. 1
      src/MagnumPlugins/AnyImageImporter/Test/AnyImageImporterTest.cpp
  5. 1
      src/MagnumPlugins/AnyImageImporter/Test/CMakeLists.txt
  6. BIN
      src/MagnumPlugins/AnyImageImporter/Test/pngs.ico

2
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

3
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"))

2
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

1
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"},

1
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

BIN
src/MagnumPlugins/AnyImageImporter/Test/pngs.ico

Binary file not shown.

After

Width:  |  Height:  |  Size: 974 B

Loading…
Cancel
Save