Compare commits
267 Commits
v5.75.0-rc
...
v6.1.0
Author | SHA1 | Date | |
---|---|---|---|
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 | |||
4c6d2b92b6 | |||
05bd9397b3 | |||
f4ca3f6783 | |||
a30f043e5d | |||
7af4eea253 | |||
a3049f6740 | |||
3b1e8f7054 | |||
dcab3a06ab | |||
361f9e867e | |||
35883aa604 | |||
50846f224f | |||
9ad82ed608 | |||
c9f32a226f | |||
a0df142408 | |||
8586bb4719 | |||
d734f28727 | |||
afa7399b36 | |||
bfb12093ad | |||
1190e53e9b | |||
350ce1b990 | |||
bcbf45e23a | |||
c71a7984d6 | |||
b1f3a87896 | |||
8af9a0f9d9 | |||
3790a89cd1 | |||
f475a4b24a | |||
d2f38b8b9c | |||
9ab64dbf22 | |||
20f74ce5e6 | |||
54129819d5 | |||
181eb253c6 | |||
c5f7ea7eac | |||
ea14882ff7 | |||
f8bfdce285 | |||
524f083ee4 | |||
c96ad6ba8a | |||
49bd131eef | |||
2a25ec7a56 | |||
a8a477ae67 | |||
2f27dff48b | |||
72a1cc23b1 | |||
6f3a326cf8 | |||
d881a7bbb1 | |||
65a20b43fc | |||
84941b7690 | |||
21928300c6 | |||
024d199ed0 | |||
9ac923ad09 | |||
feb6d9b20f | |||
dfbc6e0f8c | |||
43543f96bc | |||
62e477a6f2 | |||
e6955e1f03 | |||
6074c4d6fd | |||
6f44c5c52a | |||
d030c75925 | |||
9b3133ac92 | |||
b0a0bb1294 | |||
3d5090593c | |||
d4966d169b | |||
bf52896347 | |||
c52ffa2227 | |||
e4e386babf | |||
b47a9d7022 | |||
2cbf815d1f | |||
6cd0056f3b | |||
83374f390e | |||
5e59d950bd | |||
de320447f6 | |||
cf375a207f | |||
2aec1d3926 | |||
2a84dd677d | |||
ebcc34519c | |||
cff2604cf9 | |||
f8a251e268 | |||
52134fc2e9 | |||
343954ca98 | |||
44fd6b7bc0 | |||
c8a0806aab | |||
bb475dedd1 | |||
9e28aae868 | |||
5c47a97b79 | |||
84d56d00cf | |||
384f78a13c | |||
72fc32aefc | |||
98f19c60ae | |||
ae6b724824 | |||
3e751dd80d | |||
e69dff73e6 | |||
64cfe52bee | |||
8732fc8487 | |||
d9729b7190 | |||
55d3c568b2 | |||
4afafee6c1 | |||
f04084e175 | |||
9911c9c2ea | |||
4ceef5164d | |||
3d2d91a08a | |||
0a02458560 | |||
96836e849f | |||
f4edb7296f | |||
56376ffd66 | |||
f534254063 | |||
32347725cb | |||
56e762c563 | |||
81603ed908 | |||
957c199c68 | |||
f445e5dd0a | |||
d3da56bba3 | |||
41c4b5930c | |||
fb66044714 | |||
a43394a759 | |||
904c251f50 | |||
2f9e09f04a | |||
6458c9ae52 | |||
45cd128f73 | |||
e89d21f12d | |||
1d2b51ddf1 | |||
1080976abe | |||
abd550c60c | |||
aade392da3 | |||
7642633551 | |||
9f2c5061c8 | |||
28099eed71 | |||
f5d574b3ad | |||
a8f92e5525 | |||
fbeef559b7 | |||
7f56d835f0 | |||
8f87ce4cb2 | |||
5aa03c12ad | |||
3266a9c466 | |||
1b2bf6e931 | |||
894391b000 | |||
ef6be2c077 | |||
96b40da089 | |||
bf3f94da76 | |||
318dacda75 | |||
e358bb0feb | |||
dca6e87c89 | |||
62f9af9a35 | |||
ff53d3d7e9 | |||
780f342825 | |||
297ed9a2fe | |||
55b4077f2c | |||
2429c95336 | |||
224f892b09 | |||
64fa129ed6 | |||
3cb4021afc | |||
95a19a15c3 | |||
1ba23a1e8e | |||
bc3c04c7ce | |||
2755f74fbb | |||
3b0c767f82 | |||
e80fcd7c30 | |||
a73e3d44dd | |||
1169859b07 | |||
04e276dcb3 | |||
e3ab850712 | |||
503b3eee2b | |||
511a22f0b4 | |||
c532227d43 | |||
1462c3abd6 | |||
ca52d4ddf5 | |||
7ba4d6adda | |||
0aaab103b1 | |||
8b9125c913 | |||
8845dd9818 | |||
a4b8295625 | |||
134c96fa61 | |||
3673874a63 | |||
8ad43638ad | |||
c72c9f577b | |||
bf3f99abf5 | |||
b79d1f222d | |||
bf1de9f8f0 | |||
82d5e0f8a4 | |||
bbf945137a | |||
54ed1dda27 | |||
34a9ec1b06 | |||
a6ec69d276 | |||
02cbf3889f | |||
6cf05cf305 | |||
938b8126b5 | |||
d36c191351 | |||
1acb5a6177 | |||
f2ccbf1724 | |||
5825c83235 | |||
b742cb7cc7 | |||
2e6eeebdfc | |||
db0b5d571a |
3
.git-blame-ignore-revs
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
#clang-format/tidy
|
||||||
|
1169859b07f25c865ee0bfc2a7dc97a431651776
|
||||||
|
eaca33bec8b19498c3621fc3a20a8c55a2812462
|
1
.gitattributes
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
autotests/read/raw/RAW_KODAK_C330_FORMAT_NONE_YRGB.raw binary
|
6
.gitignore
vendored
@ -20,3 +20,9 @@ random_seed
|
|||||||
CMakeLists.txt.user*
|
CMakeLists.txt.user*
|
||||||
*.unc-backup*
|
*.unc-backup*
|
||||||
.cmake/
|
.cmake/
|
||||||
|
/.clang-format
|
||||||
|
/compile_commands.json
|
||||||
|
.clangd
|
||||||
|
.idea
|
||||||
|
/cmake-build*
|
||||||
|
.cache
|
||||||
|
10
.gitlab-ci.yml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
# SPDX-FileCopyrightText: 2020 Volker Krause <vkrause@kde.org>
|
||||||
|
# SPDX-License-Identifier: CC0-1.0
|
||||||
|
|
||||||
|
include:
|
||||||
|
- project: sysadmin/ci-utilities
|
||||||
|
file:
|
||||||
|
- /gitlab-templates/linux-qt6.yml
|
||||||
|
- /gitlab-templates/android-qt6.yml
|
||||||
|
- /gitlab-templates/freebsd-qt6.yml
|
||||||
|
- /gitlab-templates/windows-qt6.yml
|
9
.kde-ci.yml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
Dependencies:
|
||||||
|
- 'on': ['Linux', 'FreeBSD', 'macOS', 'Windows']
|
||||||
|
'require':
|
||||||
|
'frameworks/extra-cmake-modules': '@same'
|
||||||
|
'frameworks/karchive' : '@same'
|
||||||
|
|
||||||
|
Options:
|
||||||
|
test-before-installing: True
|
||||||
|
require-passing-tests-on: [ 'Linux', 'FreeBSD', 'Windows' ]
|
@ -1,29 +1,31 @@
|
|||||||
cmake_minimum_required(VERSION 3.5)
|
cmake_minimum_required(VERSION 3.16)
|
||||||
|
|
||||||
project(KImageFormats)
|
set(KF_VERSION "6.1.0") # handled by release scripts
|
||||||
|
set(KF_DEP_VERSION "6.1.0") # handled by release scripts
|
||||||
set (CMAKE_CXX_STANDARD 14)
|
project(KImageFormats VERSION ${KF_VERSION})
|
||||||
|
|
||||||
include(FeatureSummary)
|
include(FeatureSummary)
|
||||||
find_package(ECM 5.75.0 NO_MODULE)
|
find_package(ECM 6.1.0 NO_MODULE)
|
||||||
set_package_properties(ECM PROPERTIES TYPE REQUIRED DESCRIPTION "Extra CMake Modules." URL "https://commits.kde.org/extra-cmake-modules")
|
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)
|
feature_summary(WHAT REQUIRED_PACKAGES_NOT_FOUND FATAL_ON_MISSING_REQUIRED_PACKAGES)
|
||||||
|
|
||||||
|
|
||||||
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH})
|
set(CMAKE_MODULE_PATH ${KImageFormats_SOURCE_DIR}/cmake/find-modules ${ECM_MODULE_PATH})
|
||||||
|
|
||||||
include(KDEInstallDirs)
|
include(KDEInstallDirs)
|
||||||
include(KDEFrameworkCompilerSettings NO_POLICY_SCOPE)
|
include(KDEFrameworkCompilerSettings NO_POLICY_SCOPE)
|
||||||
include(KDECMakeSettings)
|
include(KDECMakeSettings)
|
||||||
|
|
||||||
|
include(KDEGitCommitHooks)
|
||||||
|
include(ECMDeprecationSettings)
|
||||||
include(CheckIncludeFiles)
|
include(CheckIncludeFiles)
|
||||||
|
include(FindPkgConfig)
|
||||||
|
|
||||||
set(REQUIRED_QT_VERSION 5.12.0)
|
set(REQUIRED_QT_VERSION 6.5.0)
|
||||||
find_package(Qt5Gui ${REQUIRED_QT_VERSION} REQUIRED NO_MODULE)
|
find_package(Qt6Gui ${REQUIRED_QT_VERSION} REQUIRED NO_MODULE)
|
||||||
|
|
||||||
find_package(KF5Archive)
|
find_package(KF6Archive ${KF_DEP_VERSION})
|
||||||
set_package_properties(KF5Archive PROPERTIES
|
set_package_properties(KF6Archive PROPERTIES
|
||||||
TYPE OPTIONAL
|
TYPE OPTIONAL
|
||||||
PURPOSE "Required for the QImage plugin for Krita and OpenRaster images"
|
PURPOSE "Required for the QImage plugin for Krita and OpenRaster images"
|
||||||
)
|
)
|
||||||
@ -32,30 +34,66 @@ set_package_properties(KF5Archive PROPERTIES
|
|||||||
# this available in PATH
|
# this available in PATH
|
||||||
set(BUILD_EPS_PLUGIN FALSE)
|
set(BUILD_EPS_PLUGIN FALSE)
|
||||||
if (UNIX)
|
if (UNIX)
|
||||||
find_package(Qt5PrintSupport ${REQUIRED_QT_VERSION} NO_MODULE)
|
find_package(Qt6PrintSupport ${REQUIRED_QT_VERSION} NO_MODULE)
|
||||||
set_package_properties(Qt5PrintSupport PROPERTIES
|
set_package_properties(Qt6PrintSupport PROPERTIES
|
||||||
PURPOSE "Required for the QImage plugin for EPS images"
|
PURPOSE "Required for the QImage plugin for EPS images"
|
||||||
TYPE OPTIONAL
|
TYPE OPTIONAL
|
||||||
)
|
)
|
||||||
if (Qt5PrintSupport_FOUND)
|
if (TARGET Qt6::PrintSupport)
|
||||||
set(BUILD_EPS_PLUGIN TRUE)
|
set(BUILD_EPS_PLUGIN TRUE)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
find_package(OpenEXR)
|
find_package(OpenEXR 3.0 CONFIG QUIET)
|
||||||
|
if(NOT OpenEXR_FOUND)
|
||||||
|
find_package(OpenEXR)
|
||||||
|
endif()
|
||||||
set_package_properties(OpenEXR PROPERTIES
|
set_package_properties(OpenEXR PROPERTIES
|
||||||
TYPE OPTIONAL
|
TYPE OPTIONAL
|
||||||
PURPOSE "Required for the QImage plugin for OpenEXR images"
|
PURPOSE "Required for the QImage plugin for OpenEXR images"
|
||||||
)
|
)
|
||||||
add_definitions(-DQT_NO_FOREACH)
|
|
||||||
# 050d00 (5.13) triggers a BIC in qimageiohandler.h, in Qt 5.13, so do not enable that until we can require 5.14
|
find_package(libavif 0.8.2 CONFIG QUIET)
|
||||||
# https://codereview.qt-project.org/c/qt/qtbase/+/279215
|
if(NOT libavif_FOUND)
|
||||||
add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0x050c00)
|
find_package(libavif 1 CONFIG)
|
||||||
add_definitions(-DKF_DISABLE_DEPRECATED_BEFORE_AND_AT=0x054900)
|
endif()
|
||||||
|
set_package_properties(libavif PROPERTIES
|
||||||
|
TYPE OPTIONAL
|
||||||
|
PURPOSE "Required for the QImage plugin for AVIF images"
|
||||||
|
)
|
||||||
|
|
||||||
|
option(KIMAGEFORMATS_HEIF "Enable plugin for HEIF format" OFF)
|
||||||
|
if(KIMAGEFORMATS_HEIF)
|
||||||
|
pkg_check_modules(LibHeif IMPORTED_TARGET libheif>=1.10.0)
|
||||||
|
endif()
|
||||||
|
add_feature_info(LibHeif LibHeif_FOUND "required for the QImage plugin for HEIF/HEIC images")
|
||||||
|
|
||||||
|
option(KIMAGEFORMATS_JXL "Enable plugin for JPEG XL format" ON)
|
||||||
|
if(KIMAGEFORMATS_JXL)
|
||||||
|
pkg_check_modules(LibJXL IMPORTED_TARGET libjxl>=0.7.0)
|
||||||
|
pkg_check_modules(LibJXLThreads IMPORTED_TARGET libjxl_threads>=0.7.0)
|
||||||
|
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"
|
||||||
|
)
|
||||||
|
|
||||||
|
ecm_set_disabled_deprecation_versions(
|
||||||
|
QT 6.5
|
||||||
|
KF 5.102
|
||||||
|
)
|
||||||
|
|
||||||
add_subdirectory(src)
|
add_subdirectory(src)
|
||||||
if (BUILD_TESTING)
|
if (BUILD_TESTING)
|
||||||
add_subdirectory(autotests)
|
add_subdirectory(autotests)
|
||||||
add_subdirectory(tests)
|
add_subdirectory(tests)
|
||||||
endif()
|
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.
|
121
LICENSES/CC0-1.0.txt
Normal file
@ -0,0 +1,121 @@
|
|||||||
|
Creative Commons Legal Code
|
||||||
|
|
||||||
|
CC0 1.0 Universal
|
||||||
|
|
||||||
|
CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
|
||||||
|
LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
|
||||||
|
ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
|
||||||
|
INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
|
||||||
|
REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
|
||||||
|
PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
|
||||||
|
THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
|
||||||
|
HEREUNDER.
|
||||||
|
|
||||||
|
Statement of Purpose
|
||||||
|
|
||||||
|
The laws of most jurisdictions throughout the world automatically confer
|
||||||
|
exclusive Copyright and Related Rights (defined below) upon the creator
|
||||||
|
and subsequent owner(s) (each and all, an "owner") of an original work of
|
||||||
|
authorship and/or a database (each, a "Work").
|
||||||
|
|
||||||
|
Certain owners wish to permanently relinquish those rights to a Work for
|
||||||
|
the purpose of contributing to a commons of creative, cultural and
|
||||||
|
scientific works ("Commons") that the public can reliably and without fear
|
||||||
|
of later claims of infringement build upon, modify, incorporate in other
|
||||||
|
works, reuse and redistribute as freely as possible in any form whatsoever
|
||||||
|
and for any purposes, including without limitation commercial purposes.
|
||||||
|
These owners may contribute to the Commons to promote the ideal of a free
|
||||||
|
culture and the further production of creative, cultural and scientific
|
||||||
|
works, or to gain reputation or greater distribution for their Work in
|
||||||
|
part through the use and efforts of others.
|
||||||
|
|
||||||
|
For these and/or other purposes and motivations, and without any
|
||||||
|
expectation of additional consideration or compensation, the person
|
||||||
|
associating CC0 with a Work (the "Affirmer"), to the extent that he or she
|
||||||
|
is an owner of Copyright and Related Rights in the Work, voluntarily
|
||||||
|
elects to apply CC0 to the Work and publicly distribute the Work under its
|
||||||
|
terms, with knowledge of his or her Copyright and Related Rights in the
|
||||||
|
Work and the meaning and intended legal effect of CC0 on those rights.
|
||||||
|
|
||||||
|
1. Copyright and Related Rights. A Work made available under CC0 may be
|
||||||
|
protected by copyright and related or neighboring rights ("Copyright and
|
||||||
|
Related Rights"). Copyright and Related Rights include, but are not
|
||||||
|
limited to, the following:
|
||||||
|
|
||||||
|
i. the right to reproduce, adapt, distribute, perform, display,
|
||||||
|
communicate, and translate a Work;
|
||||||
|
ii. moral rights retained by the original author(s) and/or performer(s);
|
||||||
|
iii. publicity and privacy rights pertaining to a person's image or
|
||||||
|
likeness depicted in a Work;
|
||||||
|
iv. rights protecting against unfair competition in regards to a Work,
|
||||||
|
subject to the limitations in paragraph 4(a), below;
|
||||||
|
v. rights protecting the extraction, dissemination, use and reuse of data
|
||||||
|
in a Work;
|
||||||
|
vi. database rights (such as those arising under Directive 96/9/EC of the
|
||||||
|
European Parliament and of the Council of 11 March 1996 on the legal
|
||||||
|
protection of databases, and under any national implementation
|
||||||
|
thereof, including any amended or successor version of such
|
||||||
|
directive); and
|
||||||
|
vii. other similar, equivalent or corresponding rights throughout the
|
||||||
|
world based on applicable law or treaty, and any national
|
||||||
|
implementations thereof.
|
||||||
|
|
||||||
|
2. Waiver. To the greatest extent permitted by, but not in contravention
|
||||||
|
of, applicable law, Affirmer hereby overtly, fully, permanently,
|
||||||
|
irrevocably and unconditionally waives, abandons, and surrenders all of
|
||||||
|
Affirmer's Copyright and Related Rights and associated claims and causes
|
||||||
|
of action, whether now known or unknown (including existing as well as
|
||||||
|
future claims and causes of action), in the Work (i) in all territories
|
||||||
|
worldwide, (ii) for the maximum duration provided by applicable law or
|
||||||
|
treaty (including future time extensions), (iii) in any current or future
|
||||||
|
medium and for any number of copies, and (iv) for any purpose whatsoever,
|
||||||
|
including without limitation commercial, advertising or promotional
|
||||||
|
purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
|
||||||
|
member of the public at large and to the detriment of Affirmer's heirs and
|
||||||
|
successors, fully intending that such Waiver shall not be subject to
|
||||||
|
revocation, rescission, cancellation, termination, or any other legal or
|
||||||
|
equitable action to disrupt the quiet enjoyment of the Work by the public
|
||||||
|
as contemplated by Affirmer's express Statement of Purpose.
|
||||||
|
|
||||||
|
3. Public License Fallback. Should any part of the Waiver for any reason
|
||||||
|
be judged legally invalid or ineffective under applicable law, then the
|
||||||
|
Waiver shall be preserved to the maximum extent permitted taking into
|
||||||
|
account Affirmer's express Statement of Purpose. In addition, to the
|
||||||
|
extent the Waiver is so judged Affirmer hereby grants to each affected
|
||||||
|
person a royalty-free, non transferable, non sublicensable, non exclusive,
|
||||||
|
irrevocable and unconditional license to exercise Affirmer's Copyright and
|
||||||
|
Related Rights in the Work (i) in all territories worldwide, (ii) for the
|
||||||
|
maximum duration provided by applicable law or treaty (including future
|
||||||
|
time extensions), (iii) in any current or future medium and for any number
|
||||||
|
of copies, and (iv) for any purpose whatsoever, including without
|
||||||
|
limitation commercial, advertising or promotional purposes (the
|
||||||
|
"License"). The License shall be deemed effective as of the date CC0 was
|
||||||
|
applied by Affirmer to the Work. Should any part of the License for any
|
||||||
|
reason be judged legally invalid or ineffective under applicable law, such
|
||||||
|
partial invalidity or ineffectiveness shall not invalidate the remainder
|
||||||
|
of the License, and in such case Affirmer hereby affirms that he or she
|
||||||
|
will not (i) exercise any of his or her remaining Copyright and Related
|
||||||
|
Rights in the Work or (ii) assert any associated claims and causes of
|
||||||
|
action with respect to the Work, in either case contrary to Affirmer's
|
||||||
|
express Statement of Purpose.
|
||||||
|
|
||||||
|
4. Limitations and Disclaimers.
|
||||||
|
|
||||||
|
a. No trademark or patent rights held by Affirmer are waived, abandoned,
|
||||||
|
surrendered, licensed or otherwise affected by this document.
|
||||||
|
b. Affirmer offers the Work as-is and makes no representations or
|
||||||
|
warranties of any kind concerning the Work, express, implied,
|
||||||
|
statutory or otherwise, including without limitation warranties of
|
||||||
|
title, merchantability, fitness for a particular purpose, non
|
||||||
|
infringement, or the absence of latent or other defects, accuracy, or
|
||||||
|
the present or absence of errors, whether or not discoverable, all to
|
||||||
|
the greatest extent permissible under applicable law.
|
||||||
|
c. Affirmer disclaims responsibility for clearing rights of other persons
|
||||||
|
that may apply to the Work or any use thereof, including without
|
||||||
|
limitation any person's Copyright and Related Rights in the Work.
|
||||||
|
Further, Affirmer disclaims responsibility for obtaining any necessary
|
||||||
|
consents, permissions or other rights required for any use of the
|
||||||
|
Work.
|
||||||
|
d. Affirmer understands and acknowledges that Creative Commons is not a
|
||||||
|
party to this document and has no duty or obligation with respect to
|
||||||
|
this CC0 or use of the Work.
|
20
README.md
@ -13,19 +13,27 @@ image formats.
|
|||||||
|
|
||||||
The following image formats have read-only support:
|
The following image formats have read-only support:
|
||||||
|
|
||||||
|
- Animated Windows cursors (ani)
|
||||||
|
- Camera RAW images (arw, cr2, cr3, dcs, dng, ...)
|
||||||
- Gimp (xcf)
|
- Gimp (xcf)
|
||||||
- OpenEXR (exr)
|
- Krita (kra)
|
||||||
- Photoshop documents (psd)
|
- OpenRaster (ora)
|
||||||
- Sun Raster (ras)
|
- Photoshop documents (psd, psb, pdd, psdt)
|
||||||
|
- Radiance HDR (hdr)
|
||||||
|
- Sun Raster (im1, im8, im24, im32, ras, sun)
|
||||||
|
|
||||||
The following image formats have read and write support:
|
The following image formats have read and write support:
|
||||||
|
|
||||||
|
- AV1 Image File Format (AVIF)
|
||||||
- Encapsulated PostScript (eps)
|
- Encapsulated PostScript (eps)
|
||||||
|
- High Efficiency Image File Format (heif). Can be enabled with the KIMAGEFORMATS_HEIF build option.
|
||||||
|
- JPEG XL (jxl)
|
||||||
|
- OpenEXR (exr)
|
||||||
- Personal Computer Exchange (pcx)
|
- Personal Computer Exchange (pcx)
|
||||||
|
- Quite OK Image format (qoi)
|
||||||
- SGI images (rgb, rgba, sgi, bw)
|
- SGI images (rgb, rgba, sgi, bw)
|
||||||
- Softimage PIC (pic)
|
- Softimage PIC (pic)
|
||||||
- Targa (tga): supports more formats than Qt's version
|
- Targa (tga): supports more formats than Qt's version
|
||||||
- XView (xv)
|
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|
||||||
@ -37,10 +45,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
|
you are willing to sign the Qt Project contributor agreement, it may be
|
||||||
better to submit the plugin directly to the Qt Project.
|
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
|
## Duplicated Plugins
|
||||||
|
|
||||||
The TGA plugin supports more formats than Qt's own TGA plugin;
|
The TGA plugin supports more formats than Qt's own TGA plugin;
|
||||||
|
@ -1,7 +1,4 @@
|
|||||||
#find_package(Qt5Test ${REQUIRED_QT_VERSION} NO_MODULE)
|
|
||||||
|
|
||||||
include(ECMMarkAsTest)
|
include(ECMMarkAsTest)
|
||||||
include(CMakeParseArguments)
|
|
||||||
|
|
||||||
add_definitions(-DPLUGIN_DIR="${CMAKE_CURRENT_BINARY_DIR}/../bin")
|
add_definitions(-DPLUGIN_DIR="${CMAKE_CURRENT_BINARY_DIR}/../bin")
|
||||||
remove_definitions(-DQT_NO_CAST_FROM_ASCII)
|
remove_definitions(-DQT_NO_CAST_FROM_ASCII)
|
||||||
@ -15,7 +12,7 @@ macro(kimageformats_read_tests)
|
|||||||
|
|
||||||
if (NOT TARGET readtest)
|
if (NOT TARGET readtest)
|
||||||
add_executable(readtest readtest.cpp)
|
add_executable(readtest readtest.cpp)
|
||||||
target_link_libraries(readtest Qt5::Gui)
|
target_link_libraries(readtest Qt6::Gui)
|
||||||
target_compile_definitions(readtest
|
target_compile_definitions(readtest
|
||||||
PRIVATE IMAGEDIR="${CMAKE_CURRENT_SOURCE_DIR}/read")
|
PRIVATE IMAGEDIR="${CMAKE_CURRENT_SOURCE_DIR}/read")
|
||||||
ecm_mark_as_test(readtest)
|
ecm_mark_as_test(readtest)
|
||||||
@ -30,23 +27,35 @@ macro(kimageformats_read_tests)
|
|||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
macro(kimageformats_write_tests)
|
macro(kimageformats_write_tests)
|
||||||
|
cmake_parse_arguments(KIF_RT "" "FUZZ" "" ${ARGN})
|
||||||
|
set(_fuzzarg)
|
||||||
|
if (KIF_RT_FUZZ)
|
||||||
|
set(_fuzzarg -f ${KIF_RT_FUZZ})
|
||||||
|
endif()
|
||||||
|
|
||||||
if (NOT TARGET writetest)
|
if (NOT TARGET writetest)
|
||||||
add_executable(writetest writetest.cpp)
|
add_executable(writetest writetest.cpp)
|
||||||
target_link_libraries(writetest Qt5::Gui)
|
target_link_libraries(writetest Qt6::Gui)
|
||||||
target_compile_definitions(writetest
|
target_compile_definitions(writetest
|
||||||
PRIVATE IMAGEDIR="${CMAKE_CURRENT_SOURCE_DIR}/write")
|
PRIVATE IMAGEDIR="${CMAKE_CURRENT_SOURCE_DIR}/write")
|
||||||
ecm_mark_as_test(writetest)
|
ecm_mark_as_test(writetest)
|
||||||
endif()
|
endif()
|
||||||
foreach(_testname ${ARGN})
|
foreach(_testname ${KIF_RT_UNPARSED_ARGUMENTS})
|
||||||
string(REGEX MATCH "-lossless$" _is_lossless "${_testname}")
|
string(REGEX MATCH "-lossless$" _is_lossless "${_testname}")
|
||||||
|
string(REGEX MATCH "-nodatacheck" _is_no_data_check "${_testname}")
|
||||||
unset(lossless_arg)
|
unset(lossless_arg)
|
||||||
|
unset(no_data_check_arg)
|
||||||
if (_is_lossless)
|
if (_is_lossless)
|
||||||
set(lossless_arg "--lossless")
|
set(lossless_arg "--lossless")
|
||||||
string(REGEX REPLACE "-lossless$" "" _testname "${_testname}")
|
string(REGEX REPLACE "-lossless$" "" _testname "${_testname}")
|
||||||
endif()
|
endif()
|
||||||
|
if (_is_no_data_check)
|
||||||
|
set(no_data_check_arg "--no-data-check")
|
||||||
|
string(REGEX REPLACE "-nodatacheck$" "" _testname "${_testname}")
|
||||||
|
endif()
|
||||||
add_test(
|
add_test(
|
||||||
NAME kimageformats-write-${_testname}
|
NAME kimageformats-write-${_testname}
|
||||||
COMMAND writetest ${lossless_arg} ${_testname}
|
COMMAND writetest ${lossless_arg} ${no_data_check_arg} ${_fuzzarg} ${_testname}
|
||||||
)
|
)
|
||||||
endforeach(_testname)
|
endforeach(_testname)
|
||||||
endmacro()
|
endmacro()
|
||||||
@ -58,18 +67,53 @@ kimageformats_read_tests(
|
|||||||
hdr
|
hdr
|
||||||
pcx
|
pcx
|
||||||
psd
|
psd
|
||||||
|
qoi
|
||||||
ras
|
ras
|
||||||
rgb
|
rgb
|
||||||
tga
|
tga
|
||||||
)
|
)
|
||||||
|
|
||||||
if (KF5Archive_FOUND)
|
if (KF6Archive_FOUND)
|
||||||
kimageformats_read_tests(
|
kimageformats_read_tests(
|
||||||
kra
|
kra
|
||||||
ora
|
ora
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if (TARGET avif)
|
||||||
|
kimageformats_read_tests(
|
||||||
|
avif
|
||||||
|
)
|
||||||
|
kimageformats_write_tests(
|
||||||
|
avif-nodatacheck-lossless
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (LibHeif_FOUND)
|
||||||
|
kimageformats_read_tests(
|
||||||
|
heif
|
||||||
|
)
|
||||||
|
# because the plug-ins use RGB->YUV conversion which sometimes results in 1 value difference.
|
||||||
|
kimageformats_write_tests(FUZZ 1
|
||||||
|
heif-nodatacheck-lossless
|
||||||
|
)
|
||||||
|
|
||||||
|
if (LibHeif_VERSION VERSION_GREATER_EQUAL "1.17.0")
|
||||||
|
kimageformats_read_tests(FUZZ 1
|
||||||
|
hej2
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (LibJXL_FOUND AND LibJXLThreads_FOUND)
|
||||||
|
kimageformats_read_tests(
|
||||||
|
jxl
|
||||||
|
)
|
||||||
|
kimageformats_write_tests(
|
||||||
|
jxl-nodatacheck-lossless
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
# Allow some fuzziness when reading this formats, to allow for
|
# Allow some fuzziness when reading this formats, to allow for
|
||||||
# rounding errors (eg: in alpha blending).
|
# rounding errors (eg: in alpha blending).
|
||||||
kimageformats_read_tests(FUZZ 1
|
kimageformats_read_tests(FUZZ 1
|
||||||
@ -85,6 +129,7 @@ kimageformats_read_tests(FUZZ 1
|
|||||||
kimageformats_write_tests(
|
kimageformats_write_tests(
|
||||||
pcx-lossless
|
pcx-lossless
|
||||||
pic-lossless
|
pic-lossless
|
||||||
|
qoi-lossless
|
||||||
rgb-lossless
|
rgb-lossless
|
||||||
tga # fixme: the alpha images appear not to be written properly
|
tga # fixme: the alpha images appear not to be written properly
|
||||||
)
|
)
|
||||||
@ -96,17 +141,35 @@ kimageformats_write_tests(
|
|||||||
# kimageformats_write_tests(eps)
|
# kimageformats_write_tests(eps)
|
||||||
#endif()
|
#endif()
|
||||||
if (OpenEXR_FOUND)
|
if (OpenEXR_FOUND)
|
||||||
# FIXME: OpenEXR tests
|
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()
|
endif()
|
||||||
|
|
||||||
find_package(Qt5Test ${REQUIRED_QT_VERSION} CONFIG QUIET)
|
if (LibRaw_FOUND)
|
||||||
|
kimageformats_read_tests(
|
||||||
|
raw
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
if(NOT Qt5Test_FOUND)
|
find_package(Qt6Test ${REQUIRED_QT_VERSION} CONFIG QUIET)
|
||||||
message(STATUS "Qt5Test 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()
|
return()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_executable(pictest pictest.cpp)
|
add_executable(pictest pictest.cpp)
|
||||||
target_link_libraries(pictest Qt5::Gui Qt5::Test)
|
target_link_libraries(pictest Qt6::Gui Qt6::Test)
|
||||||
ecm_mark_as_test(pictest)
|
ecm_mark_as_test(pictest)
|
||||||
add_test(NAME kimageformats-pic COMMAND pictest)
|
add_test(NAME kimageformats-pic COMMAND pictest)
|
||||||
|
|
||||||
|
add_executable(anitest anitest.cpp)
|
||||||
|
target_link_libraries(anitest Qt6::Gui Qt6::Test)
|
||||||
|
ecm_mark_as_test(anitest)
|
||||||
|
add_test(NAME kimageformats-ani COMMAND anitest)
|
||||||
|
BIN
autotests/ani/test.ani
Normal file
BIN
autotests/ani/test_1.png
Normal file
After Width: | Height: | Size: 813 B |
BIN
autotests/ani/test_2.png
Normal file
After Width: | Height: | Size: 697 B |
BIN
autotests/ani/test_3.png
Normal file
After Width: | Height: | Size: 810 B |
119
autotests/anitest.cpp
Normal file
@ -0,0 +1,119 @@
|
|||||||
|
/*
|
||||||
|
SPDX-FileCopyrightText: 2020 Kai Uwe Broulik <kde@broulik.de>
|
||||||
|
|
||||||
|
SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <QImage>
|
||||||
|
#include <QImageReader>
|
||||||
|
#include <QTest>
|
||||||
|
|
||||||
|
static bool imgEquals(const QImage &im1, const QImage &im2)
|
||||||
|
{
|
||||||
|
const int height = im1.height();
|
||||||
|
const int width = im1.width();
|
||||||
|
for (int i = 0; i < height; ++i) {
|
||||||
|
const auto *line1 = reinterpret_cast<const quint8 *>(im1.scanLine(i));
|
||||||
|
const auto *line2 = reinterpret_cast<const quint8 *>(im2.scanLine(i));
|
||||||
|
for (int j = 0; j < width; ++j) {
|
||||||
|
if (line1[j] - line2[j] != 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
class AniTests : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
private Q_SLOTS:
|
||||||
|
void initTestCase()
|
||||||
|
{
|
||||||
|
QCoreApplication::addLibraryPath(QStringLiteral(PLUGIN_DIR));
|
||||||
|
}
|
||||||
|
|
||||||
|
void testReadMetadata()
|
||||||
|
{
|
||||||
|
QImageReader reader(QFINDTESTDATA("ani/test.ani"));
|
||||||
|
|
||||||
|
QVERIFY(reader.canRead());
|
||||||
|
|
||||||
|
QCOMPARE(reader.imageCount(), 4);
|
||||||
|
|
||||||
|
QCOMPARE(reader.size(), QSize(32, 32));
|
||||||
|
|
||||||
|
QCOMPARE(reader.text(QStringLiteral("Title")), QStringLiteral("ANI Test"));
|
||||||
|
QCOMPARE(reader.text(QStringLiteral("Author")), QStringLiteral("KDE Community"));
|
||||||
|
}
|
||||||
|
|
||||||
|
void textRead()
|
||||||
|
{
|
||||||
|
QImageReader reader(QFINDTESTDATA("ani/test.ani"));
|
||||||
|
QVERIFY(reader.canRead());
|
||||||
|
QCOMPARE(reader.currentImageNumber(), 0);
|
||||||
|
|
||||||
|
QImage aniFrame;
|
||||||
|
QVERIFY(reader.read(&aniFrame));
|
||||||
|
|
||||||
|
QImage img1(QFINDTESTDATA("ani/test_1.png"));
|
||||||
|
img1.convertTo(aniFrame.format());
|
||||||
|
|
||||||
|
QVERIFY(imgEquals(aniFrame, img1));
|
||||||
|
|
||||||
|
QCOMPARE(reader.nextImageDelay(), 166); // 10 "jiffies"
|
||||||
|
|
||||||
|
QVERIFY(reader.canRead());
|
||||||
|
// that read() above should have advanced us to the next frame
|
||||||
|
QCOMPARE(reader.currentImageNumber(), 1);
|
||||||
|
|
||||||
|
QVERIFY(reader.read(&aniFrame));
|
||||||
|
QImage img2(QFINDTESTDATA("ani/test_2.png"));
|
||||||
|
img2.convertTo(aniFrame.format());
|
||||||
|
|
||||||
|
QVERIFY(imgEquals(aniFrame, img2));
|
||||||
|
|
||||||
|
// The "middle" frame has a longer delay than the others
|
||||||
|
QCOMPARE(reader.nextImageDelay(), 333); // 20 "jiffies"
|
||||||
|
|
||||||
|
QVERIFY(reader.canRead());
|
||||||
|
QCOMPARE(reader.currentImageNumber(), 2);
|
||||||
|
|
||||||
|
QVERIFY(reader.read(&aniFrame));
|
||||||
|
QImage img3(QFINDTESTDATA("ani/test_3.png"));
|
||||||
|
img3.convertTo(aniFrame.format());
|
||||||
|
|
||||||
|
QVERIFY(imgEquals(aniFrame, img3));
|
||||||
|
|
||||||
|
QCOMPARE(reader.nextImageDelay(), 166);
|
||||||
|
|
||||||
|
QVERIFY(reader.canRead());
|
||||||
|
QCOMPARE(reader.currentImageNumber(), 3);
|
||||||
|
|
||||||
|
QVERIFY(reader.read(&aniFrame));
|
||||||
|
// custom sequence in the ANI file should get us back to img2
|
||||||
|
QVERIFY(imgEquals(aniFrame, img2));
|
||||||
|
|
||||||
|
QCOMPARE(reader.nextImageDelay(), 166);
|
||||||
|
|
||||||
|
// We should have reached the end now
|
||||||
|
QVERIFY(!reader.canRead());
|
||||||
|
QVERIFY(!reader.read(&aniFrame));
|
||||||
|
|
||||||
|
// Jump back to the start
|
||||||
|
QVERIFY(reader.jumpToImage(0));
|
||||||
|
|
||||||
|
QVERIFY(reader.canRead());
|
||||||
|
QCOMPARE(reader.currentImageNumber(), 0);
|
||||||
|
|
||||||
|
QCOMPARE(reader.nextImageDelay(), 166);
|
||||||
|
|
||||||
|
QVERIFY(reader.read(&aniFrame));
|
||||||
|
QVERIFY(imgEquals(aniFrame, img1));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
QTEST_MAIN(AniTests)
|
||||||
|
|
||||||
|
#include "anitest.moc"
|
37
autotests/fuzzyeq.cpp
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
/*
|
||||||
|
SPDX-FileCopyrightText: 2014 Alex Merry <alex.merry@kdemail.net>
|
||||||
|
|
||||||
|
SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
|
||||||
|
*/
|
||||||
|
|
||||||
|
template<class Trait>
|
||||||
|
static bool fuzzyeq(const QImage &im1, const QImage &im2, uchar fuzziness)
|
||||||
|
{
|
||||||
|
Q_ASSERT(im1.format() == im2.format());
|
||||||
|
Q_ASSERT(im1.depth() == 24 || im1.depth() == 32 || im1.depth() == 64);
|
||||||
|
|
||||||
|
const int height = im1.height();
|
||||||
|
const int width = im1.width();
|
||||||
|
for (int i = 0; i < height; ++i) {
|
||||||
|
const Trait *line1 = reinterpret_cast<const Trait *>(im1.scanLine(i));
|
||||||
|
const Trait *line2 = reinterpret_cast<const Trait *>(im2.scanLine(i));
|
||||||
|
for (int j = 0; j < width; ++j) {
|
||||||
|
if (line1[j] > line2[j]) {
|
||||||
|
if (line1[j] - line2[j] > fuzziness) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (line2[j] - line1[j] > fuzziness) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// allow each byte to be different by up to 1, to allow for rounding errors
|
||||||
|
static bool fuzzyeq(const QImage &im1, const QImage &im2, uchar fuzziness)
|
||||||
|
{
|
||||||
|
return (im1.depth() == 64) ? fuzzyeq<quint16>(im1, im2, fuzziness) : fuzzyeq<quint8>(im1, im2, fuzziness);
|
||||||
|
}
|
@ -35,61 +35,27 @@ private:
|
|||||||
QTest::addColumn<QImage::Format>("pngformat");
|
QTest::addColumn<QImage::Format>("pngformat");
|
||||||
QTest::addColumn<bool>("compress");
|
QTest::addColumn<bool>("compress");
|
||||||
|
|
||||||
QTest::newRow("4x4 no alpha RLE")
|
QTest::newRow("4x4 no alpha RLE") << QFINDTESTDATA("pic/4x4-simple-color.pic") << QFINDTESTDATA("pic/4x4-simple-color.png") << QString() << false
|
||||||
<< QFINDTESTDATA("pic/4x4-simple-color.pic")
|
<< QImage::Format_RGB32 << true;
|
||||||
<< QFINDTESTDATA("pic/4x4-simple-color.png")
|
|
||||||
<< QString()
|
|
||||||
<< false
|
|
||||||
<< QImage::Format_RGB32
|
|
||||||
<< true;
|
|
||||||
|
|
||||||
QTest::newRow("4x4 no alpha raw")
|
QTest::newRow("4x4 no alpha raw") << QFINDTESTDATA("pic/4x4-simple-color-uncompressed.pic") << QFINDTESTDATA("pic/4x4-simple-color.png") << QString()
|
||||||
<< QFINDTESTDATA("pic/4x4-simple-color-uncompressed.pic")
|
<< false << QImage::Format_RGB32 << false;
|
||||||
<< QFINDTESTDATA("pic/4x4-simple-color.png")
|
|
||||||
<< QString()
|
|
||||||
<< false
|
|
||||||
<< QImage::Format_RGB32
|
|
||||||
<< false;
|
|
||||||
|
|
||||||
QTest::newRow("Short comment")
|
QTest::newRow("Short comment") << QFINDTESTDATA("pic/short-comment.pic") << QFINDTESTDATA("pic/4x4-simple-color.png")
|
||||||
<< QFINDTESTDATA("pic/short-comment.pic")
|
<< QStringLiteral("Test comment value") << false << QImage::Format_RGB32 << true;
|
||||||
<< QFINDTESTDATA("pic/4x4-simple-color.png")
|
|
||||||
<< QStringLiteral("Test comment value")
|
|
||||||
<< false
|
|
||||||
<< QImage::Format_RGB32
|
|
||||||
<< true;
|
|
||||||
|
|
||||||
QTest::newRow("Long comment")
|
QTest::newRow("Long comment") << QFINDTESTDATA("pic/long-comment.pic") << QFINDTESTDATA("pic/4x4-simple-color.png")
|
||||||
<< QFINDTESTDATA("pic/long-comment.pic")
|
<< QStringLiteral("Test comment value that goes right up to the end of the comment field and has no") << false
|
||||||
<< QFINDTESTDATA("pic/4x4-simple-color.png")
|
<< QImage::Format_RGB32 << true;
|
||||||
<< QStringLiteral("Test comment value that goes right up to the end of the comment field and has no")
|
|
||||||
<< false
|
|
||||||
<< QImage::Format_RGB32
|
|
||||||
<< true;
|
|
||||||
|
|
||||||
QTest::newRow("Long run-lengths")
|
QTest::newRow("Long run-lengths") << QFINDTESTDATA("pic/long-runs.pic") << QFINDTESTDATA("pic/long-runs.png") << QString() << false
|
||||||
<< QFINDTESTDATA("pic/long-runs.pic")
|
<< QImage::Format_RGB32 << true;
|
||||||
<< QFINDTESTDATA("pic/long-runs.png")
|
|
||||||
<< QString()
|
|
||||||
<< false
|
|
||||||
<< QImage::Format_RGB32
|
|
||||||
<< true;
|
|
||||||
|
|
||||||
QTest::newRow("4x4 with alpha RLE")
|
QTest::newRow("4x4 with alpha RLE") << QFINDTESTDATA("pic/4x4-alpha.pic") << QFINDTESTDATA("pic/4x4-alpha.png") << QString() << true
|
||||||
<< QFINDTESTDATA("pic/4x4-alpha.pic")
|
<< QImage::Format_ARGB32 << true;
|
||||||
<< QFINDTESTDATA("pic/4x4-alpha.png")
|
|
||||||
<< QString()
|
|
||||||
<< true
|
|
||||||
<< QImage::Format_ARGB32
|
|
||||||
<< true;
|
|
||||||
|
|
||||||
QTest::newRow("4x4 with alpha raw")
|
QTest::newRow("4x4 with alpha raw") << QFINDTESTDATA("pic/4x4-alpha-uncompressed.pic") << QFINDTESTDATA("pic/4x4-alpha.png") << QString() << true
|
||||||
<< QFINDTESTDATA("pic/4x4-alpha-uncompressed.pic")
|
<< QImage::Format_ARGB32 << false;
|
||||||
<< QFINDTESTDATA("pic/4x4-alpha.png")
|
|
||||||
<< QString()
|
|
||||||
<< true
|
|
||||||
<< QImage::Format_ARGB32
|
|
||||||
<< false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
@ -106,13 +72,8 @@ private Q_SLOTS:
|
|||||||
// so there is no actual data loss in converting to RGB16.
|
// so there is no actual data loss in converting to RGB16.
|
||||||
// This just tests that the pic plugin can deal with different
|
// This just tests that the pic plugin can deal with different
|
||||||
// input formats.
|
// input formats.
|
||||||
QTest::newRow("altered format")
|
QTest::newRow("altered format") << QFINDTESTDATA("pic/4x4-simple-color.pic") << QFINDTESTDATA("pic/4x4-simple-color.png") << QString() << false
|
||||||
<< QFINDTESTDATA("pic/4x4-simple-color.pic")
|
<< QImage::Format_RGB16 << true;
|
||||||
<< QFINDTESTDATA("pic/4x4-simple-color.png")
|
|
||||||
<< QString()
|
|
||||||
<< false
|
|
||||||
<< QImage::Format_RGB16
|
|
||||||
<< true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void testRead_data()
|
void testRead_data()
|
||||||
@ -148,17 +109,12 @@ private Q_SLOTS:
|
|||||||
imgWriter.write(pngImage);
|
imgWriter.write(pngImage);
|
||||||
|
|
||||||
if (expData != picData) {
|
if (expData != picData) {
|
||||||
QString fileNameBase = QUuid::createUuid().toString()
|
QString fileNameBase = QUuid::createUuid().toString().remove(QLatin1Char('{')).remove(QLatin1Char('}'));
|
||||||
.remove(QLatin1Char('{'))
|
|
||||||
.remove(QLatin1Char('}'));
|
|
||||||
QFile dumpFile(fileNameBase + QStringLiteral(".pic"));
|
QFile dumpFile(fileNameBase + QStringLiteral(".pic"));
|
||||||
QVERIFY2(dumpFile.open(QIODevice::WriteOnly), qPrintable(dumpFile.errorString()));
|
QVERIFY2(dumpFile.open(QIODevice::WriteOnly), qPrintable(dumpFile.errorString()));
|
||||||
dumpFile.write(picData);
|
dumpFile.write(picData);
|
||||||
QString msg = QStringLiteral("Written data (")
|
QString msg =
|
||||||
+ dumpFile.fileName()
|
QStringLiteral("Written data (") + dumpFile.fileName() + QStringLiteral(") differed from expected data (") + picfile + QLatin1Char(')');
|
||||||
+ QStringLiteral(") differed from expected data (")
|
|
||||||
+ picfile
|
|
||||||
+ QLatin1Char(')');
|
|
||||||
QFAIL(qPrintable(msg));
|
QFAIL(qPrintable(msg));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -182,29 +138,20 @@ private Q_SLOTS:
|
|||||||
QCOMPARE(inputImage.width(), expImage.width());
|
QCOMPARE(inputImage.width(), expImage.width());
|
||||||
QCOMPARE(inputImage.height(), expImage.height());
|
QCOMPARE(inputImage.height(), expImage.height());
|
||||||
QCOMPARE(inputImage.hasAlphaChannel(), alpha);
|
QCOMPARE(inputImage.hasAlphaChannel(), alpha);
|
||||||
QCOMPARE(inputImage.format(), alpha ? QImage::Format_ARGB32
|
QCOMPARE(inputImage.format(), alpha ? QImage::Format_ARGB32 : QImage::Format_RGB32);
|
||||||
: QImage::Format_RGB32);
|
|
||||||
|
|
||||||
expImage = expImage.convertToFormat(pngformat);
|
expImage = expImage.convertToFormat(pngformat);
|
||||||
expImage = expImage.convertToFormat(alpha ? QImage::Format_ARGB32
|
expImage = expImage.convertToFormat(alpha ? QImage::Format_ARGB32 : QImage::Format_RGB32);
|
||||||
: QImage::Format_RGB32);
|
|
||||||
if (inputImage != expImage) {
|
if (inputImage != expImage) {
|
||||||
QString fileNameBase = QUuid::createUuid().toString()
|
QString fileNameBase = QUuid::createUuid().toString().remove(QLatin1Char('{')).remove(QLatin1Char('}'));
|
||||||
.remove(QLatin1Char('{'))
|
|
||||||
.remove(QLatin1Char('}'));
|
|
||||||
QFile picDumpFile(fileNameBase + QStringLiteral("-expected.data"));
|
QFile picDumpFile(fileNameBase + QStringLiteral("-expected.data"));
|
||||||
QVERIFY2(picDumpFile.open(QIODevice::WriteOnly), qPrintable(picDumpFile.errorString()));
|
QVERIFY2(picDumpFile.open(QIODevice::WriteOnly), qPrintable(picDumpFile.errorString()));
|
||||||
picDumpFile.write(reinterpret_cast<const char *>(inputImage.bits()),
|
picDumpFile.write(reinterpret_cast<const char *>(inputImage.bits()), inputImage.sizeInBytes());
|
||||||
inputImage.sizeInBytes());
|
|
||||||
QFile pngDumpFile(fileNameBase + QStringLiteral("-actual.data"));
|
QFile pngDumpFile(fileNameBase + QStringLiteral("-actual.data"));
|
||||||
QVERIFY2(pngDumpFile.open(QIODevice::WriteOnly), qPrintable(pngDumpFile.errorString()));
|
QVERIFY2(pngDumpFile.open(QIODevice::WriteOnly), qPrintable(pngDumpFile.errorString()));
|
||||||
pngDumpFile.write(reinterpret_cast<const char *>(expImage.bits()),
|
pngDumpFile.write(reinterpret_cast<const char *>(expImage.bits()), expImage.sizeInBytes());
|
||||||
expImage.sizeInBytes());
|
QString msg = QStringLiteral("Read image (") + picDumpFile.fileName() + QStringLiteral(") differed from expected image (") + pngDumpFile.fileName()
|
||||||
QString msg = QStringLiteral("Read image (")
|
+ QLatin1Char(')');
|
||||||
+ picDumpFile.fileName()
|
|
||||||
+ QStringLiteral(") differed from expected image (")
|
|
||||||
+ pngDumpFile.fileName()
|
|
||||||
+ QLatin1Char(')');
|
|
||||||
QFAIL(qPrintable(msg));
|
QFAIL(qPrintable(msg));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -252,8 +199,7 @@ private Q_SLOTS:
|
|||||||
|
|
||||||
QImageReader inputReader(picfile, "pic");
|
QImageReader inputReader(picfile, "pic");
|
||||||
|
|
||||||
QCOMPARE(inputReader.imageFormat(),
|
QCOMPARE(inputReader.imageFormat(), alpha ? QImage::Format_ARGB32 : QImage::Format_RGB32);
|
||||||
alpha ? QImage::Format_ARGB32 : QImage::Format_RGB32);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
BIN
autotests/read/avif/bw.avif
Normal file
After Width: | Height: | Size: 629 B |
BIN
autotests/read/avif/bw.png
Normal file
After Width: | Height: | Size: 743 B |
BIN
autotests/read/avif/bwa.avif
Normal file
After Width: | Height: | Size: 823 B |
BIN
autotests/read/avif/bwa.png
Normal file
After Width: | Height: | Size: 574 B |
BIN
autotests/read/avif/rgb.avif
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
autotests/read/avif/rgb.png
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
autotests/read/avif/rgba.avif
Normal file
After Width: | Height: | Size: 2.2 KiB |
BIN
autotests/read/avif/rgba.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
autotests/read/avif/rotated090.avif
Normal file
After Width: | Height: | Size: 28 KiB |
BIN
autotests/read/avif/rotated090.png
Normal file
After Width: | Height: | Size: 17 KiB |
BIN
autotests/read/avif/rotated090_left-to-right.avif
Normal file
After Width: | Height: | Size: 29 KiB |
BIN
autotests/read/avif/rotated090_left-to-right.png
Normal file
After Width: | Height: | Size: 17 KiB |
BIN
autotests/read/avif/rotated090_top-to-bottom.avif
Normal file
After Width: | Height: | Size: 28 KiB |
BIN
autotests/read/avif/rotated090_top-to-bottom.png
Normal file
After Width: | Height: | Size: 17 KiB |
BIN
autotests/read/avif/rotated180.avif
Normal file
After Width: | Height: | Size: 29 KiB |
BIN
autotests/read/avif/rotated180.png
Normal file
After Width: | Height: | Size: 17 KiB |
BIN
autotests/read/avif/rotated180_left-to-right.avif
Normal file
After Width: | Height: | Size: 28 KiB |
BIN
autotests/read/avif/rotated180_left-to-right.png
Normal file
After Width: | Height: | Size: 17 KiB |
BIN
autotests/read/avif/rotated180_top-to-bottom.avif
Normal file
After Width: | Height: | Size: 28 KiB |
BIN
autotests/read/avif/rotated180_top-to-bottom.png
Normal file
After Width: | Height: | Size: 17 KiB |
BIN
autotests/read/avif/rotated270.avif
Normal file
After Width: | Height: | Size: 28 KiB |
BIN
autotests/read/avif/rotated270.png
Normal file
After Width: | Height: | Size: 17 KiB |
BIN
autotests/read/avif/rotated270_left-to-right.avif
Normal file
After Width: | Height: | Size: 28 KiB |
BIN
autotests/read/avif/rotated270_left-to-right.png
Normal file
After Width: | Height: | Size: 17 KiB |
BIN
autotests/read/avif/rotated270_top-to-bottom.avif
Normal file
After Width: | Height: | Size: 29 KiB |
BIN
autotests/read/avif/rotated270_top-to-bottom.png
Normal file
After Width: | Height: | Size: 17 KiB |
BIN
autotests/read/avif/unrotated.avif
Normal file
After Width: | Height: | Size: 28 KiB |
BIN
autotests/read/avif/unrotated.png
Normal file
After Width: | Height: | Size: 17 KiB |
BIN
autotests/read/avif/unrotated_left-to-right.avif
Normal file
After Width: | Height: | Size: 28 KiB |
BIN
autotests/read/avif/unrotated_left-to-right.png
Normal file
After Width: | Height: | Size: 17 KiB |
BIN
autotests/read/avif/unrotated_top-to-bottom.avif
Normal file
After Width: | Height: | Size: 28 KiB |
BIN
autotests/read/avif/unrotated_top-to-bottom.png
Normal file
After Width: | Height: | Size: 17 KiB |
BIN
autotests/read/exr/gray.exr
Normal file
BIN
autotests/read/exr/gray.png
Normal file
After Width: | Height: | Size: 1.6 KiB |
BIN
autotests/read/exr/rgb-gimp.exr
Normal file
BIN
autotests/read/exr/rgb-gimp.png
Normal file
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/hdr/rgb-landscape.hdr
Executable file
BIN
autotests/read/hdr/rgb-landscape.png
Executable file
After Width: | Height: | Size: 2.8 KiB |
BIN
autotests/read/hdr/rgb-portrait.hdr
Executable file
BIN
autotests/read/hdr/rgb-portrait.png
Normal file
After Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 2.7 KiB |
BIN
autotests/read/heif/rgb.heif
Normal file
BIN
autotests/read/heif/rgb.png
Normal file
After Width: | Height: | Size: 3.6 KiB |
BIN
autotests/read/heif/rgba.heif
Normal file
BIN
autotests/read/heif/rgba.png
Normal file
After Width: | Height: | Size: 3.9 KiB |
BIN
autotests/read/hej2/rgb_kcolorchooser.hej2
Normal file
BIN
autotests/read/hej2/rgb_kcolorchooser.png
Normal file
After Width: | Height: | Size: 27 KiB |
BIN
autotests/read/hej2/rgba_kolourpaint.hej2
Normal file
BIN
autotests/read/hej2/rgba_kolourpaint.png
Normal file
After Width: | Height: | Size: 16 KiB |
BIN
autotests/read/jxl/orientation1.jxl
Normal file
BIN
autotests/read/jxl/orientation1.png
Normal file
After Width: | Height: | Size: 17 KiB |
BIN
autotests/read/jxl/orientation2.jxl
Normal file
BIN
autotests/read/jxl/orientation2.png
Normal file
After Width: | Height: | Size: 17 KiB |
BIN
autotests/read/jxl/orientation3.jxl
Normal file
BIN
autotests/read/jxl/orientation3.png
Normal file
After Width: | Height: | Size: 17 KiB |
BIN
autotests/read/jxl/orientation4.jxl
Normal file
BIN
autotests/read/jxl/orientation4.png
Normal file
After Width: | Height: | Size: 17 KiB |
BIN
autotests/read/jxl/orientation5.jxl
Normal file
BIN
autotests/read/jxl/orientation5.png
Normal file
After Width: | Height: | Size: 17 KiB |
BIN
autotests/read/jxl/orientation6.jxl
Normal file
BIN
autotests/read/jxl/orientation6.png
Normal file
After Width: | Height: | Size: 17 KiB |
BIN
autotests/read/jxl/orientation7.jxl
Normal file
BIN
autotests/read/jxl/orientation7.png
Normal file
After Width: | Height: | Size: 17 KiB |
BIN
autotests/read/jxl/orientation8.jxl
Normal file
BIN
autotests/read/jxl/orientation8.png
Normal file
After Width: | Height: | Size: 17 KiB |
BIN
autotests/read/jxl/rgb.jxl
Normal file
BIN
autotests/read/jxl/rgb.png
Normal file
After Width: | Height: | Size: 528 KiB |
BIN
autotests/read/jxl/rgba.jxl
Normal file
BIN
autotests/read/jxl/rgba.png
Normal file
After Width: | Height: | Size: 117 KiB |
BIN
autotests/read/pcx/ccbug_463951.pcx
Normal file
BIN
autotests/read/pcx/ccbug_463951.png
Normal file
After Width: | Height: | Size: 8.5 KiB |
BIN
autotests/read/pcx/indexed8.pcx
Normal file
BIN
autotests/read/pcx/indexed8.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
autotests/read/pcx/mono.pcx
Normal file
BIN
autotests/read/pcx/mono.png
Normal file
After Width: | Height: | Size: 24 KiB |
BIN
autotests/read/psd/16bit-rle.png
Normal file
After Width: | Height: | Size: 78 KiB |
BIN
autotests/read/psd/16bit-rle.psd
Normal file
BIN
autotests/read/psd/16bit_grayscale.png
Normal file
After Width: | Height: | Size: 34 KiB |
BIN
autotests/read/psd/16bit_grayscale.psd
Normal file
BIN
autotests/read/psd/16bit_photoshop.png
Normal file
After Width: | Height: | Size: 70 KiB |