Compare commits
99 Commits
Author | SHA1 | Date | |
---|---|---|---|
bb17f7bf84 | |||
b849e48ef4 | |||
81b7263d73 | |||
63e21ee5f3 | |||
06f097046c | |||
950ed43623 | |||
863c424390 | |||
bd083ff354 | |||
99663607b2 | |||
7499e3b8d4 | |||
cb5ca7fc48 | |||
4f61e3912c | |||
b8a9c75c80 | |||
4995c9cd15 | |||
a54c5e876c | |||
6c1a7ad339 | |||
c721fa481b | |||
ea15fed399 | |||
c2fabef501 | |||
5b2c190823 | |||
1b94554323 | |||
c2c12b1d7e | |||
c169296fbf | |||
29aec82e67 | |||
95ee381195 | |||
8e5951471d | |||
0710bc65f6 | |||
4be09ba419 | |||
6cbdf9cf54 | |||
7d6de20e8c | |||
b37c991e39 | |||
249046f25d | |||
9f7b1b8dee | |||
f065104b72 | |||
f34185197a | |||
9f24023ca7 | |||
8d1ef536be | |||
da8ed31aec | |||
ce8383e5fd | |||
db0adee62f | |||
91a342e90d | |||
7864ad4bc6 | |||
524711f633 | |||
b8b980f400 | |||
d932e0d16b | |||
18ea0492bc | |||
7899c27a80 | |||
6a51407556 | |||
75e1280073 | |||
0a6fbd88e9 | |||
fbf60f8bbb | |||
2799382c21 | |||
adc7da4f41 | |||
ac808679cd | |||
2aea982e9e | |||
9173f02ea3 | |||
4badb3088e | |||
8dc685df26 | |||
4bd9d5baec | |||
79e8e183eb | |||
7d63a1d8fa | |||
c11c5eff4f | |||
c02bf3dbcc | |||
6254529d2d | |||
35ff3efbbc | |||
7a0d95af92 | |||
4c3ade04dd | |||
b209e54b6f | |||
4dc2099fa4 | |||
491b223c15 | |||
6559bf8994 | |||
34ed3bad27 | |||
9c579fc1f8 | |||
93adb22632 | |||
d57ff91f8b | |||
edd6adcbac | |||
d787c12727 | |||
c9fec5e408 | |||
e60dfd4968 | |||
f5a9dd46d2 | |||
41f0411b62 | |||
e1a3751936 | |||
402dfb5de3 | |||
a3f7c03b61 | |||
20cec27ae8 | |||
d34c1668aa | |||
560d0483ae | |||
085c9c4841 | |||
b654f20ece | |||
21211cd63b | |||
5cc7a2b45c | |||
4451737d2f | |||
01ab0876f1 | |||
a67dcac7d1 | |||
cef8d08ad4 | |||
a4b9dd9400 | |||
6e6c1ab5f4 | |||
f205adf2e0 | |||
14742cb502 |
@ -4,8 +4,7 @@
|
||||
include:
|
||||
- project: sysadmin/ci-utilities
|
||||
file:
|
||||
- /gitlab-templates/linux.yml
|
||||
- /gitlab-templates/linux-static.yml
|
||||
- /gitlab-templates/freebsd.yml
|
||||
- /gitlab-templates/windows.yml
|
||||
- /gitlab-templates/windows-static.yml
|
||||
- /gitlab-templates/linux-qt6.yml
|
||||
- /gitlab-templates/android-qt6.yml
|
||||
- /gitlab-templates/freebsd-qt6.yml
|
||||
- /gitlab-templates/windows-qt6.yml
|
||||
|
@ -1,5 +1,5 @@
|
||||
Dependencies:
|
||||
- 'on': ['Linux', 'FreeBSD', 'macOS', 'Windows']
|
||||
- 'on': ['Linux', 'FreeBSD', 'macOS', 'Windows', 'Android']
|
||||
'require':
|
||||
'frameworks/extra-cmake-modules': '@same'
|
||||
'frameworks/karchive' : '@same'
|
||||
|
@ -1,9 +1,11 @@
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
|
||||
project(KImageFormats)
|
||||
set(KF_VERSION "6.4.0") # handled by release scripts
|
||||
set(KF_DEP_VERSION "6.4.0") # handled by release scripts
|
||||
project(KImageFormats VERSION ${KF_VERSION})
|
||||
|
||||
include(FeatureSummary)
|
||||
find_package(ECM 5.116.0 NO_MODULE)
|
||||
find_package(ECM 6.4.0 NO_MODULE)
|
||||
set_package_properties(ECM PROPERTIES TYPE REQUIRED DESCRIPTION "Extra CMake Modules." URL "https://commits.kde.org/extra-cmake-modules")
|
||||
feature_summary(WHAT REQUIRED_PACKAGES_NOT_FOUND FATAL_ON_MISSING_REQUIRED_PACKAGES)
|
||||
|
||||
@ -19,11 +21,11 @@ include(ECMDeprecationSettings)
|
||||
include(CheckIncludeFiles)
|
||||
include(FindPkgConfig)
|
||||
|
||||
set(REQUIRED_QT_VERSION 5.15.2)
|
||||
find_package(Qt${QT_MAJOR_VERSION}Gui ${REQUIRED_QT_VERSION} REQUIRED NO_MODULE)
|
||||
set(REQUIRED_QT_VERSION 6.5.0)
|
||||
find_package(Qt6Gui ${REQUIRED_QT_VERSION} REQUIRED NO_MODULE)
|
||||
|
||||
find_package(KF5Archive)
|
||||
set_package_properties(KF5Archive PROPERTIES
|
||||
find_package(KF6Archive ${KF_DEP_VERSION})
|
||||
set_package_properties(KF6Archive PROPERTIES
|
||||
TYPE OPTIONAL
|
||||
PURPOSE "Required for the QImage plugin for Krita and OpenRaster images"
|
||||
)
|
||||
@ -32,12 +34,12 @@ set_package_properties(KF5Archive PROPERTIES
|
||||
# this available in PATH
|
||||
set(BUILD_EPS_PLUGIN FALSE)
|
||||
if (UNIX)
|
||||
find_package(Qt${QT_MAJOR_VERSION}PrintSupport ${REQUIRED_QT_VERSION} NO_MODULE)
|
||||
set_package_properties(Qt${QT_MAJOR_VERSION}PrintSupport PROPERTIES
|
||||
find_package(Qt6PrintSupport ${REQUIRED_QT_VERSION} NO_MODULE)
|
||||
set_package_properties(Qt6PrintSupport PROPERTIES
|
||||
PURPOSE "Required for the QImage plugin for EPS images"
|
||||
TYPE OPTIONAL
|
||||
)
|
||||
if (TARGET Qt${QT_MAJOR_VERSION}::PrintSupport)
|
||||
if (TARGET Qt6::PrintSupport)
|
||||
set(BUILD_EPS_PLUGIN TRUE)
|
||||
endif()
|
||||
endif()
|
||||
@ -73,16 +75,21 @@ if(KIMAGEFORMATS_JXL)
|
||||
endif()
|
||||
add_feature_info(LibJXL LibJXL_FOUND "required for the QImage plugin for JPEG XL images")
|
||||
|
||||
# note: module FindLibRaw missing from https://invent.kde.org/frameworks/extra-cmake-modules
|
||||
find_package(LibRaw 0.20.2)
|
||||
set_package_properties(LibRaw PROPERTIES
|
||||
TYPE OPTIONAL
|
||||
PURPOSE "Required for the QImage plugin for RAW images"
|
||||
)
|
||||
|
||||
option(KIMAGEFORMATS_JXR "Enable plugin for JPEG XR format" OFF)
|
||||
if(KIMAGEFORMATS_JXR)
|
||||
find_package(LibJXR)
|
||||
endif()
|
||||
add_feature_info(LibJXR LibJXR_FOUND "required for the QImage plugin for JPEG XR images")
|
||||
|
||||
ecm_set_disabled_deprecation_versions(
|
||||
QT 5.15.2
|
||||
KF 5.95
|
||||
QT 6.5
|
||||
KF 5.102
|
||||
)
|
||||
|
||||
add_subdirectory(src)
|
||||
@ -91,6 +98,7 @@ if (BUILD_TESTING)
|
||||
add_subdirectory(tests)
|
||||
endif()
|
||||
|
||||
feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)
|
||||
include(ECMFeatureSummary)
|
||||
ecm_feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)
|
||||
|
||||
kde_configure_git_pre_commit_hook(CHECKS CLANG_FORMAT)
|
||||
|
9
LICENSES/BSD-2-Clause.txt
Normal file
@ -0,0 +1,9 @@
|
||||
Copyright (c) <year> <owner>
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
11
LICENSES/BSD-3-Clause.txt
Normal file
@ -0,0 +1,11 @@
|
||||
Copyright (c) <year> <owner>.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
17
README.md
@ -16,22 +16,27 @@ The following image formats have read-only support:
|
||||
- Animated Windows cursors (ani)
|
||||
- Camera RAW images (arw, cr2, cr3, dcs, dng, ...)
|
||||
- Gimp (xcf)
|
||||
- OpenEXR (exr)
|
||||
- Krita (kra)
|
||||
- OpenRaster (ora)
|
||||
- Pixar raster (pxr)
|
||||
- Portable FloatMap (pfm)
|
||||
- Photoshop documents (psd, psb, pdd, psdt)
|
||||
- Radiance HDR (hdr)
|
||||
- Sun Raster (ras)
|
||||
- Sun Raster (im1, im8, im24, im32, ras, sun)
|
||||
|
||||
The following image formats have read and write support:
|
||||
|
||||
- AV1 Image File Format (AVIF)
|
||||
- AV1 Image File Format (avif)
|
||||
- Encapsulated PostScript (eps)
|
||||
- High Efficiency Image File Format (heif). Can be enabled with the KIMAGEFORMATS_HEIF build option.
|
||||
- JPEG XL (jxl)
|
||||
- JPEG XR (jxr). Can be enabled with the KIMAGEFORMATS_JXR build option.
|
||||
- OpenEXR (exr)
|
||||
- Personal Computer Exchange (pcx)
|
||||
- Quite OK Image format (qoi)
|
||||
- SGI images (rgb, rgba, sgi, bw)
|
||||
- Softimage PIC (pic)
|
||||
- Targa (tga): supports more formats than Qt's version
|
||||
- XView (xv)
|
||||
|
||||
## Contributing
|
||||
|
||||
@ -43,10 +48,6 @@ of Qt is the license. As such, if you write an imageformat plugin and
|
||||
you are willing to sign the Qt Project contributor agreement, it may be
|
||||
better to submit the plugin directly to the Qt Project.
|
||||
|
||||
Note that the imageformat plugins provided by this module also provide a
|
||||
desktop file. This is for the benefit of KImageIO in the KDE4 Support
|
||||
framework.
|
||||
|
||||
## Duplicated Plugins
|
||||
|
||||
The TGA plugin supports more formats than Qt's own TGA plugin;
|
||||
|
@ -1,5 +1,3 @@
|
||||
#find_package(Qt5Test ${REQUIRED_QT_VERSION} NO_MODULE)
|
||||
|
||||
include(ECMMarkAsTest)
|
||||
|
||||
add_definitions(-DPLUGIN_DIR="${CMAKE_CURRENT_BINARY_DIR}/../bin")
|
||||
@ -13,8 +11,8 @@ macro(kimageformats_read_tests)
|
||||
endif()
|
||||
|
||||
if (NOT TARGET readtest)
|
||||
add_executable(readtest readtest.cpp)
|
||||
target_link_libraries(readtest Qt${QT_MAJOR_VERSION}::Gui)
|
||||
add_executable(readtest readtest.cpp templateimage.cpp)
|
||||
target_link_libraries(readtest Qt6::Gui)
|
||||
target_compile_definitions(readtest
|
||||
PRIVATE IMAGEDIR="${CMAKE_CURRENT_SOURCE_DIR}/read")
|
||||
ecm_mark_as_test(readtest)
|
||||
@ -37,7 +35,7 @@ macro(kimageformats_write_tests)
|
||||
|
||||
if (NOT TARGET writetest)
|
||||
add_executable(writetest writetest.cpp)
|
||||
target_link_libraries(writetest Qt${QT_MAJOR_VERSION}::Gui)
|
||||
target_link_libraries(writetest Qt6::Gui)
|
||||
target_compile_definitions(writetest
|
||||
PRIVATE IMAGEDIR="${CMAKE_CURRENT_SOURCE_DIR}/write")
|
||||
ecm_mark_as_test(writetest)
|
||||
@ -68,14 +66,16 @@ endmacro()
|
||||
kimageformats_read_tests(
|
||||
hdr
|
||||
pcx
|
||||
pfm
|
||||
psd
|
||||
pxr
|
||||
qoi
|
||||
ras
|
||||
rgb
|
||||
tga
|
||||
)
|
||||
|
||||
if (KF5Archive_FOUND)
|
||||
if (KF6Archive_FOUND)
|
||||
kimageformats_read_tests(
|
||||
kra
|
||||
ora
|
||||
@ -116,6 +116,15 @@ if (LibJXL_FOUND AND LibJXLThreads_FOUND)
|
||||
)
|
||||
endif()
|
||||
|
||||
if (LibJXR_FOUND)
|
||||
kimageformats_read_tests(
|
||||
jxr
|
||||
)
|
||||
kimageformats_write_tests(
|
||||
jxr-nodatacheck
|
||||
)
|
||||
endif()
|
||||
|
||||
# Allow some fuzziness when reading this formats, to allow for
|
||||
# rounding errors (eg: in alpha blending).
|
||||
kimageformats_read_tests(FUZZ 1
|
||||
@ -146,6 +155,11 @@ if (OpenEXR_FOUND)
|
||||
kimageformats_read_tests(
|
||||
exr
|
||||
)
|
||||
# Color space conversions from sRGB to linear on saving and
|
||||
# from linear to sRGB on loading result in some rounding errors.
|
||||
kimageformats_write_tests(FUZZ 5
|
||||
exr-nodatacheck-lossless
|
||||
)
|
||||
endif()
|
||||
|
||||
if (LibRaw_FOUND)
|
||||
@ -154,19 +168,19 @@ if (LibRaw_FOUND)
|
||||
)
|
||||
endif()
|
||||
|
||||
find_package(Qt${QT_MAJOR_VERSION}Test ${REQUIRED_QT_VERSION} CONFIG QUIET)
|
||||
find_package(Qt6Test ${REQUIRED_QT_VERSION} CONFIG QUIET)
|
||||
|
||||
if(NOT TARGET Qt${QT_MAJOR_VERSION}::Test)
|
||||
message(STATUS "Qt${QT_MAJOR_VERSION}Test not found, some autotests will not be built.")
|
||||
if(NOT TARGET Qt6::Test)
|
||||
message(STATUS "Qt6Test not found, some autotests will not be built.")
|
||||
return()
|
||||
endif()
|
||||
|
||||
add_executable(pictest pictest.cpp)
|
||||
target_link_libraries(pictest Qt${QT_MAJOR_VERSION}::Gui Qt${QT_MAJOR_VERSION}::Test)
|
||||
target_link_libraries(pictest Qt6::Gui Qt6::Test)
|
||||
ecm_mark_as_test(pictest)
|
||||
add_test(NAME kimageformats-pic COMMAND pictest)
|
||||
|
||||
add_executable(anitest anitest.cpp)
|
||||
target_link_libraries(anitest Qt${QT_MAJOR_VERSION}::Gui Qt${QT_MAJOR_VERSION}::Test)
|
||||
target_link_libraries(anitest Qt6::Gui Qt6::Test)
|
||||
ecm_mark_as_test(anitest)
|
||||
add_test(NAME kimageformats-ani COMMAND anitest)
|
||||
|
BIN
autotests/read/exr/gray.exr
Normal file
BIN
autotests/read/exr/gray.png
Normal file
After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.6 KiB |
BIN
autotests/read/hdr/fake_earth.hdr
Normal file
BIN
autotests/read/hdr/fake_earth.png
Normal file
After Width: | Height: | Size: 2.7 KiB |
BIN
autotests/read/jxr/abydos_bgra32.jxr
Normal file
BIN
autotests/read/jxr/abydos_bgra32.png
Normal file
After Width: | Height: | Size: 206 KiB |
BIN
autotests/read/jxr/testcard_bgra8.jxr
Normal file
BIN
autotests/read/jxr/testcard_bgra8.png
Normal file
After Width: | Height: | Size: 16 KiB |
BIN
autotests/read/jxr/testcard_cmyk8.jxr
Normal file
11
autotests/read/jxr/testcard_cmyk8.jxr.json
Normal file
@ -0,0 +1,11 @@
|
||||
[
|
||||
{
|
||||
"minQtVersion" : "6.8.0",
|
||||
"fileName" : "testcard_cmyk8.tif"
|
||||
},
|
||||
{
|
||||
"maxQtVersion" : "6.7.99",
|
||||
"unsupportedFormat" : true,
|
||||
"comment" : "Qt versions lower than 6.8 do not support CMYK format so this test should be skipped."
|
||||
}
|
||||
]
|
BIN
autotests/read/jxr/testcard_cmyk8.tif
Normal file
BIN
autotests/read/jxr/testcard_gray16.jxr
Normal file
BIN
autotests/read/jxr/testcard_gray16.png
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
autotests/read/jxr/testcard_gray8.jxr
Normal file
BIN
autotests/read/jxr/testcard_gray8.png
Normal file
After Width: | Height: | Size: 6.8 KiB |
BIN
autotests/read/jxr/testcard_mono.jxr
Normal file
BIN
autotests/read/jxr/testcard_mono.png
Normal file
After Width: | Height: | Size: 8.2 KiB |
BIN
autotests/read/jxr/testcard_rgb16.jxr
Normal file
BIN
autotests/read/jxr/testcard_rgb16.png
Normal file
After Width: | Height: | Size: 17 KiB |
BIN
autotests/read/jxr/testcard_rgb8.jxr
Normal file
BIN
autotests/read/jxr/testcard_rgb8.png
Normal file
After Width: | Height: | Size: 13 KiB |
BIN
autotests/read/jxr/testcard_rgba16.jxr
Normal file
BIN
autotests/read/jxr/testcard_rgba16.png
Normal file
After Width: | Height: | Size: 23 KiB |
BIN
autotests/read/jxr/testcard_rgba8.jxr
Normal file
BIN
autotests/read/jxr/testcard_rgba8.png
Normal file
After Width: | Height: | Size: 18 KiB |
BIN
autotests/read/pfm/testcard_gray.pfm
Normal file
BIN
autotests/read/pfm/testcard_gray.png
Normal file
After Width: | Height: | Size: 7.4 KiB |
BIN
autotests/read/pfm/testcard_rgb.pfm
Normal file
BIN
autotests/read/pfm/testcard_rgb.png
Normal file
After Width: | Height: | Size: 21 KiB |
BIN
autotests/read/pfm/testcard_rgb_ps.pfm
Normal file
BIN
autotests/read/pfm/testcard_rgb_ps.png
Normal file
After Width: | Height: | Size: 21 KiB |
BIN
autotests/read/psd/cmyk16_testcard.png
Normal file
After Width: | Height: | Size: 26 KiB |
BIN
autotests/read/psd/cmyk16_testcard.psd
Normal file
11
autotests/read/psd/cmyk16_testcard.psd.json
Normal file
@ -0,0 +1,11 @@
|
||||
[
|
||||
{
|
||||
"minQtVersion" : "6.8.0",
|
||||
"fileName" : "cmyk16_testcard_qt6_8.tif"
|
||||
},
|
||||
{
|
||||
"minQtVersion" : "6.0.0",
|
||||
"maxQtVersion" : "6.7.99",
|
||||
"fileName" : "cmyk16_testcard.png"
|
||||
}
|
||||
]
|
BIN
autotests/read/psd/cmyk16_testcard_qt6_8.tif
Normal file
BIN
autotests/read/psd/cmyk8_testcard.png
Normal file
After Width: | Height: | Size: 13 KiB |
BIN
autotests/read/psd/cmyk8_testcard.psd
Normal file
11
autotests/read/psd/cmyk8_testcard.psd.json
Normal file
@ -0,0 +1,11 @@
|
||||
[
|
||||
{
|
||||
"minQtVersion" : "6.8.0",
|
||||
"fileName" : "cmyk8_testcard_qt6_8.tif"
|
||||
},
|
||||
{
|
||||
"minQtVersion" : "6.0.0",
|
||||
"maxQtVersion" : "6.7.99",
|
||||
"fileName" : "cmyk8_testcard.png"
|
||||
}
|
||||
]
|
BIN
autotests/read/psd/cmyk8_testcard_qt6_8.tif
Normal file
11
autotests/read/psd/cmyka-16bits.psd.json
Normal file
@ -0,0 +1,11 @@
|
||||
[
|
||||
{
|
||||
"minQtVersion" : "6.8.0",
|
||||
"fileName" : "cmyka-16bits_qt6_8.png"
|
||||
},
|
||||
{
|
||||
"minQtVersion" : "6.0.0",
|
||||
"maxQtVersion" : "6.7.99",
|
||||
"fileName" : "cmyka-16bits.png"
|
||||
}
|
||||
]
|
BIN
autotests/read/psd/cmyka-16bits_qt6_8.png
Normal file
After Width: | Height: | Size: 111 KiB |
11
autotests/read/psd/cmyka-8bits.psd.json
Normal file
@ -0,0 +1,11 @@
|
||||
[
|
||||
{
|
||||
"minQtVersion" : "6.8.0",
|
||||
"fileName" : "cmyka-8bits_qt6_8.png"
|
||||
},
|
||||
{
|
||||
"minQtVersion" : "6.0.0",
|
||||
"maxQtVersion" : "6.7.99",
|
||||
"fileName" : "cmyka-8bits.png"
|
||||
}
|
||||
]
|
BIN
autotests/read/psd/cmyka-8bits_qt6_8.png
Normal file
After Width: | Height: | Size: 77 KiB |
Before Width: | Height: | Size: 189 KiB After Width: | Height: | Size: 189 KiB |
11
autotests/read/psd/mch-16bits.psd.json
Normal file
@ -0,0 +1,11 @@
|
||||
[
|
||||
{
|
||||
"minQtVersion" : "6.8.0",
|
||||
"fileName" : "mch-16bits_qt_6_8.tif"
|
||||
},
|
||||
{
|
||||
"minQtVersion" : "6.0.0",
|
||||
"maxQtVersion" : "6.7.99",
|
||||
"fileName" : "mch-16bits.png"
|
||||
}
|
||||
]
|
BIN
autotests/read/psd/mch-16bits_qt_6_8.tif
Normal file
11
autotests/read/psd/mch-8bits.psd.json
Normal file
@ -0,0 +1,11 @@
|
||||
[
|
||||
{
|
||||
"minQtVersion" : "6.8.0",
|
||||
"fileName" : "mch-8bits_qt_6.8.tif"
|
||||
},
|
||||
{
|
||||
"minQtVersion" : "6.0.0",
|
||||
"maxQtVersion" : "6.7.99",
|
||||
"fileName" : "mch-8bits.png"
|
||||
}
|
||||
]
|
BIN
autotests/read/psd/mch-8bits_qt_6.8.tif
Normal file
BIN
autotests/read/pxr/testcard_gray.png
Normal file
After Width: | Height: | Size: 5.4 KiB |
BIN
autotests/read/pxr/testcard_gray.pxr
Normal file
BIN
autotests/read/pxr/testcard_rgb.png
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
autotests/read/pxr/testcard_rgb.pxr
Normal file
BIN
autotests/read/ras/rgb-gimp-2.10-1bit.png
Normal file
After Width: | Height: | Size: 192 B |
BIN
autotests/read/ras/rgb-gimp-2.10-1bit.ras
Normal file
BIN
autotests/read/ras/rgb-gimp-2.10-gray.png
Normal file
After Width: | Height: | Size: 470 B |
BIN
autotests/read/ras/rgb-gimp-2.10-gray.ras
Normal file
BIN
autotests/read/ras/rgb-gimp-2.10-pal16.png
Normal file
After Width: | Height: | Size: 338 B |
BIN
autotests/read/ras/rgb-gimp-2.10-pal16.ras
Normal file
BIN
autotests/read/ras/rgb24.png
Normal file
After Width: | Height: | Size: 7.1 KiB |
BIN
autotests/read/ras/rgb24.ras
Normal file
BIN
autotests/read/ras/rle_1bit.png
Normal file
After Width: | Height: | Size: 34 KiB |
BIN
autotests/read/ras/rle_1bit.ras
Normal file
BIN
autotests/read/ras/rle_24bit.png
Normal file
After Width: | Height: | Size: 21 KiB |
BIN
autotests/read/ras/rle_24bit.ras
Normal file
BIN
autotests/read/ras/rle_pal8bit.png
Normal file
After Width: | Height: | Size: 17 KiB |
BIN
autotests/read/ras/rle_pal8bit.ras
Normal file
Before Width: | Height: | Size: 93 KiB After Width: | Height: | Size: 93 KiB |
32
autotests/read/xcf/birthday16.xcf.json
Normal file
@ -0,0 +1,32 @@
|
||||
[
|
||||
{
|
||||
"minQtVersion" : "6.7.0",
|
||||
"fileName" : "birthday16.png",
|
||||
"seeAlso" : "https://bugreports.qt.io/browse/QTBUG-120614"
|
||||
},
|
||||
{
|
||||
"minQtVersion" : "6.0.0",
|
||||
"maxQtVersion" : "6.2.10",
|
||||
"fileName" : "birthday16_alphabug.png"
|
||||
},
|
||||
{
|
||||
"minQtVersion" : "6.3.0",
|
||||
"maxQtVersion" : "6.3.2",
|
||||
"fileName" : "birthday32_alphabug.png"
|
||||
},
|
||||
{
|
||||
"minQtVersion" : "6.4.0",
|
||||
"maxQtVersion" : "6.4.3",
|
||||
"fileName" : "birthday32_alphabug.png"
|
||||
},
|
||||
{
|
||||
"minQtVersion" : "6.5.0",
|
||||
"maxQtVersion" : "6.5.4",
|
||||
"fileName" : "birthday16_alphabug.png"
|
||||
},
|
||||
{
|
||||
"minQtVersion" : "6.6.0",
|
||||
"maxQtVersion" : "6.6.1",
|
||||
"fileName" : "birthday16_alphabug.png"
|
||||
}
|
||||
]
|
BIN
autotests/read/xcf/birthday16_alphabug.png
Normal file
After Width: | Height: | Size: 91 KiB |
Before Width: | Height: | Size: 82 KiB After Width: | Height: | Size: 82 KiB |
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 27 KiB |
Before Width: | Height: | Size: 72 KiB After Width: | Height: | Size: 72 KiB |
Before Width: | Height: | Size: 93 KiB After Width: | Height: | Size: 93 KiB |
32
autotests/read/xcf/birthday32.xcf.json
Normal file
@ -0,0 +1,32 @@
|
||||
[
|
||||
{
|
||||
"minQtVersion" : "6.7.0",
|
||||
"fileName" : "birthday32.png",
|
||||
"seeAlso" : "https://bugreports.qt.io/browse/QTBUG-120614"
|
||||
},
|
||||
{
|
||||
"minQtVersion" : "6.0.0",
|
||||
"maxQtVersion" : "6.2.10",
|
||||
"fileName" : "birthday32_alphabug.png"
|
||||
},
|
||||
{
|
||||
"minQtVersion" : "6.3.0",
|
||||
"maxQtVersion" : "6.3.2",
|
||||
"fileName" : "birthday32_alphabug.png"
|
||||
},
|
||||
{
|
||||
"minQtVersion" : "6.4.0",
|
||||
"maxQtVersion" : "6.4.3",
|
||||
"fileName" : "birthday32_alphabug.png"
|
||||
},
|
||||
{
|
||||
"minQtVersion" : "6.5.0",
|
||||
"maxQtVersion" : "6.5.4",
|
||||
"fileName" : "birthday32_alphabug.png"
|
||||
},
|
||||
{
|
||||
"minQtVersion" : "6.6.0",
|
||||
"maxQtVersion" : "6.6.1",
|
||||
"fileName" : "birthday32_alphabug.png"
|
||||
}
|
||||
]
|
BIN
autotests/read/xcf/birthday32_alphabug.png
Normal file
After Width: | Height: | Size: 91 KiB |
Before Width: | Height: | Size: 82 KiB After Width: | Height: | Size: 82 KiB |
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 27 KiB |
Before Width: | Height: | Size: 72 KiB After Width: | Height: | Size: 72 KiB |
BIN
autotests/read/xcf/bug_476755_gray_layers.png
Normal file
After Width: | Height: | Size: 234 KiB |
BIN
autotests/read/xcf/bug_476755_gray_layers.xcf
Normal file
BIN
autotests/read/xcf/bug_476755_rgb_layers.png
Normal file
After Width: | Height: | Size: 234 KiB |
BIN
autotests/read/xcf/bug_476755_rgb_layers.xcf
Normal file
Before Width: | Height: | Size: 112 KiB After Width: | Height: | Size: 112 KiB |
Before Width: | Height: | Size: 112 KiB After Width: | Height: | Size: 112 KiB |
@ -16,6 +16,7 @@
|
||||
#include <QTextStream>
|
||||
|
||||
#include "../tests/format-enum.h"
|
||||
#include "templateimage.h"
|
||||
|
||||
#include "fuzzyeq.cpp"
|
||||
|
||||
@ -89,13 +90,114 @@ static QImage::Format preferredFormat(QImage::Format fmt)
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief The OptionTest class
|
||||
* Class for testing image options.
|
||||
* Supports the most common options:
|
||||
* - Size
|
||||
* - ImageFormat
|
||||
* - ImageTransformation (rotations)
|
||||
* \todo Add missing options if needed.
|
||||
*/
|
||||
class OptionTest
|
||||
{
|
||||
public:
|
||||
OptionTest()
|
||||
: m_size(QSize())
|
||||
, m_format(QImage::Format_Invalid)
|
||||
, m_transformations(QImageIOHandler::TransformationNone)
|
||||
{
|
||||
}
|
||||
|
||||
OptionTest(const OptionTest&) = default;
|
||||
OptionTest& operator =(const OptionTest&) = default;
|
||||
|
||||
/*!
|
||||
* \brief store
|
||||
* Stores the supported options of the reader.
|
||||
* \param reader
|
||||
* \return True on success, otherwise false.
|
||||
*/
|
||||
bool store(const QImageReader *reader = nullptr)
|
||||
{
|
||||
if (reader == nullptr) {
|
||||
return false;
|
||||
}
|
||||
bool ok = true;
|
||||
if (reader->supportsOption(QImageIOHandler::Size)) {
|
||||
m_size = reader->size();
|
||||
if (m_size.isEmpty())
|
||||
ok = false;
|
||||
}
|
||||
if (reader->supportsOption(QImageIOHandler::ImageFormat)) {
|
||||
m_format = reader->imageFormat();
|
||||
if (m_format == QImage::Format_Invalid)
|
||||
ok = false;
|
||||
}
|
||||
if (reader->supportsOption(QImageIOHandler::ImageTransformation)) {
|
||||
m_transformations = reader->transformation();
|
||||
if (m_transformations < 0 || m_transformations > 7)
|
||||
ok = false;
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
* \brief compare
|
||||
* Compare the stored values with the ones read from the image reader.
|
||||
* \param reader
|
||||
* \return True on success, otherwise false.
|
||||
*/
|
||||
bool compare(const QImageReader *reader)
|
||||
{
|
||||
if (reader == nullptr) {
|
||||
return false;
|
||||
}
|
||||
bool ok = true;
|
||||
if (reader->supportsOption(QImageIOHandler::Size)) {
|
||||
ok = ok && (m_size == reader->size());
|
||||
}
|
||||
if (reader->supportsOption(QImageIOHandler::ImageFormat)) {
|
||||
ok = ok && (m_format == reader->imageFormat());
|
||||
}
|
||||
if (reader->supportsOption(QImageIOHandler::ImageTransformation)) {
|
||||
ok = ok && (m_transformations == reader->transformation());
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief compare
|
||||
* Compare the image properties with the ones stored.
|
||||
* \param image
|
||||
* \return True on success, otherwise false.
|
||||
*/
|
||||
bool compare(const QImage& image)
|
||||
{
|
||||
bool ok = true;
|
||||
if (!m_size.isEmpty()) {
|
||||
ok = ok && (m_size == image.size());
|
||||
}
|
||||
if (m_format != QImage::Format_Invalid) {
|
||||
ok = ok && (m_format == image.format());
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
private:
|
||||
QSize m_size;
|
||||
QImage::Format m_format;
|
||||
QImageIOHandler::Transformations m_transformations;
|
||||
};
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
QCoreApplication app(argc, argv);
|
||||
QCoreApplication::removeLibraryPath(QStringLiteral(PLUGIN_DIR));
|
||||
QCoreApplication::addLibraryPath(QStringLiteral(PLUGIN_DIR));
|
||||
QCoreApplication::setApplicationName(QStringLiteral("readtest"));
|
||||
QCoreApplication::setApplicationVersion(QStringLiteral("1.1.0"));
|
||||
QCoreApplication::setApplicationVersion(QStringLiteral("1.2.0"));
|
||||
|
||||
QCommandLineParser parser;
|
||||
parser.setApplicationDescription(QStringLiteral("Performs basic image conversion checking."));
|
||||
@ -159,22 +261,30 @@ int main(int argc, char **argv)
|
||||
QTextStream(stdout) << "* Run on RANDOM ACCESS device\n";
|
||||
}
|
||||
for (const QFileInfo &fi : lstImgDir) {
|
||||
if (!fi.suffix().compare("png", Qt::CaseInsensitive) || !fi.suffix().compare("tif", Qt::CaseInsensitive)) {
|
||||
TemplateImage timg(fi);
|
||||
if (timg.isTemplate()) {
|
||||
continue;
|
||||
}
|
||||
int suffixPos = fi.filePath().count() - suffix.count();
|
||||
QString inputfile = fi.filePath();
|
||||
QString fmt = QStringLiteral("png");
|
||||
QString expfile = fi.filePath().replace(suffixPos, suffix.count(), fmt);
|
||||
if (!QFile::exists(expfile)) { // try with tiff
|
||||
fmt = QStringLiteral("tif");
|
||||
expfile = fi.filePath().replace(suffixPos, suffix.count(), fmt);
|
||||
}
|
||||
QString expfilename = QFileInfo(expfile).fileName();
|
||||
|
||||
std::unique_ptr<QIODevice> inputDevice(seq ? new SequentialFile(inputfile) : new QFile(inputfile));
|
||||
bool skipTest = false;
|
||||
QFileInfo expFileInfo = timg.compareImage(skipTest);
|
||||
if (skipTest) {
|
||||
QTextStream(stdout) << "SKIP : " << fi.fileName() << ": image format not supported by current Qt version!\n";
|
||||
++skipped;
|
||||
continue;
|
||||
}
|
||||
if (!formatStrings.contains(expFileInfo.suffix(), Qt::CaseInsensitive)) {
|
||||
// Work Around for CCBUG: 468288
|
||||
QTextStream(stdout) << "SKIP : " << fi.fileName() << ": comparison image " << expFileInfo.fileName() << " cannot be loaded due to the lack of "
|
||||
<< expFileInfo.suffix().toUpper() << " plugin!\n";
|
||||
++skipped;
|
||||
continue;
|
||||
}
|
||||
QString expfilename = expFileInfo.fileName();
|
||||
|
||||
std::unique_ptr<QIODevice> inputDevice(seq ? new SequentialFile(fi.filePath()) : new QFile(fi.filePath()));
|
||||
QImageReader inputReader(inputDevice.get(), format);
|
||||
QImageReader expReader(expfile, fmt.toLatin1());
|
||||
QImageReader expReader(expFileInfo.filePath());
|
||||
|
||||
QImage inputImage;
|
||||
QImage expImage;
|
||||
@ -199,11 +309,32 @@ int main(int argc, char **argv)
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
OptionTest optionTest;
|
||||
if (!optionTest.store(&inputReader)) {
|
||||
QTextStream(stdout) << "FAIL : " << fi.fileName() << ": error while reading options\n";
|
||||
++failed;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!inputReader.read(&inputImage)) {
|
||||
QTextStream(stdout) << "FAIL : " << fi.fileName() << ": failed to load: " << inputReader.errorString() << "\n";
|
||||
++failed;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!optionTest.compare(&inputReader)) {
|
||||
QTextStream(stdout) << "FAIL : " << fi.fileName() << ": error while comparing options\n";
|
||||
++failed;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!optionTest.compare(inputImage)) {
|
||||
QTextStream(stdout) << "FAIL : " << fi.fileName() << ": error while comparing the image properties with options\n";
|
||||
++failed;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (expImage.width() != inputImage.width()) {
|
||||
QTextStream(stdout) << "FAIL : " << fi.fileName() << ": width was " << inputImage.width() << " but " << expfilename << " width was "
|
||||
<< expImage.width() << "\n";
|
||||
|
106
autotests/templateimage.cpp
Normal file
@ -0,0 +1,106 @@
|
||||
/*
|
||||
SPDX-FileCopyrightText: 2024 Mirco Miranda <mircomir@outlook.com>
|
||||
|
||||
SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
|
||||
*/
|
||||
|
||||
#include "templateimage.h"
|
||||
|
||||
#include <QFile>
|
||||
#include <QJsonArray>
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonObject>
|
||||
#include <QVersionNumber>
|
||||
|
||||
TemplateImage::TemplateImage(const QFileInfo &fi) :
|
||||
m_fi(fi)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool TemplateImage::isTemplate() const
|
||||
{
|
||||
auto list = suffixes();
|
||||
for (auto&& suffix : list) {
|
||||
if (!m_fi.suffix().compare(suffix, Qt::CaseInsensitive))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
QFileInfo TemplateImage::compareImage(bool &skipTest) const
|
||||
{
|
||||
auto fi = jsonImage(skipTest);
|
||||
if (skipTest) {
|
||||
return {};
|
||||
}
|
||||
if (fi.exists()) {
|
||||
return fi;
|
||||
}
|
||||
return legacyImage();
|
||||
}
|
||||
|
||||
|
||||
QStringList TemplateImage::suffixes()
|
||||
{
|
||||
return QStringList({"png", "tif", "tiff", "json"});
|
||||
}
|
||||
|
||||
QFileInfo TemplateImage::legacyImage() const
|
||||
{
|
||||
auto list = suffixes();
|
||||
for (auto&& suffix : list) {
|
||||
auto fi = QFileInfo(QStringLiteral("%1/%2.%3").arg(m_fi.path(), m_fi.completeBaseName(), suffix));
|
||||
if (fi.exists()) {
|
||||
return fi;
|
||||
}
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
QFileInfo TemplateImage::jsonImage(bool &skipTest) const
|
||||
{
|
||||
auto fi = QFileInfo(QStringLiteral("%1.json").arg(m_fi.filePath()));
|
||||
if (!fi.exists()) {
|
||||
return {};
|
||||
}
|
||||
|
||||
QFile f(fi.filePath());
|
||||
if (!f.open(QFile::ReadOnly)) {
|
||||
return {};
|
||||
}
|
||||
|
||||
QJsonParseError err;
|
||||
auto doc = QJsonDocument::fromJson(f.readAll(), &err);
|
||||
if (err.error != QJsonParseError::NoError || !doc.isArray()) {
|
||||
return {};
|
||||
}
|
||||
|
||||
auto currentQt = QVersionNumber::fromString(qVersion());
|
||||
auto arr = doc.array();
|
||||
for (auto val : arr) {
|
||||
if (!val.isObject())
|
||||
continue;
|
||||
auto obj = val.toObject();
|
||||
auto minQt = QVersionNumber::fromString(obj.value("minQtVersion").toString());
|
||||
auto maxQt = QVersionNumber::fromString(obj.value("maxQtVersion").toString());
|
||||
auto name = obj.value("fileName").toString();
|
||||
auto unsupportedFormat = obj.value("unsupportedFormat").toBool();
|
||||
|
||||
// filter
|
||||
if (name.isEmpty() && !unsupportedFormat)
|
||||
continue;
|
||||
if (!minQt.isNull() && currentQt < minQt)
|
||||
continue;
|
||||
if (!maxQt.isNull() && currentQt > maxQt)
|
||||
continue;
|
||||
if (unsupportedFormat) {
|
||||
skipTest = true;
|
||||
break;
|
||||
}
|
||||
return QFileInfo(QStringLiteral("%1/%2").arg(fi.path(), name));
|
||||
}
|
||||
|
||||
return {};
|
||||
}
|
||||
|
74
autotests/templateimage.h
Normal file
@ -0,0 +1,74 @@
|
||||
/*
|
||||
SPDX-FileCopyrightText: 2024 Mirco Miranda <mircomir@outlook.com>
|
||||
|
||||
SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
|
||||
*/
|
||||
|
||||
#ifndef TEMPLATEIMAGE_H
|
||||
#define TEMPLATEIMAGE_H
|
||||
|
||||
#include <QFileInfo>
|
||||
|
||||
/*!
|
||||
* \brief The TemplateImage class
|
||||
* Given an image name, it decides the template image to compare it with.
|
||||
*/
|
||||
class TemplateImage
|
||||
{
|
||||
public:
|
||||
/*!
|
||||
* \brief TemplateImage
|
||||
* \param fi The image to test.
|
||||
*/
|
||||
TemplateImage(const QFileInfo& fi);
|
||||
|
||||
/*!
|
||||
* \brief TemplateImage
|
||||
* Default copy constructor.
|
||||
*/
|
||||
TemplateImage(const TemplateImage& other) = default;
|
||||
/*!
|
||||
* \brief operator =
|
||||
* Default copy operator
|
||||
*/
|
||||
TemplateImage& operator=(const TemplateImage& other) = default;
|
||||
|
||||
/*!
|
||||
* \brief isTemplate
|
||||
* \return True if the image is a template, false otherwise.
|
||||
* \sa suffixes
|
||||
*/
|
||||
bool isTemplate() const;
|
||||
|
||||
/*!
|
||||
* \brief compareImage
|
||||
* \param skipTest True if the test should be skipped (e.g. image format not supported by current Qt version).
|
||||
* \return The template image to use for the comparison.
|
||||
*/
|
||||
QFileInfo compareImage(bool &skipTest) const;
|
||||
|
||||
/*!
|
||||
* \brief suffixes
|
||||
* \return The list of suffixes considered templates.
|
||||
*/
|
||||
static QStringList suffixes();
|
||||
|
||||
private:
|
||||
/*!
|
||||
* \brief legacyImage
|
||||
* \return The template image calculated from the source image name.
|
||||
*/
|
||||
QFileInfo legacyImage() const;
|
||||
|
||||
/*!
|
||||
* \brief jsonImage
|
||||
* \param skipTest True if the test should be skipped (not supported).
|
||||
* \return The template image read from the corresponding JSON.
|
||||
*/
|
||||
QFileInfo jsonImage(bool &skipTest) const;
|
||||
|
||||
private:
|
||||
QFileInfo m_fi;
|
||||
};
|
||||
|
||||
#endif // TEMPLATEIMAGE_H
|
@ -7,6 +7,7 @@
|
||||
#include <stdio.h>
|
||||
|
||||
#include <QBuffer>
|
||||
#include <QColorSpace>
|
||||
#include <QCommandLineParser>
|
||||
#include <QCoreApplication>
|
||||
#include <QDir>
|
||||
@ -23,8 +24,8 @@ int main(int argc, char **argv)
|
||||
QCoreApplication app(argc, argv);
|
||||
QCoreApplication::removeLibraryPath(QStringLiteral(PLUGIN_DIR));
|
||||
QCoreApplication::addLibraryPath(QStringLiteral(PLUGIN_DIR));
|
||||
QCoreApplication::setApplicationName(QStringLiteral("readtest"));
|
||||
QCoreApplication::setApplicationVersion(QStringLiteral("1.0.0"));
|
||||
QCoreApplication::setApplicationName(QStringLiteral("writetest"));
|
||||
QCoreApplication::setApplicationVersion(QStringLiteral("1.1.0"));
|
||||
|
||||
QCommandLineParser parser;
|
||||
parser.setApplicationDescription(QStringLiteral("Performs basic image conversion checking."));
|
||||
@ -85,8 +86,8 @@ int main(int argc, char **argv)
|
||||
if (parser.isSet(ignoreDataCheck)) {
|
||||
pngfile = fi.filePath();
|
||||
} else {
|
||||
int suffixPos = fi.filePath().count() - suffix.count();
|
||||
pngfile = fi.filePath().replace(suffixPos, suffix.count(), QStringLiteral("png"));
|
||||
int suffixPos = fi.filePath().size() - suffix.size();
|
||||
pngfile = fi.filePath().replace(suffixPos, suffix.size(), QStringLiteral("png"));
|
||||
}
|
||||
QString pngfilename = QFileInfo(pngfile).fileName();
|
||||
|
||||
@ -148,6 +149,14 @@ int main(int argc, char **argv)
|
||||
++failed;
|
||||
continue;
|
||||
}
|
||||
if (reReadImage.colorSpace().isValid()) {
|
||||
QColorSpace toColorSpace;
|
||||
if (pngImage.colorSpace().isValid()) {
|
||||
reReadImage.convertToColorSpace(pngImage.colorSpace());
|
||||
} else {
|
||||
reReadImage.convertToColorSpace(QColorSpace(QColorSpace::SRgb));
|
||||
}
|
||||
}
|
||||
reReadImage = reReadImage.convertToFormat(pngImage.format());
|
||||
}
|
||||
|
||||
|
24
cmake/find-modules/FindLibJXR.cmake
Normal file
@ -0,0 +1,24 @@
|
||||
# - Find LibJXR
|
||||
# Find the JXR library
|
||||
# This module defines
|
||||
# LIBJXR_INCLUDE_DIRS, where to find jxrlib/JXRGlue.h
|
||||
# LIBJXR_LIBRARIES, the libraries needed to use JXR
|
||||
#
|
||||
# Based on cmake code found at https://github.com/microsoft/vcpkg/blob/master/ports/jxrlib/FindJXR.cmake
|
||||
|
||||
find_path(LIBJXR_INCLUDE_DIRS
|
||||
NAMES JXRGlue.h
|
||||
PATH_SUFFIXES jxrlib
|
||||
)
|
||||
mark_as_advanced(LIBJXR_INCLUDE_DIRS)
|
||||
|
||||
include(SelectLibraryConfigurations)
|
||||
|
||||
find_library(LIBJPEGXR_LIBRARY NAMES jpegxr)
|
||||
find_library(LIBJXRGLUE_LIBRARY NAMES jxrglue)
|
||||
|
||||
set(LIBJXR_LIBRARIES ${LIBJPEGXR_LIBRARY} ${LIBJXRGLUE_LIBRARY})
|
||||
mark_as_advanced(LIBJXR_LIBRARIES)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibJXR DEFAULT_MSG LIBJXR_INCLUDE_DIRS LIBJXR_LIBRARIES)
|
@ -1,4 +1,3 @@
|
||||
maintainer: alexmerry
|
||||
description: Image format plugins for Qt
|
||||
tier: 2
|
||||
type: functional
|
||||
|
@ -11,9 +11,10 @@ function(kimageformats_add_plugin plugin)
|
||||
message(FATAL_ERROR "kimageformats_add_plugin called without SOURCES parameter")
|
||||
endif()
|
||||
|
||||
add_library(${plugin} MODULE ${KIF_ADD_PLUGIN_SOURCES})
|
||||
set_target_properties(${plugin} PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/imageformats")
|
||||
target_link_libraries(${plugin} Qt${QT_MAJOR_VERSION}::Gui)
|
||||
qt_add_plugin(${plugin} PLUGIN_TYPE imageformats)
|
||||
target_sources(${plugin} PRIVATE ${KIF_ADD_PLUGIN_SOURCES})
|
||||
set_target_properties(${plugin} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/imageformats)
|
||||
target_link_libraries(${plugin} PRIVATE Qt6::Gui)
|
||||
install(TARGETS ${plugin} DESTINATION ${KDE_INSTALL_QTPLUGINDIR}/imageformats)
|
||||
endfunction()
|
||||
|
||||
@ -21,176 +22,127 @@ endfunction()
|
||||
|
||||
kimageformats_add_plugin(kimg_ani SOURCES ani.cpp)
|
||||
|
||||
if (QT_MAJOR_VERSION STREQUAL "5")
|
||||
install(FILES ani.desktop DESTINATION ${KDE_INSTALL_KSERVICESDIR}/qimageioplugins/)
|
||||
endif()
|
||||
|
||||
##################################
|
||||
|
||||
if (TARGET avif)
|
||||
kimageformats_add_plugin(kimg_avif SOURCES "avif.cpp")
|
||||
target_link_libraries(kimg_avif "avif")
|
||||
if (QT_MAJOR_VERSION STREQUAL "5")
|
||||
install(FILES avif.desktop DESTINATION ${KDE_INSTALL_KSERVICESDIR}/qimageioplugins/)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
##################################
|
||||
|
||||
if (QT_MAJOR_VERSION STREQUAL "5")
|
||||
install(FILES dds-qt.desktop RENAME dds.desktop DESTINATION ${KDE_INSTALL_KSERVICESDIR}/qimageioplugins/)
|
||||
target_link_libraries(kimg_avif PRIVATE "avif")
|
||||
endif()
|
||||
|
||||
##################################
|
||||
|
||||
if (BUILD_EPS_PLUGIN)
|
||||
if (TARGET Qt${QT_MAJOR_VERSION}::PrintSupport)
|
||||
if (TARGET Qt6::PrintSupport)
|
||||
kimageformats_add_plugin(kimg_eps SOURCES eps.cpp)
|
||||
target_link_libraries(kimg_eps Qt${QT_MAJOR_VERSION}::PrintSupport)
|
||||
if (QT_MAJOR_VERSION STREQUAL "5")
|
||||
install(FILES eps.desktop DESTINATION ${KDE_INSTALL_KSERVICESDIR}/qimageioplugins/)
|
||||
target_link_libraries(kimg_eps PRIVATE Qt6::PrintSupport)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
##################################
|
||||
|
||||
if (QT_MAJOR_VERSION STREQUAL "5")
|
||||
# need this for Qt's version of the plugin
|
||||
install(FILES jp2.desktop DESTINATION ${KDE_INSTALL_KSERVICESDIR}/qimageioplugins/)
|
||||
endif()
|
||||
|
||||
##################################
|
||||
|
||||
if(OpenEXR_FOUND)
|
||||
kimageformats_add_plugin(kimg_exr SOURCES exr.cpp)
|
||||
kimageformats_add_plugin(kimg_exr SOURCES exr.cpp scanlineconverter.cpp)
|
||||
if(TARGET OpenEXR::OpenEXR)
|
||||
target_link_libraries(kimg_exr OpenEXR::OpenEXR)
|
||||
target_link_libraries(kimg_exr PRIVATE OpenEXR::OpenEXR)
|
||||
else()
|
||||
if(OpenEXR_VERSION_STRING VERSION_LESS 2.3.0)
|
||||
# Older OpenEXR versions use dynamic exception specifications, so
|
||||
# cannot use C++17 with them
|
||||
set_target_properties(kimg_exr PROPERTIES CXX_STANDARD 14)
|
||||
endif()
|
||||
target_link_libraries(kimg_exr OpenEXR::IlmImf)
|
||||
target_link_libraries(kimg_exr PRIVATE OpenEXR::IlmImf)
|
||||
endif()
|
||||
kde_target_enable_exceptions(kimg_exr PRIVATE)
|
||||
|
||||
if (QT_MAJOR_VERSION STREQUAL "5")
|
||||
install(FILES exr.desktop DESTINATION ${KDE_INSTALL_KSERVICESDIR}/qimageioplugins/)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
##################################
|
||||
|
||||
kimageformats_add_plugin(kimg_hdr SOURCES hdr.cpp)
|
||||
if (QT_MAJOR_VERSION STREQUAL "5")
|
||||
install(FILES hdr.desktop DESTINATION ${KDE_INSTALL_KSERVICESDIR}/qimageioplugins/)
|
||||
endif()
|
||||
|
||||
##################################
|
||||
|
||||
if (LibHeif_FOUND)
|
||||
kimageformats_add_plugin(kimg_heif SOURCES heif.cpp)
|
||||
target_link_libraries(kimg_heif PkgConfig::LibHeif)
|
||||
|
||||
if (QT_MAJOR_VERSION STREQUAL "5")
|
||||
install(FILES heif.desktop DESTINATION ${KDE_INSTALL_KSERVICESDIR}/qimageioplugins/)
|
||||
endif()
|
||||
target_link_libraries(kimg_heif PRIVATE PkgConfig::LibHeif)
|
||||
endif()
|
||||
|
||||
##################################
|
||||
|
||||
if (LibJXL_FOUND AND LibJXLThreads_FOUND)
|
||||
kimageformats_add_plugin(kimg_jxl SOURCES jxl.cpp)
|
||||
target_link_libraries(kimg_jxl PkgConfig::LibJXL PkgConfig::LibJXLThreads)
|
||||
|
||||
if (QT_MAJOR_VERSION STREQUAL "5")
|
||||
install(FILES jxl.desktop DESTINATION ${KDE_INSTALL_KSERVICESDIR}/qimageioplugins/)
|
||||
endif()
|
||||
target_link_libraries(kimg_jxl PRIVATE PkgConfig::LibJXL PkgConfig::LibJXLThreads)
|
||||
endif()
|
||||
|
||||
##################################
|
||||
|
||||
kimageformats_add_plugin(kimg_pcx SOURCES pcx.cpp)
|
||||
if (QT_MAJOR_VERSION STREQUAL "5")
|
||||
install(FILES pcx.desktop DESTINATION ${KDE_INSTALL_KSERVICESDIR}/qimageioplugins/)
|
||||
endif()
|
||||
|
||||
##################################
|
||||
|
||||
kimageformats_add_plugin(kimg_pic SOURCES pic.cpp)
|
||||
if (QT_MAJOR_VERSION STREQUAL "5")
|
||||
install(FILES pic.desktop DESTINATION ${KDE_INSTALL_KSERVICESDIR}/qimageioplugins/)
|
||||
endif()
|
||||
|
||||
##################################
|
||||
|
||||
kimageformats_add_plugin(kimg_psd SOURCES psd.cpp)
|
||||
if (QT_MAJOR_VERSION STREQUAL "5")
|
||||
install(FILES psd.desktop DESTINATION ${KDE_INSTALL_KSERVICESDIR}/qimageioplugins/)
|
||||
endif()
|
||||
kimageformats_add_plugin(kimg_pfm SOURCES pfm.cpp)
|
||||
|
||||
##################################
|
||||
|
||||
kimageformats_add_plugin(kimg_psd SOURCES psd.cpp scanlineconverter.cpp)
|
||||
|
||||
##################################
|
||||
|
||||
kimageformats_add_plugin(kimg_pxr SOURCES pxr.cpp)
|
||||
|
||||
##################################
|
||||
|
||||
kimageformats_add_plugin(kimg_qoi SOURCES qoi.cpp scanlineconverter.cpp)
|
||||
if (QT_MAJOR_VERSION STREQUAL "5")
|
||||
install(FILES qoi.desktop DESTINATION ${KDE_INSTALL_KSERVICESDIR}/qimageioplugins/)
|
||||
endif()
|
||||
|
||||
##################################
|
||||
|
||||
kimageformats_add_plugin(kimg_ras SOURCES ras.cpp)
|
||||
if (QT_MAJOR_VERSION STREQUAL "5")
|
||||
install(FILES ras.desktop DESTINATION ${KDE_INSTALL_KSERVICESDIR}/qimageioplugins/)
|
||||
endif()
|
||||
|
||||
##################################
|
||||
|
||||
kimageformats_add_plugin(kimg_rgb SOURCES rgb.cpp)
|
||||
if (QT_MAJOR_VERSION STREQUAL "5")
|
||||
install(FILES rgb.desktop DESTINATION ${KDE_INSTALL_KSERVICESDIR}/qimageioplugins/)
|
||||
endif()
|
||||
|
||||
##################################
|
||||
|
||||
kimageformats_add_plugin(kimg_tga SOURCES tga.cpp)
|
||||
if (QT_MAJOR_VERSION STREQUAL "5")
|
||||
install(FILES tga.desktop DESTINATION ${KDE_INSTALL_KSERVICESDIR}/qimageioplugins/)
|
||||
endif()
|
||||
|
||||
##################################
|
||||
|
||||
kimageformats_add_plugin(kimg_xcf SOURCES xcf.cpp)
|
||||
if (QT_MAJOR_VERSION STREQUAL "5")
|
||||
install(FILES xcf.desktop DESTINATION ${KDE_INSTALL_KSERVICESDIR}/qimageioplugins/)
|
||||
endif()
|
||||
|
||||
##################################
|
||||
|
||||
if (LibRaw_FOUND)
|
||||
kimageformats_add_plugin(kimg_raw SOURCES raw.cpp)
|
||||
kde_enable_exceptions()
|
||||
target_link_libraries(kimg_raw LibRaw::LibRaw)
|
||||
if (QT_MAJOR_VERSION STREQUAL "5")
|
||||
install(FILES raw.desktop DESTINATION ${KDE_INSTALL_KSERVICESDIR}/qimageioplugins/)
|
||||
target_link_libraries(kimg_raw PRIVATE LibRaw::LibRaw)
|
||||
endif()
|
||||
|
||||
##################################
|
||||
|
||||
if (LibJXR_FOUND)
|
||||
kimageformats_add_plugin(kimg_jxr SOURCES jxr.cpp)
|
||||
kde_enable_exceptions()
|
||||
target_include_directories(kimg_jxr PRIVATE ${LIBJXR_INCLUDE_DIRS})
|
||||
target_link_libraries(kimg_jxr PRIVATE jpegxr jxrglue)
|
||||
target_compile_definitions(kimg_jxr PRIVATE INITGUID)
|
||||
if (NOT CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-error=undef")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-error=undef")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
##################################
|
||||
|
||||
if (KF5Archive_FOUND)
|
||||
if (KF6Archive_FOUND)
|
||||
|
||||
kimageformats_add_plugin(kimg_kra SOURCES kra.cpp)
|
||||
target_link_libraries(kimg_kra KF5::Archive)
|
||||
if (QT_MAJOR_VERSION STREQUAL "5")
|
||||
install(FILES kra.desktop DESTINATION ${KDE_INSTALL_KSERVICESDIR}/qimageioplugins/)
|
||||
endif()
|
||||
target_link_libraries(kimg_kra PRIVATE KF6::Archive)
|
||||
|
||||
kimageformats_add_plugin(kimg_ora SOURCES ora.cpp)
|
||||
target_link_libraries(kimg_ora KF5::Archive)
|
||||
if (QT_MAJOR_VERSION STREQUAL "5")
|
||||
install(FILES ora.desktop DESTINATION ${KDE_INSTALL_KSERVICESDIR}/qimageioplugins/)
|
||||
endif()
|
||||
target_link_libraries(kimg_ora PRIVATE KF6::Archive)
|
||||
|
||||
endif()
|
||||
|
@ -90,7 +90,7 @@ bool ANIHandler::read(QImage *outImage)
|
||||
}
|
||||
|
||||
const QByteArray frameSizeData = device()->read(sizeof(quint32_le));
|
||||
if (frameSizeData.count() != sizeof(quint32_le)) {
|
||||
if (frameSizeData.size() != sizeof(quint32_le)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -383,8 +383,8 @@ bool ANIHandler::ensureScanned() const
|
||||
|
||||
// TODO should we check that the number of rate entries matches nSteps?
|
||||
auto *dataPtr = data.data();
|
||||
QVector<int> list;
|
||||
for (int i = 0; i < data.count(); i += sizeof(quint32_le)) {
|
||||
QList<int> list;
|
||||
for (int i = 0; i < data.size(); i += sizeof(quint32_le)) {
|
||||
const auto entry = *(reinterpret_cast<const quint32_le *>(dataPtr + i));
|
||||
list.append(entry);
|
||||
}
|
||||
|