Compare commits
438 Commits
Author | SHA1 | Date | |
---|---|---|---|
1b3d2afbe3 | |||
850068c1dc | |||
6bf38ea638 | |||
2adca7c0ca | |||
dd69fdaea9 | |||
ae62ea3dfc | |||
9c47845f15 | |||
7c7fa73020 | |||
92e4271e84 | |||
6f588c6fd3 | |||
a182478e2c | |||
4026f41890 | |||
bef2b9168f | |||
473f5d9847 | |||
9bee29cc01 | |||
cdf3be3af1 | |||
752b18a42c | |||
97a1ea181c | |||
64a43fb04f | |||
6821c29819 | |||
e4d95c03fa | |||
afa8ed1a5d | |||
245c835d92 | |||
b2663d2651 | |||
35ab37c628 | |||
b28baa4a1e | |||
5d2540c135 | |||
25cc8bc262 | |||
7742537f8c | |||
d3386bbf50 | |||
e77986c7e0 | |||
c0261f4926 | |||
e5cf9caac5 | |||
90d4256f3d | |||
bb1c6aab9e | |||
74a734efed | |||
e9fa4b6610 | |||
36a6ef7d78 | |||
9fd6896cec | |||
9b14e752db | |||
90a2e3b412 | |||
b28cf4c352 | |||
b536ec4a5e | |||
7d7b295ac2 | |||
397957a976 | |||
18a729f7a1 | |||
7a74b50d64 | |||
0a06a07fa4 | |||
e89408b426 | |||
8a05711e99 | |||
d6534f0e68 | |||
f608441b03 | |||
49060026b7 | |||
424e7a75de | |||
be534ea06e | |||
baaf1093a1 | |||
e83458a5d8 | |||
873ec1bb5f | |||
287a447095 | |||
ebb9c1ec18 | |||
ac3591c7ea | |||
a89367dde6 | |||
65a587afad | |||
5f92bcbf26 | |||
ae00c110f2 | |||
f39ca9dc9b | |||
f296c38daf | |||
bda8487147 | |||
bb10c4bd5c | |||
1982557a55 | |||
c97ee00f5e | |||
e6a0f8758b | |||
5c0c7e4fd7 | |||
40c2aae0cd | |||
f49704b2df | |||
43f3fd05f7 | |||
a7cf1a87f9 | |||
fe28130cb3 | |||
c0d5b8854b | |||
0b2c6d725d | |||
894524f7e4 | |||
348ddce987 | |||
1cb294545f | |||
b649cca304 | |||
adc5c7ae9a | |||
a6f7482957 | |||
d91c7dd912 | |||
86865223d2 | |||
ecbcf3b7f4 | |||
87eff569a4 | |||
a531978e2a | |||
ceb1c46fea | |||
6558b3255a | |||
374961dab4 | |||
b5d8b6638e | |||
92a1752c1f | |||
9f05ecb523 | |||
28c4ceeba9 | |||
f029a4a8ed | |||
56f229a2f1 | |||
72d4c41415 | |||
4923e2ecaa | |||
b645c9c258 | |||
8265b3602b | |||
dbd439bd98 | |||
a664baa9f9 | |||
c38a1a0248 | |||
2ea724c241 | |||
ecfbff8197 | |||
4dedd88c08 | |||
d233e80dbb | |||
799ac37660 | |||
0378bd67e1 | |||
7d696a81d2 | |||
b5d5abe0ea | |||
3f4690d1e9 | |||
ac1006cc66 | |||
97120b2537 | |||
fee0165bef | |||
ae641f7e94 | |||
46f7b90ce6 | |||
f7c8eaa140 | |||
36bfee8ae3 | |||
e2aaf89ec5 | |||
989a5c70d6 | |||
8588c053b6 | |||
145dedf360 | |||
2405a09e36 | |||
d02dcb064b | |||
0590c6b49d | |||
eb46f0f421 | |||
8c23e74ef6 | |||
219d9cb2c2 | |||
51921e8ee5 | |||
23e9fec869 | |||
4478bc8d2b | |||
acd6b3970c | |||
638fdfcbdd | |||
a497ab789b | |||
3590a43fc5 | |||
f5a6de7280 | |||
4c0f49295b | |||
e9da5edb9a | |||
e10f5aa9a5 | |||
14020a23d5 | |||
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 | |||
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 | |||
da2fc84a3b | |||
d6b79d16ad | |||
fc9a128f47 | |||
d326d5dab9 |
3
.git-blame-ignore-revs
Normal file
@ -0,0 +1,3 @@
|
||||
#clang-format/tidy
|
||||
1169859b07f25c865ee0bfc2a7dc97a431651776
|
||||
eaca33bec8b19498c3621fc3a20a8c55a2812462
|
15
.gitattributes
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
autotests/read/raw/RAW_KODAK_C330_FORMAT_NONE_YRGB.raw binary
|
||||
autotests/read/hdr/orientation1.hdr binary
|
||||
autotests/read/hdr/orientation2.hdr binary
|
||||
autotests/read/hdr/orientation3.hdr binary
|
||||
autotests/read/hdr/orientation4.hdr binary
|
||||
autotests/read/hdr/orientation5.hdr binary
|
||||
autotests/read/hdr/orientation6.hdr binary
|
||||
autotests/read/hdr/orientation7.hdr binary
|
||||
autotests/read/hdr/orientation8.hdr binary
|
||||
autotests/read/hdr/fake_earth.hdr binary
|
||||
autotests/read/hdr/rgb.hdr binary
|
||||
autotests/read/hdr/rgb-landscape.hdr binary
|
||||
autotests/read/hdr/rgb-portrait.hdr binary
|
||||
autotests/read/pfm/testcard_gray_half.phm binary
|
||||
autotests/read/pfm/testcard_rgb_half.phm binary
|
6
.gitignore
vendored
@ -20,3 +20,9 @@ random_seed
|
||||
CMakeLists.txt.user*
|
||||
*.unc-backup*
|
||||
.cmake/
|
||||
/.clang-format
|
||||
/compile_commands.json
|
||||
.clangd
|
||||
.idea
|
||||
/cmake-build*
|
||||
.cache
|
||||
|
22
.gitlab-ci.yml
Normal file
@ -0,0 +1,22 @@
|
||||
# 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/linux-qt6-next.yml
|
||||
- /gitlab-templates/alpine-qt6.yml
|
||||
- /gitlab-templates/android-qt6.yml
|
||||
- /gitlab-templates/freebsd-qt6.yml
|
||||
- /gitlab-templates/windows-qt6.yml
|
||||
- /gitlab-templates/xml-lint.yml
|
||||
- /gitlab-templates/yaml-lint.yml
|
||||
|
||||
image_json_validate:
|
||||
stage: validate
|
||||
image: invent-registry.kde.org/sysadmin/ci-images/suse-qt68:latest
|
||||
tags:
|
||||
- Linux
|
||||
script:
|
||||
- find src/imageformats/ -name *.json | xargs -I file bash -c "echo file && jq -e '(.Keys | type == \"array\") and (.MimeTypes | type == \"array\") and (.MimeTypes | length) == (.Keys | length)' file"
|
11
.kde-ci.yml
Normal file
@ -0,0 +1,11 @@
|
||||
Dependencies:
|
||||
- 'on': ['Linux', 'FreeBSD', 'macOS', 'Windows', 'Android']
|
||||
'require':
|
||||
'frameworks/extra-cmake-modules': '@same'
|
||||
'frameworks/karchive': '@same'
|
||||
|
||||
Options:
|
||||
test-before-installing: True
|
||||
require-passing-tests-on: ['Linux', 'FreeBSD', 'Windows']
|
||||
cmake-options: "-DKIMAGEFORMATS_DDS=ON -DKIMAGEFORMATS_JXR=ON -DKIMAGEFORMATS_HEIF=ON"
|
||||
per-test-timeout: 90
|
@ -1,29 +1,31 @@
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
|
||||
project(KImageFormats)
|
||||
|
||||
set (CMAKE_CXX_STANDARD 14)
|
||||
set(KF_VERSION "6.14.0") # handled by release scripts
|
||||
set(KF_DEP_VERSION "6.14.0") # handled by release scripts
|
||||
project(KImageFormats VERSION ${KF_VERSION})
|
||||
|
||||
include(FeatureSummary)
|
||||
find_package(ECM 5.73.0 NO_MODULE)
|
||||
find_package(ECM 6.14.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)
|
||||
|
||||
|
||||
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH})
|
||||
set(CMAKE_MODULE_PATH ${KImageFormats_SOURCE_DIR}/cmake/find-modules ${ECM_MODULE_PATH})
|
||||
|
||||
include(KDEInstallDirs)
|
||||
include(KDEFrameworkCompilerSettings NO_POLICY_SCOPE)
|
||||
include(KDECMakeSettings)
|
||||
|
||||
|
||||
include(KDEGitCommitHooks)
|
||||
include(ECMDeprecationSettings)
|
||||
include(CheckIncludeFiles)
|
||||
include(FindPkgConfig)
|
||||
|
||||
set(REQUIRED_QT_VERSION 5.12.0)
|
||||
find_package(Qt5Gui ${REQUIRED_QT_VERSION} REQUIRED NO_MODULE)
|
||||
set(REQUIRED_QT_VERSION 6.7.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,30 +34,82 @@ set_package_properties(KF5Archive PROPERTIES
|
||||
# this available in PATH
|
||||
set(BUILD_EPS_PLUGIN FALSE)
|
||||
if (UNIX)
|
||||
find_package(Qt5PrintSupport ${REQUIRED_QT_VERSION} NO_MODULE)
|
||||
set_package_properties(Qt5PrintSupport 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 (Qt5PrintSupport_FOUND)
|
||||
if (TARGET Qt6::PrintSupport)
|
||||
set(BUILD_EPS_PLUGIN TRUE)
|
||||
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
|
||||
TYPE OPTIONAL
|
||||
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
|
||||
# https://codereview.qt-project.org/c/qt/qtbase/+/279215
|
||||
add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0x050c00)
|
||||
add_definitions(-DKF_DISABLE_DEPRECATED_BEFORE_AND_AT=0x054700)
|
||||
|
||||
find_package(libavif 0.8.2 CONFIG QUIET)
|
||||
if(NOT libavif_FOUND)
|
||||
find_package(libavif 1 CONFIG)
|
||||
endif()
|
||||
set_package_properties(libavif PROPERTIES
|
||||
TYPE OPTIONAL
|
||||
PURPOSE "Required for the QImage plugin for AVIF images"
|
||||
)
|
||||
|
||||
option(KIMAGEFORMATS_DDS "Enable plugin for DDS format" ON)
|
||||
|
||||
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.9.4)
|
||||
pkg_check_modules(LibJXLThreads IMPORTED_TARGET libjxl_threads>=0.9.4)
|
||||
pkg_check_modules(LibJXLCMS IMPORTED_TARGET libjxl_cms>=0.9.4)
|
||||
endif()
|
||||
add_feature_info(LibJXL LibJXL_FOUND "required for the QImage plugin for JPEG XL images")
|
||||
|
||||
option(KIMAGEFORMATS_JP2 "Enable plugin for JPEG 2000 format" ON)
|
||||
if(KIMAGEFORMATS_JP2)
|
||||
find_package(OpenJPEG CONFIG)
|
||||
endif()
|
||||
add_feature_info(OpenJPEG OpenJPEG_FOUND "required for the QImage plugin for JPEG 2000 images")
|
||||
|
||||
|
||||
find_package(LibRaw 0.20.2)
|
||||
set_package_properties(LibRaw PROPERTIES
|
||||
TYPE OPTIONAL
|
||||
PURPOSE "Required for the QImage plugin for RAW images"
|
||||
)
|
||||
|
||||
# JXR plugin disabled by default due to security issues
|
||||
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 6.9.0
|
||||
KF 6.12.0
|
||||
)
|
||||
|
||||
add_subdirectory(src)
|
||||
if (BUILD_TESTING)
|
||||
add_subdirectory(autotests)
|
||||
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)
|
||||
|
510
COPYING.LIB
@ -1,510 +0,0 @@
|
||||
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 2.1, February 1999
|
||||
|
||||
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
|
||||
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
[This is the first released version of the Lesser GPL. It also counts
|
||||
as the successor of the GNU Library Public License, version 2, hence
|
||||
the version number 2.1.]
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
Licenses are intended to guarantee your freedom to share and change
|
||||
free software--to make sure the software is free for all its users.
|
||||
|
||||
This license, the Lesser General Public License, applies to some
|
||||
specially designated software packages--typically libraries--of the
|
||||
Free Software Foundation and other authors who decide to use it. You
|
||||
can use it too, but we suggest you first think carefully about whether
|
||||
this license or the ordinary General Public License is the better
|
||||
strategy to use in any particular case, based on the explanations
|
||||
below.
|
||||
|
||||
When we speak of free software, we are referring to freedom of use,
|
||||
not price. Our General Public Licenses are designed to make sure that
|
||||
you have the freedom to distribute copies of free software (and charge
|
||||
for this service if you wish); that you receive source code or can get
|
||||
it if you want it; that you can change the software and use pieces of
|
||||
it in new free programs; and that you are informed that you can do
|
||||
these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
distributors to deny you these rights or to ask you to surrender these
|
||||
rights. These restrictions translate to certain responsibilities for
|
||||
you if you distribute copies of the library or if you modify it.
|
||||
|
||||
For example, if you distribute copies of the library, whether gratis
|
||||
or for a fee, you must give the recipients all the rights that we gave
|
||||
you. You must make sure that they, too, receive or can get the source
|
||||
code. If you link other code with the library, you must provide
|
||||
complete object files to the recipients, so that they can relink them
|
||||
with the library after making changes to the library and recompiling
|
||||
it. And you must show them these terms so they know their rights.
|
||||
|
||||
We protect your rights with a two-step method: (1) we copyright the
|
||||
library, and (2) we offer you this license, which gives you legal
|
||||
permission to copy, distribute and/or modify the library.
|
||||
|
||||
To protect each distributor, we want to make it very clear that
|
||||
there is no warranty for the free library. Also, if the library is
|
||||
modified by someone else and passed on, the recipients should know
|
||||
that what they have is not the original version, so that the original
|
||||
author's reputation will not be affected by problems that might be
|
||||
introduced by others.
|
||||
|
||||
Finally, software patents pose a constant threat to the existence of
|
||||
any free program. We wish to make sure that a company cannot
|
||||
effectively restrict the users of a free program by obtaining a
|
||||
restrictive license from a patent holder. Therefore, we insist that
|
||||
any patent license obtained for a version of the library must be
|
||||
consistent with the full freedom of use specified in this license.
|
||||
|
||||
Most GNU software, including some libraries, is covered by the
|
||||
ordinary GNU General Public License. This license, the GNU Lesser
|
||||
General Public License, applies to certain designated libraries, and
|
||||
is quite different from the ordinary General Public License. We use
|
||||
this license for certain libraries in order to permit linking those
|
||||
libraries into non-free programs.
|
||||
|
||||
When a program is linked with a library, whether statically or using
|
||||
a shared library, the combination of the two is legally speaking a
|
||||
combined work, a derivative of the original library. The ordinary
|
||||
General Public License therefore permits such linking only if the
|
||||
entire combination fits its criteria of freedom. The Lesser General
|
||||
Public License permits more lax criteria for linking other code with
|
||||
the library.
|
||||
|
||||
We call this license the "Lesser" General Public License because it
|
||||
does Less to protect the user's freedom than the ordinary General
|
||||
Public License. It also provides other free software developers Less
|
||||
of an advantage over competing non-free programs. These disadvantages
|
||||
are the reason we use the ordinary General Public License for many
|
||||
libraries. However, the Lesser license provides advantages in certain
|
||||
special circumstances.
|
||||
|
||||
For example, on rare occasions, there may be a special need to
|
||||
encourage the widest possible use of a certain library, so that it
|
||||
becomes a de-facto standard. To achieve this, non-free programs must
|
||||
be allowed to use the library. A more frequent case is that a free
|
||||
library does the same job as widely used non-free libraries. In this
|
||||
case, there is little to gain by limiting the free library to free
|
||||
software only, so we use the Lesser General Public License.
|
||||
|
||||
In other cases, permission to use a particular library in non-free
|
||||
programs enables a greater number of people to use a large body of
|
||||
free software. For example, permission to use the GNU C Library in
|
||||
non-free programs enables many more people to use the whole GNU
|
||||
operating system, as well as its variant, the GNU/Linux operating
|
||||
system.
|
||||
|
||||
Although the Lesser General Public License is Less protective of the
|
||||
users' freedom, it does ensure that the user of a program that is
|
||||
linked with the Library has the freedom and the wherewithal to run
|
||||
that program using a modified version of the Library.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow. Pay close attention to the difference between a
|
||||
"work based on the library" and a "work that uses the library". The
|
||||
former contains code derived from the library, whereas the latter must
|
||||
be combined with the library in order to run.
|
||||
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License Agreement applies to any software library or other
|
||||
program which contains a notice placed by the copyright holder or
|
||||
other authorized party saying it may be distributed under the terms of
|
||||
this Lesser General Public License (also called "this License").
|
||||
Each licensee is addressed as "you".
|
||||
|
||||
A "library" means a collection of software functions and/or data
|
||||
prepared so as to be conveniently linked with application programs
|
||||
(which use some of those functions and data) to form executables.
|
||||
|
||||
The "Library", below, refers to any such software library or work
|
||||
which has been distributed under these terms. A "work based on the
|
||||
Library" means either the Library or any derivative work under
|
||||
copyright law: that is to say, a work containing the Library or a
|
||||
portion of it, either verbatim or with modifications and/or translated
|
||||
straightforwardly into another language. (Hereinafter, translation is
|
||||
included without limitation in the term "modification".)
|
||||
|
||||
"Source code" for a work means the preferred form of the work for
|
||||
making modifications to it. For a library, complete source code means
|
||||
all the source code for all modules it contains, plus any associated
|
||||
interface definition files, plus the scripts used to control
|
||||
compilation and installation of the library.
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running a program using the Library is not restricted, and output from
|
||||
such a program is covered only if its contents constitute a work based
|
||||
on the Library (independent of the use of the Library in a tool for
|
||||
writing it). Whether that is true depends on what the Library does
|
||||
and what the program that uses the Library does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Library's
|
||||
complete source code as you receive it, in any medium, provided that
|
||||
you conspicuously and appropriately publish on each copy an
|
||||
appropriate copyright notice and disclaimer of warranty; keep intact
|
||||
all the notices that refer to this License and to the absence of any
|
||||
warranty; and distribute a copy of this License along with the
|
||||
Library.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy,
|
||||
and you may at your option offer warranty protection in exchange for a
|
||||
fee.
|
||||
|
||||
2. You may modify your copy or copies of the Library or any portion
|
||||
of it, thus forming a work based on the Library, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) The modified work must itself be a software library.
|
||||
|
||||
b) You must cause the files modified to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
c) You must cause the whole of the work to be licensed at no
|
||||
charge to all third parties under the terms of this License.
|
||||
|
||||
d) If a facility in the modified Library refers to a function or a
|
||||
table of data to be supplied by an application program that uses
|
||||
the facility, other than as an argument passed when the facility
|
||||
is invoked, then you must make a good faith effort to ensure that,
|
||||
in the event an application does not supply such function or
|
||||
table, the facility still operates, and performs whatever part of
|
||||
its purpose remains meaningful.
|
||||
|
||||
(For example, a function in a library to compute square roots has
|
||||
a purpose that is entirely well-defined independent of the
|
||||
application. Therefore, Subsection 2d requires that any
|
||||
application-supplied function or table used by this function must
|
||||
be optional: if the application does not supply it, the square
|
||||
root function must still compute square roots.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Library,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Library, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote
|
||||
it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Library.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Library
|
||||
with the Library (or with a work based on the Library) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may opt to apply the terms of the ordinary GNU General Public
|
||||
License instead of this License to a given copy of the Library. To do
|
||||
this, you must alter all the notices that refer to this License, so
|
||||
that they refer to the ordinary GNU General Public License, version 2,
|
||||
instead of to this License. (If a newer version than version 2 of the
|
||||
ordinary GNU General Public License has appeared, then you can specify
|
||||
that version instead if you wish.) Do not make any other change in
|
||||
these notices.
|
||||
|
||||
Once this change is made in a given copy, it is irreversible for
|
||||
that copy, so the ordinary GNU General Public License applies to all
|
||||
subsequent copies and derivative works made from that copy.
|
||||
|
||||
This option is useful when you wish to copy part of the code of
|
||||
the Library into a program that is not a library.
|
||||
|
||||
4. You may copy and distribute the Library (or a portion or
|
||||
derivative of it, under Section 2) in object code or executable form
|
||||
under the terms of Sections 1 and 2 above provided that you accompany
|
||||
it with the complete corresponding machine-readable source code, which
|
||||
must be distributed under the terms of Sections 1 and 2 above on a
|
||||
medium customarily used for software interchange.
|
||||
|
||||
If distribution of object code is made by offering access to copy
|
||||
from a designated place, then offering equivalent access to copy the
|
||||
source code from the same place satisfies the requirement to
|
||||
distribute the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
5. A program that contains no derivative of any portion of the
|
||||
Library, but is designed to work with the Library by being compiled or
|
||||
linked with it, is called a "work that uses the Library". Such a
|
||||
work, in isolation, is not a derivative work of the Library, and
|
||||
therefore falls outside the scope of this License.
|
||||
|
||||
However, linking a "work that uses the Library" with the Library
|
||||
creates an executable that is a derivative of the Library (because it
|
||||
contains portions of the Library), rather than a "work that uses the
|
||||
library". The executable is therefore covered by this License.
|
||||
Section 6 states terms for distribution of such executables.
|
||||
|
||||
When a "work that uses the Library" uses material from a header file
|
||||
that is part of the Library, the object code for the work may be a
|
||||
derivative work of the Library even though the source code is not.
|
||||
Whether this is true is especially significant if the work can be
|
||||
linked without the Library, or if the work is itself a library. The
|
||||
threshold for this to be true is not precisely defined by law.
|
||||
|
||||
If such an object file uses only numerical parameters, data
|
||||
structure layouts and accessors, and small macros and small inline
|
||||
functions (ten lines or less in length), then the use of the object
|
||||
file is unrestricted, regardless of whether it is legally a derivative
|
||||
work. (Executables containing this object code plus portions of the
|
||||
Library will still fall under Section 6.)
|
||||
|
||||
Otherwise, if the work is a derivative of the Library, you may
|
||||
distribute the object code for the work under the terms of Section 6.
|
||||
Any executables containing that work also fall under Section 6,
|
||||
whether or not they are linked directly with the Library itself.
|
||||
|
||||
6. As an exception to the Sections above, you may also combine or
|
||||
link a "work that uses the Library" with the Library to produce a
|
||||
work containing portions of the Library, and distribute that work
|
||||
under terms of your choice, provided that the terms permit
|
||||
modification of the work for the customer's own use and reverse
|
||||
engineering for debugging such modifications.
|
||||
|
||||
You must give prominent notice with each copy of the work that the
|
||||
Library is used in it and that the Library and its use are covered by
|
||||
this License. You must supply a copy of this License. If the work
|
||||
during execution displays copyright notices, you must include the
|
||||
copyright notice for the Library among them, as well as a reference
|
||||
directing the user to the copy of this License. Also, you must do one
|
||||
of these things:
|
||||
|
||||
a) Accompany the work with the complete corresponding
|
||||
machine-readable source code for the Library including whatever
|
||||
changes were used in the work (which must be distributed under
|
||||
Sections 1 and 2 above); and, if the work is an executable linked
|
||||
with the Library, with the complete machine-readable "work that
|
||||
uses the Library", as object code and/or source code, so that the
|
||||
user can modify the Library and then relink to produce a modified
|
||||
executable containing the modified Library. (It is understood
|
||||
that the user who changes the contents of definitions files in the
|
||||
Library will not necessarily be able to recompile the application
|
||||
to use the modified definitions.)
|
||||
|
||||
b) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (1) uses at run time a
|
||||
copy of the library already present on the user's computer system,
|
||||
rather than copying library functions into the executable, and (2)
|
||||
will operate properly with a modified version of the library, if
|
||||
the user installs one, as long as the modified version is
|
||||
interface-compatible with the version that the work was made with.
|
||||
|
||||
c) Accompany the work with a written offer, valid for at least
|
||||
three years, to give the same user the materials specified in
|
||||
Subsection 6a, above, for a charge no more than the cost of
|
||||
performing this distribution.
|
||||
|
||||
d) If distribution of the work is made by offering access to copy
|
||||
from a designated place, offer equivalent access to copy the above
|
||||
specified materials from the same place.
|
||||
|
||||
e) Verify that the user has already received a copy of these
|
||||
materials or that you have already sent this user a copy.
|
||||
|
||||
For an executable, the required form of the "work that uses the
|
||||
Library" must include any data and utility programs needed for
|
||||
reproducing the executable from it. However, as a special exception,
|
||||
the materials to be distributed need not include anything that is
|
||||
normally distributed (in either source or binary form) with the major
|
||||
components (compiler, kernel, and so on) of the operating system on
|
||||
which the executable runs, unless that component itself accompanies
|
||||
the executable.
|
||||
|
||||
It may happen that this requirement contradicts the license
|
||||
restrictions of other proprietary libraries that do not normally
|
||||
accompany the operating system. Such a contradiction means you cannot
|
||||
use both them and the Library together in an executable that you
|
||||
distribute.
|
||||
|
||||
7. You may place library facilities that are a work based on the
|
||||
Library side-by-side in a single library together with other library
|
||||
facilities not covered by this License, and distribute such a combined
|
||||
library, provided that the separate distribution of the work based on
|
||||
the Library and of the other library facilities is otherwise
|
||||
permitted, and provided that you do these two things:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work
|
||||
based on the Library, uncombined with any other library
|
||||
facilities. This must be distributed under the terms of the
|
||||
Sections above.
|
||||
|
||||
b) Give prominent notice with the combined library of the fact
|
||||
that part of it is a work based on the Library, and explaining
|
||||
where to find the accompanying uncombined form of the same work.
|
||||
|
||||
8. You may not copy, modify, sublicense, link with, or distribute
|
||||
the Library except as expressly provided under this License. Any
|
||||
attempt otherwise to copy, modify, sublicense, link with, or
|
||||
distribute the Library is void, and will automatically terminate your
|
||||
rights under this License. However, parties who have received copies,
|
||||
or rights, from you under this License will not have their licenses
|
||||
terminated so long as such parties remain in full compliance.
|
||||
|
||||
9. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Library or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Library (or any work based on the
|
||||
Library), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Library or works based on it.
|
||||
|
||||
10. Each time you redistribute the Library (or any work based on the
|
||||
Library), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute, link with or modify the Library
|
||||
subject to these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties with
|
||||
this License.
|
||||
|
||||
11. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Library at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Library by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Library.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply, and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
12. If the distribution and/or use of the Library is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Library under this License
|
||||
may add an explicit geographical distribution limitation excluding those
|
||||
countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
13. The Free Software Foundation may publish revised and/or new
|
||||
versions of the Lesser General Public License from time to time.
|
||||
Such new versions will be similar in spirit to the present version,
|
||||
but may differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Library
|
||||
specifies a version number of this License which applies to it and
|
||||
"any later version", you have the option of following the terms and
|
||||
conditions either of that version or of any later version published by
|
||||
the Free Software Foundation. If the Library does not specify a
|
||||
license version number, you may choose any version ever published by
|
||||
the Free Software Foundation.
|
||||
|
||||
14. If you wish to incorporate parts of the Library into other free
|
||||
programs whose distribution conditions are incompatible with these,
|
||||
write to the author to ask for permission. For software which is
|
||||
copyrighted by the Free Software Foundation, write to the Free
|
||||
Software Foundation; we sometimes make exceptions for this. Our
|
||||
decision will be guided by the two goals of preserving the free status
|
||||
of all derivatives of our free software and of promoting the sharing
|
||||
and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
||||
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
||||
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
||||
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
|
||||
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
|
||||
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
|
||||
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
|
||||
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
|
||||
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
|
||||
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
|
||||
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
|
||||
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
|
||||
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
||||
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||
DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Libraries
|
||||
|
||||
If you develop a new library, and you want it to be of the greatest
|
||||
possible use to the public, we recommend making it free software that
|
||||
everyone can redistribute and change. You can do so by permitting
|
||||
redistribution under these terms (or, alternatively, under the terms
|
||||
of the ordinary General Public License).
|
||||
|
||||
To apply these terms, attach the following notices to the library.
|
||||
It is safest to attach them to the start of each source file to most
|
||||
effectively convey the exclusion of warranty; and each file should
|
||||
have at least the "copyright" line and a pointer to where the full
|
||||
notice is found.
|
||||
|
||||
|
||||
<one line to give the library's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or
|
||||
your school, if any, to sign a "copyright disclaimer" for the library,
|
||||
if necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the
|
||||
library `Frob' (a library for tweaking knobs) written by James
|
||||
Random Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1990
|
||||
Ty Coon, President of Vice
|
||||
|
||||
That's all there is to it!
|
||||
|
||||
|
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.
|
371
README.md
@ -1,6 +1,7 @@
|
||||
# KImageFormats
|
||||
|
||||
Plugins to allow QImage to support extra file formats.
|
||||
Plugins to allow [`QImage`](https://doc.qt.io/qt-6/qimage.html) to support
|
||||
extra file formats.
|
||||
|
||||
## Introduction
|
||||
|
||||
@ -13,36 +14,52 @@ image formats.
|
||||
|
||||
The following image formats have read-only support:
|
||||
|
||||
- Animated Windows cursors (ani)
|
||||
- Camera RAW images (arw, cr2, cr3, dcs, dng, ...)
|
||||
- Gimp (xcf)
|
||||
- OpenEXR (exr)
|
||||
- Photoshop documents (psd)
|
||||
- Sun Raster (ras)
|
||||
- Krita (kra)
|
||||
- OpenRaster (ora)
|
||||
- Pixar raster (pxr)
|
||||
- Portable FloatMap/HalfMap (pfm, phm)
|
||||
- Photoshop documents (psd, psb, pdd, psdt)
|
||||
- Radiance HDR (hdr)
|
||||
- Scitex CT (sct)
|
||||
- Sun Raster (im1, im8, im24, im32, ras, sun)
|
||||
|
||||
The following image formats have read and write support:
|
||||
|
||||
- AV1 Image File Format (avif)
|
||||
- DirectDraw Surface (dds)
|
||||
- Encapsulated PostScript (eps)
|
||||
- High Efficiency Image File Format (heif)
|
||||
- JPEG 2000 (jp2, j2k, jpf)
|
||||
- JPEG XL (jxl)
|
||||
- JPEG XR (jxr)
|
||||
- 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
|
||||
|
||||
See the QImageIOPlugin documentation for information on how to write a
|
||||
new plugin.
|
||||
See the [`QImageIOPlugin`](https://doc.qt.io/qt-6/qimageioplugin.html)
|
||||
documentation for information on how to write a new plugin.
|
||||
|
||||
The main difference between this framework and the qimageformats module
|
||||
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.
|
||||
The main difference between this framework and the image formats of Qt is
|
||||
the license. As such, if you write an image format 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.
|
||||
To be accepted, contributions must:
|
||||
- Contain the test images needed to verify that the changes work correctly
|
||||
- Pass the tests successfully
|
||||
|
||||
## Duplicated Plugins
|
||||
|
||||
### The TGA plugin
|
||||
|
||||
The TGA plugin supports more formats than Qt's own TGA plugin;
|
||||
specifically, the one provided here supports indexed, greyscale and RLE
|
||||
images (types 1-3 and 9-11), while Qt's plugin only supports type 2
|
||||
@ -53,6 +70,18 @@ licensing. If anyone were willing to write fresh code to improve Qt's
|
||||
TGA plugin, it would allow the TGA plugin in this framework to be
|
||||
removed.
|
||||
|
||||
### The DDS plugin
|
||||
|
||||
The DDS plugin is a fork from Qt 5.6 with bug fixes and improvements.
|
||||
|
||||
The plugin was forked because Qt Project no longer supports its DDS plugin.
|
||||
|
||||
### The JP2 plugin
|
||||
|
||||
The JP2 plugin is based on the popular and wide used OpenJPEG library.
|
||||
|
||||
The Qt project has a no longer supported JPEG 2000 plugin based on Jasper.
|
||||
|
||||
## License
|
||||
|
||||
This framework is licensed under the
|
||||
@ -61,3 +90,317 @@ This framework is licensed under the
|
||||
The CMake code in this framework is licensed under the
|
||||
[BSD license](http://opensource.org/licenses/BSD-3-Clause).
|
||||
|
||||
## Plugin status
|
||||
|
||||
The current implementation of a plugin may not be complete or may have
|
||||
limitations of various kinds. Typically the limitations are on maximum size
|
||||
and color depth.
|
||||
|
||||
The various plugins are also limited by the formats natively supported by Qt.
|
||||
For example, native support for CMYK images is only available since Qt 6.8.
|
||||
|
||||
### HDR images
|
||||
|
||||
HDR images are supported via floating point image formats from DDS, EXR, HDR,
|
||||
JXL, JXR, PFM and PSD plugins.
|
||||
It is important to note that in the past these plugins stripped away HDR
|
||||
information, returning SDR images.
|
||||
|
||||
HDR images return R, G and B values outside the range 0.0 - 1.0.
|
||||
While Qt painters handles HDR data correctly, some older programs may display
|
||||
strange artifacts if they do not use a tone mapping operator (or at least a
|
||||
clamp). This is not a plugin issue.
|
||||
|
||||
### Metadata
|
||||
|
||||
Metadata support is available in formats that include it via
|
||||
`QImage::setText()` and `QImage::text()`. To ensure consistent metadata
|
||||
functionality, the following keys have been adopted.
|
||||
|
||||
About the image:
|
||||
- `Altitude`: Floating-point number indicating the GPS altitude in meters
|
||||
above sea level (e.g. 35.4).
|
||||
- `Author`: Person who created the image.
|
||||
- `Comment`: Additional image information in human-readable form, for
|
||||
example a verbal description of the image.
|
||||
- `Copyright`: Copyright notice of the person or organization that claims
|
||||
the copyright to the image.
|
||||
- `CreationDate`: When the image was created or captured. Date and time in
|
||||
ISO 8601 format without milliseconds (e.g. 2024-03-23T15:30:43). This value
|
||||
should be kept unchanged when present.
|
||||
- `Description`: A string that describes the subject of the image.
|
||||
- `Direction`: Floating-point number indicating the direction of the image
|
||||
when it was captured in degrees (e.g. 123.3).
|
||||
- `DocumentName`: The name of the document from which this image was
|
||||
scanned.
|
||||
- `HostComputer`: The computer and/or operating system in use at the time
|
||||
of image creation.
|
||||
- `Latitude`: Floating-point number indicating the latitude in degrees
|
||||
north of the equator (e.g. 27.717).
|
||||
- `Longitude`: Floating-point number indicating the longitude in degrees
|
||||
east of Greenwich (e.g. 85.317).
|
||||
- `ModificationDate`: Last modification date and time in ISO 8601 format
|
||||
without milliseconds (e.g. 2024-03-23T15:30:43). This value should be
|
||||
updated every time the image is saved.
|
||||
- `Owner`: Name of the owner of the image.
|
||||
- `Software`: Name and version number of the software package(s) used to
|
||||
create the image.
|
||||
- `Title`: The title of the image.
|
||||
|
||||
About the camera:
|
||||
- `Manufacturer`: The manufacturer of the recording equipment.
|
||||
- `Model`: The model name or model number of the recording equipment.
|
||||
- `SerialNumber`: The serial number of the recording equipment.
|
||||
|
||||
About the lens:
|
||||
- `LensManufacturer`: The manufacturer of the interchangeable lens that was
|
||||
used.
|
||||
- `LensModel`: The model name or model number of the lens that was used.
|
||||
- `LensSerialNumber`: The serial number of the interchangeable lens that was
|
||||
used.
|
||||
|
||||
Complex metadata (requires a parser):
|
||||
- `XML:org.gimp.xml`: XML metadata generated by GIMP and present only in XCF
|
||||
files.
|
||||
- `XML:com.adobe.xmp`: [Extensible Metadata Platform (XMP)](https://developer.adobe.com/xmp/docs/)
|
||||
is the metadata standard used by Adobe applications and is supported by all
|
||||
common image formats. **Note that XMP metadata is read and written by
|
||||
plugins as is.** Since it may contain information present in other metadata
|
||||
(e.g. `Description`), it is the user's responsibility to ensure consistency
|
||||
between all metadata and XMP metadata when writing an image.
|
||||
|
||||
Supported metadata may vary from one plugin to another. Please note that only
|
||||
the most common metadata are supported and some plugins may return keys not
|
||||
listed here.
|
||||
|
||||
### EXIF Metadata
|
||||
|
||||
[EXIF (Exchangeable Image File Format)](https://en.wikipedia.org/wiki/Exif)
|
||||
metadata is a standard for embedding information within the image file itself.
|
||||
|
||||
Unlike the metadata described above, EXIF metadata is used internally by some
|
||||
plugins to standardize image handling. For example, the JXL plugin uses them
|
||||
to **set/get the image resolution and metadata**. They are also needed to
|
||||
make the image properties appear in the file details of some file managers
|
||||
(e.g. Dolphin).
|
||||
|
||||
When reading, EXIF metadata is converted into simple metadata (e.g.
|
||||
`Description`) and inserted into the image if and only if it is not already
|
||||
present.
|
||||
|
||||
On writing, the image metadata is converted to EXIF and saved appropriately.
|
||||
Note that, if not present in the image to be saved, the following metadata
|
||||
are created automatically:
|
||||
|
||||
- `Software`: Created using `applicationName` and `applicationVersion` methods
|
||||
of [`QCoreApplication`](https://doc.qt.io/qt-6/qcoreapplication.html).
|
||||
- `CreationDate`: Set to current time and date.
|
||||
- `ModificationDate`: Set to current time and date.
|
||||
|
||||
### ICC profile support
|
||||
|
||||
ICC profile support is implemented in all formats that handle them using
|
||||
[`QColorSpace`](https://doc.qt.io/qt-6/qcolorspace.html). When saving, some
|
||||
plugins convert the image using color profiles according to format
|
||||
specifications. In particular, HDR formats almost always convert to linear
|
||||
RGB.
|
||||
|
||||
### Maximum image size
|
||||
|
||||
Where possible, plugins support large images. By convention, many of the
|
||||
large image plugins are limited to a maximum of 300,000 x 300,000 pixels.
|
||||
Anyway, all plugins are also limited by the
|
||||
`QImageIOReader::allocationLimit()`. Below are the maximum sizes for each
|
||||
plugin ('n/a' means no limit, i.e. the limit depends on the format encoding).
|
||||
|
||||
- ANI: n/a
|
||||
- AVIF: 32,768 x 32,768 pixels, in any case no larger than 256 megapixels
|
||||
- DDS: n/a
|
||||
- EXR: 300,000 x 300,000 pixels
|
||||
- EPS: n/a
|
||||
- HDR: n/a (large image)
|
||||
- HEIF: n/a
|
||||
- JP2: 300,000 x 300,000 pixels, in any case no larger than 2 gigapixels
|
||||
- JXL: 262,144 x 262,144 pixels, in any case no larger than 256 megapixels
|
||||
- JXR: n/a, in any case no larger than 4 GB
|
||||
- KRA: same size as Qt's PNG plugin
|
||||
- ORA: same size as Qt's PNG plugin
|
||||
- PCX: 65,535 x 65,535 pixels
|
||||
- PFM: n/a (large image)
|
||||
- PIC: 65,535 x 65,535 pixels
|
||||
- PSD: 300,000 x 300,000 pixels
|
||||
- PXR: 65,535 x 65,535 pixels
|
||||
- QOI: 300,000 x 300,000 pixels
|
||||
- RAS: n/a (large image)
|
||||
- RAW: n/a (depends on the RAW format loaded)
|
||||
- RGB: 65,535 x 65,535 pixels
|
||||
- SCT: 300,000 x 300,000 pixels
|
||||
- TGA: 65,535 x 65,535 pixels
|
||||
- XCF: 300,000 x 300,000 pixels
|
||||
|
||||
### Sequential and random access devices
|
||||
|
||||
All plugins work fine on random access devices while only some work on
|
||||
sequential access devices.
|
||||
Some plugins, such as PSD, allow reading RGB images on sequential access
|
||||
devices, but cannot do the same for Lab files.
|
||||
|
||||
**Important: some plugins use `QIODevice` transactions and/or
|
||||
`QIODevice::ungetChar()`. Therefore, the device used to read the image must not
|
||||
have any active transactions.**
|
||||
|
||||
### Memory usage
|
||||
|
||||
Qt has added many image formats over time. In older plugins, to support new
|
||||
formats, `QImage` conversion functions have been used, causing memory
|
||||
consumption proportional to the size of the image to be saved.
|
||||
Normally this is not a source of problems because the affected plugins
|
||||
are limited to maximum images of 2GiB or less.
|
||||
|
||||
On plugins for formats that support large images, progressive conversion has
|
||||
been used or the maximum size of the image that can be saved has been limited.
|
||||
|
||||
### Non-RGB formats
|
||||
|
||||
PSD plugin loads CMYK, Lab and Multichannel images and converts them to RGB
|
||||
without using the ICC profile.
|
||||
|
||||
JP2, JXL, JXR, PSD and SCT plugins natively support 4-channel CMYK images when
|
||||
compiled with Qt 6.8+.
|
||||
|
||||
### The DDS plugin
|
||||
|
||||
**This plugin can be disabled by setting `KIMAGEFORMATS_DDS` to `OFF`
|
||||
in your cmake options.**
|
||||
|
||||
The following defines can be defined in cmake to modify the behavior of the
|
||||
plugin:
|
||||
- `DDS_DISABLE_STRIDE_ALIGNMENT`: disable the stride aligment based on DDS
|
||||
pitch: it is known that some writers do not set it correctly.
|
||||
|
||||
### The HEIF plugin
|
||||
|
||||
**This plugin is disabled by default. It can be enabled by settings
|
||||
`KIMAGEFORMATS_HEIF` to `ON` in your cmake options.**
|
||||
|
||||
The plugin is disabled due to issues with the heif library on certain
|
||||
distributions. In particular, it is necessary that the HEIF library has
|
||||
support for HEVC codec. If HEVC codec is not available the plugin
|
||||
will compile but will fail the tests.
|
||||
|
||||
### The EXR plugin
|
||||
|
||||
The following defines can be defined in cmake to modify the behavior of the
|
||||
plugin:
|
||||
- `EXR_CONVERT_TO_SRGB`: the linear data is converted to sRGB on read to
|
||||
accommodate programs that do not support color profiles.
|
||||
- `EXR_DISABLE_XMP_ATTRIBUTE`: disables the stores XMP values in a non-standard
|
||||
attribute named "xmp". Note that Gimp reads the "xmp" attribute and Darktable
|
||||
writes it as well.
|
||||
|
||||
### The EPS plugin
|
||||
|
||||
The plugin uses `Ghostscript` to convert the raster image. When reading it
|
||||
converts the EPS to PPM and uses the Qt PPM plugin to read the image.
|
||||
When writing it uses [`QPrinter`](https://doc.qt.io/qt-6/qprinter.html) to
|
||||
create a temporary PDF file which is then converted to EPS. Therefore, if
|
||||
`Ghostscript` is not installed, the plugin will not work.
|
||||
|
||||
### The HDR plugin
|
||||
|
||||
The following defines can be defined in cmake to modify the behavior of the
|
||||
plugin:
|
||||
- `HDR_HALF_QUALITY`: on read, a 16-bit float image is returned instead of a
|
||||
32-bit float one.
|
||||
|
||||
### The JP2 plugin
|
||||
|
||||
**This plugin can be disabled by setting `KIMAGEFORMATS_JP2` to `OFF`
|
||||
in your cmake options.**
|
||||
|
||||
JP2 plugin has the following limitations due to the lack of support by OpenJPEG:
|
||||
- Metadata are not supported.
|
||||
- Image resolution is not supported.
|
||||
- To write ICC profiles you need OpenJPEG V2.5.4 or higher
|
||||
|
||||
### The JXL plugin
|
||||
|
||||
**The current version of the plugin limits the image size to 256 megapixels
|
||||
according to feature level 5 of the JXL stream encoding.**
|
||||
|
||||
The following defines can be defined in cmake to modify the behavior of the
|
||||
plugin:
|
||||
- `JXL_HDR_PRESERVATION_DISABLED`: disable floating point images (both read
|
||||
and write) by converting them to UINT16 images. Any HDR data is lost. Note
|
||||
that FP images are always disabled when compiling with libJXL less than v0.9.
|
||||
- `JXL_DECODE_BOXES_DISABLED`: disable reading of metadata (e.g. XMP).
|
||||
|
||||
### The JXR plugin
|
||||
|
||||
**This plugin is disabled by default. It can be enabled by settings
|
||||
`KIMAGEFORMATS_JXR` to `ON` in your cmake options.**
|
||||
|
||||
The following defines can be defined in cmake to modify the behavior of the
|
||||
plugin:
|
||||
- `JXR_DENY_FLOAT_IMAGE`: disables the use of float images and consequently
|
||||
any HDR data will be lost.
|
||||
- `JXR_DISABLE_DEPTH_CONVERSION`: remove the neeeds of additional memory by
|
||||
disabling the conversion between different color depths (e.g. RGBA64bpp to
|
||||
RGBA32bpp) at the cost of reduced compatibility.
|
||||
- `JXR_DISABLE_BGRA_HACK`: Windows displays and opens JXR files correctly out
|
||||
of the box. Unfortunately it doesn't seem to open (P)RGBA @32bpp files as
|
||||
it only wants (P)BGRA32bpp files (a format not supported by Qt). Only for
|
||||
this format an hack is activated to guarantee total compatibility of the
|
||||
plugin with Windows.
|
||||
- `JXR_ENABLE_ADVANCED_METADATA`: enable metadata support (e.g. XMP). Some
|
||||
distributions use an incomplete JXR library that does not allow reading
|
||||
metadata, causing compilation errors.
|
||||
|
||||
### The KRA plugin
|
||||
|
||||
The KRA format is a ZIP archive containing image data. In particular, the
|
||||
rendered image in PNG format is saved in the root: the plugin reads this
|
||||
image.
|
||||
|
||||
### The ORA plugin
|
||||
|
||||
The ORA format is a ZIP archive containing image data. In particular, the
|
||||
rendered image in PNG format is saved in the root: the plugin reads this
|
||||
image.
|
||||
|
||||
### The PSD plugin
|
||||
|
||||
PSD support has the following limitations:
|
||||
- Only images saved by Photoshop using compatibility mode enabled (Photoshop
|
||||
default) can be decoded.
|
||||
- Multichannel images are treated as CMYK if they have 2 or more channels.
|
||||
- Multichannel images are treated as Grayscale if they have 1 channel.
|
||||
- Duotone images are treated as grayscale images.
|
||||
- Extra channels other than alpha are discarded.
|
||||
|
||||
The following defines can be defined in cmake to modify the behavior of the
|
||||
plugin:
|
||||
- `PSD_FAST_LAB_CONVERSION`: the LAB image is converted to linear sRGB instead
|
||||
of sRGB which significantly increases performance.
|
||||
- `PSD_NATIVE_CMYK_SUPPORT_DISABLED`: disable native support for CMYK images
|
||||
when compiled with Qt 6.8+
|
||||
|
||||
### The RAW plugin
|
||||
|
||||
Loading RAW images always requires a conversion. To allow the user to
|
||||
choose how to convert the image, it was chosen to use the quality parameter
|
||||
to act on the converter. The quality parameter can be used with values from
|
||||
0 to 100 (0 = fast, 100 = maximum quality) or by setting flags to
|
||||
selectively change the conversion (see also [raw_p.h](./src/imageformats/raw_p.h)).
|
||||
|
||||
The default setting tries to balance quality and conversion speed.
|
||||
|
||||
### The XCF plugin
|
||||
|
||||
XCF support has the following limitations:
|
||||
- XCF format up to [version 12](https://testing.developer.gimp.org/core/standards/xcf/#version-history)
|
||||
(no support for GIMP 3).
|
||||
- The returned image is always 8-bit.
|
||||
- Cannot read zlib compressed files.
|
||||
- The rendered image may be slightly different (colors/transparencies) than
|
||||
in GIMP.
|
||||
|
@ -1,7 +1,4 @@
|
||||
#find_package(Qt5Test ${REQUIRED_QT_VERSION} NO_MODULE)
|
||||
|
||||
include(ECMMarkAsTest)
|
||||
include(CMakeParseArguments)
|
||||
|
||||
add_definitions(-DPLUGIN_DIR="${CMAKE_CURRENT_BINARY_DIR}/../bin")
|
||||
remove_definitions(-DQT_NO_CAST_FROM_ASCII)
|
||||
@ -14,39 +11,63 @@ macro(kimageformats_read_tests)
|
||||
endif()
|
||||
|
||||
if (NOT TARGET readtest)
|
||||
add_executable(readtest readtest.cpp)
|
||||
target_link_libraries(readtest Qt5::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)
|
||||
endif()
|
||||
|
||||
foreach(_testname ${KIF_RT_UNPARSED_ARGUMENTS})
|
||||
string(REGEX MATCH "-skipoptional" _is_skip_optional "${_testname}")
|
||||
unset(skip_optional_arg)
|
||||
if (_is_skip_optional)
|
||||
set(skip_optional_arg "--skip-optional-tests")
|
||||
string(REGEX REPLACE "-skipoptional$" "" _testname "${_testname}")
|
||||
endif()
|
||||
add_test(
|
||||
NAME kimageformats-read-${_testname}
|
||||
COMMAND readtest ${_fuzzarg} ${_testname}
|
||||
COMMAND readtest ${skip_optional_arg} ${_fuzzarg} ${_testname}
|
||||
)
|
||||
endforeach(_testname)
|
||||
endmacro()
|
||||
|
||||
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)
|
||||
add_executable(writetest writetest.cpp)
|
||||
target_link_libraries(writetest Qt5::Gui)
|
||||
target_link_libraries(writetest Qt6::Gui)
|
||||
target_compile_definitions(writetest
|
||||
PRIVATE IMAGEDIR="${CMAKE_CURRENT_SOURCE_DIR}/write")
|
||||
ecm_mark_as_test(writetest)
|
||||
endif()
|
||||
foreach(_testname ${ARGN})
|
||||
foreach(_testname ${KIF_RT_UNPARSED_ARGUMENTS})
|
||||
string(REGEX MATCH "-lossless$" _is_lossless "${_testname}")
|
||||
string(REGEX MATCH "-nodatacheck" _is_no_data_check "${_testname}")
|
||||
string(REGEX MATCH "-skipoptional" _is_skip_optional "${_testname}")
|
||||
unset(skip_optional_arg)
|
||||
unset(lossless_arg)
|
||||
unset(no_data_check_arg)
|
||||
if (_is_lossless)
|
||||
set(lossless_arg "--lossless")
|
||||
string(REGEX REPLACE "-lossless$" "" _testname "${_testname}")
|
||||
endif()
|
||||
if (_is_no_data_check)
|
||||
set(no_data_check_arg "--no-data-check")
|
||||
string(REGEX REPLACE "-nodatacheck$" "" _testname "${_testname}")
|
||||
endif()
|
||||
if (_is_skip_optional)
|
||||
set(skip_optional_arg "--skip-optional-tests")
|
||||
string(REGEX REPLACE "-skipoptional$" "" _testname "${_testname}")
|
||||
endif()
|
||||
add_test(
|
||||
NAME kimageformats-write-${_testname}
|
||||
COMMAND writetest ${lossless_arg} ${_testname}
|
||||
COMMAND writetest ${lossless_arg} ${no_data_check_arg} ${skip_optional_arg} ${_fuzzarg} ${_testname}
|
||||
)
|
||||
endforeach(_testname)
|
||||
endmacro()
|
||||
@ -57,22 +78,102 @@ endmacro()
|
||||
kimageformats_read_tests(
|
||||
hdr
|
||||
pcx
|
||||
pfm
|
||||
psd
|
||||
pxr
|
||||
qoi
|
||||
ras
|
||||
rgb
|
||||
sct
|
||||
tga
|
||||
)
|
||||
|
||||
if (KF5Archive_FOUND)
|
||||
if(KIMAGEFORMATS_DDS)
|
||||
kimageformats_read_tests(dds)
|
||||
kimageformats_write_tests(dds-nodatacheck-lossless)
|
||||
endif()
|
||||
|
||||
if (KF6Archive_FOUND)
|
||||
kimageformats_read_tests(
|
||||
kra
|
||||
ora
|
||||
)
|
||||
endif()
|
||||
|
||||
# Allow some fuzziness when reading this formats, to allow for
|
||||
# rounding errors (eg: in alpha blending).
|
||||
kimageformats_read_tests(FUZZ 1
|
||||
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
|
||||
)
|
||||
kimageformats_write_tests(FUZZ 1
|
||||
hej2-nodatacheck-lossless
|
||||
)
|
||||
endif()
|
||||
|
||||
if (LibHeif_VERSION VERSION_GREATER_EQUAL "1.19.6")
|
||||
kimageformats_read_tests(FUZZ 4
|
||||
avci
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (OpenJPEG_FOUND)
|
||||
kimageformats_read_tests(
|
||||
jp2
|
||||
)
|
||||
# CMYK writing is incorrect in versions before 2.5.3
|
||||
if ("${OPENJPEG_MAJOR_VERSION}.${OPENJPEG_MINOR_VERSION}.${OPENJPEG_BUILD_VERSION}" VERSION_GREATER_EQUAL "2.5.3")
|
||||
kimageformats_write_tests(
|
||||
jp2-nodatacheck-lossless
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (LibJXL_FOUND AND LibJXLThreads_FOUND)
|
||||
if(LibJXL_VERSION VERSION_GREATER_EQUAL "0.11.0")
|
||||
kimageformats_read_tests(
|
||||
jxl
|
||||
)
|
||||
kimageformats_write_tests(
|
||||
jxl-nodatacheck-lossless
|
||||
)
|
||||
else()
|
||||
kimageformats_read_tests(
|
||||
jxl-skipoptional
|
||||
)
|
||||
kimageformats_write_tests(
|
||||
jxl-skipoptional-nodatacheck-lossless
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (LibJXR_FOUND)
|
||||
kimageformats_read_tests(
|
||||
jxr
|
||||
)
|
||||
kimageformats_write_tests(
|
||||
jxr-nodatacheck
|
||||
)
|
||||
endif()
|
||||
|
||||
kimageformats_read_tests(
|
||||
xcf
|
||||
)
|
||||
|
||||
@ -83,8 +184,9 @@ kimageformats_read_tests(FUZZ 1
|
||||
# You can append -lossless to the format to indicate that
|
||||
# reading back the image data will result in an identical image.
|
||||
kimageformats_write_tests(
|
||||
pcx-lossless
|
||||
pcx-nodatacheck
|
||||
pic-lossless
|
||||
qoi-lossless
|
||||
rgb-lossless
|
||||
tga # fixme: the alpha images appear not to be written properly
|
||||
)
|
||||
@ -96,17 +198,35 @@ kimageformats_write_tests(
|
||||
# kimageformats_write_tests(eps)
|
||||
#endif()
|
||||
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 6
|
||||
exr-nodatacheck-lossless
|
||||
)
|
||||
endif()
|
||||
|
||||
find_package(Qt5Test ${REQUIRED_QT_VERSION} CONFIG QUIET)
|
||||
if (LibRaw_FOUND)
|
||||
kimageformats_read_tests(
|
||||
raw
|
||||
)
|
||||
endif()
|
||||
|
||||
if(NOT Qt5Test_FOUND)
|
||||
message(STATUS "Qt5Test not found, some autotests will not be built.")
|
||||
find_package(Qt6Test ${REQUIRED_QT_VERSION} CONFIG QUIET)
|
||||
|
||||
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 Qt5::Gui Qt5::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 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"
|
69
autotests/fuzzyeq.cpp
Normal file
@ -0,0 +1,69 @@
|
||||
/*
|
||||
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
|
||||
*/
|
||||
|
||||
#include <QImage>
|
||||
#include <QRgb>
|
||||
#include <QRgba64>
|
||||
|
||||
inline int iAbs(const int &v)
|
||||
{
|
||||
return v < 0 ? -v : v;
|
||||
}
|
||||
|
||||
template<class Trait>
|
||||
static bool fuzzyeq(const QImage &im1, const QImage &im2, int fuzziness, bool perceptiveFuzzer)
|
||||
{
|
||||
Q_ASSERT(im1.format() == im2.format());
|
||||
Q_ASSERT(im1.depth() == 24 || im1.depth() == 32 || im1.depth() == 64);
|
||||
|
||||
const bool hasAlpha = im1.hasAlphaChannel();
|
||||
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) {
|
||||
auto &&px1 = line1[j];
|
||||
auto &&px2 = line2[j];
|
||||
auto fuzz = int(fuzziness);
|
||||
|
||||
// Calculate the deltas
|
||||
auto dr = iAbs(int(qRed(px2)) - int(qRed(px1)));
|
||||
auto dg = iAbs(int(qGreen(px2)) - int(qGreen(px1)));
|
||||
auto db = iAbs(int(qBlue(px2)) - int(qBlue(px1)));
|
||||
auto da = iAbs(int(qAlpha(px2)) - int(qAlpha(px1)));
|
||||
|
||||
// Always compare alpha even on images without it: some formats (e.g. RGBX64),
|
||||
// want it set to a certain value (e.g. 65535).
|
||||
if (da > fuzz)
|
||||
return false;
|
||||
|
||||
// Calculate the perceptive fuzziness.
|
||||
if (hasAlpha && perceptiveFuzzer) {
|
||||
auto alpha = std::max(4, int(qAlpha(px1)));
|
||||
if (sizeof(Trait) == 4)
|
||||
fuzz = std::min(fuzz * (255 / alpha), 255);
|
||||
else
|
||||
fuzz = std::min(fuzz * (65535 / alpha), 255 * 257);
|
||||
}
|
||||
|
||||
// Compare the deltas of R, G, B components.
|
||||
if (dr > fuzz)
|
||||
return false;
|
||||
if (dg > fuzz)
|
||||
return false;
|
||||
if (db > fuzz)
|
||||
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, bool perceptiveFuzzer = false)
|
||||
{
|
||||
return (im1.depth() == 64) ? fuzzyeq<QRgba64>(im1, im2, int(fuzziness) * 257, perceptiveFuzzer) : fuzzyeq<QRgb>(im1, im2, int(fuzziness), perceptiveFuzzer);
|
||||
}
|
@ -35,61 +35,27 @@ private:
|
||||
QTest::addColumn<QImage::Format>("pngformat");
|
||||
QTest::addColumn<bool>("compress");
|
||||
|
||||
QTest::newRow("4x4 no alpha RLE")
|
||||
<< QFINDTESTDATA("pic/4x4-simple-color.pic")
|
||||
<< QFINDTESTDATA("pic/4x4-simple-color.png")
|
||||
<< QString()
|
||||
<< false
|
||||
<< QImage::Format_RGB32
|
||||
<< true;
|
||||
QTest::newRow("4x4 no alpha RLE") << QFINDTESTDATA("pic/4x4-simple-color.pic") << QFINDTESTDATA("pic/4x4-simple-color.png") << QString() << false
|
||||
<< QImage::Format_RGB32 << true;
|
||||
|
||||
QTest::newRow("4x4 no alpha raw")
|
||||
<< QFINDTESTDATA("pic/4x4-simple-color-uncompressed.pic")
|
||||
<< QFINDTESTDATA("pic/4x4-simple-color.png")
|
||||
<< QString()
|
||||
<< false
|
||||
<< QImage::Format_RGB32
|
||||
<< false;
|
||||
QTest::newRow("4x4 no alpha raw") << QFINDTESTDATA("pic/4x4-simple-color-uncompressed.pic") << QFINDTESTDATA("pic/4x4-simple-color.png") << QString()
|
||||
<< false << QImage::Format_RGB32 << false;
|
||||
|
||||
QTest::newRow("Short comment")
|
||||
<< QFINDTESTDATA("pic/short-comment.pic")
|
||||
<< QFINDTESTDATA("pic/4x4-simple-color.png")
|
||||
<< QStringLiteral("Test comment value")
|
||||
<< false
|
||||
<< QImage::Format_RGB32
|
||||
<< true;
|
||||
QTest::newRow("Short comment") << QFINDTESTDATA("pic/short-comment.pic") << QFINDTESTDATA("pic/4x4-simple-color.png")
|
||||
<< QStringLiteral("Test comment value") << false << QImage::Format_RGB32 << true;
|
||||
|
||||
QTest::newRow("Long comment")
|
||||
<< QFINDTESTDATA("pic/long-comment.pic")
|
||||
<< QFINDTESTDATA("pic/4x4-simple-color.png")
|
||||
<< 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 comment") << QFINDTESTDATA("pic/long-comment.pic") << QFINDTESTDATA("pic/4x4-simple-color.png")
|
||||
<< 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")
|
||||
<< QFINDTESTDATA("pic/long-runs.pic")
|
||||
<< QFINDTESTDATA("pic/long-runs.png")
|
||||
<< QString()
|
||||
<< false
|
||||
<< QImage::Format_RGB32
|
||||
<< true;
|
||||
QTest::newRow("Long run-lengths") << QFINDTESTDATA("pic/long-runs.pic") << QFINDTESTDATA("pic/long-runs.png") << QString() << false
|
||||
<< QImage::Format_RGB32 << true;
|
||||
|
||||
QTest::newRow("4x4 with alpha RLE")
|
||||
<< QFINDTESTDATA("pic/4x4-alpha.pic")
|
||||
<< QFINDTESTDATA("pic/4x4-alpha.png")
|
||||
<< QString()
|
||||
<< true
|
||||
<< QImage::Format_ARGB32
|
||||
<< true;
|
||||
QTest::newRow("4x4 with alpha RLE") << QFINDTESTDATA("pic/4x4-alpha.pic") << QFINDTESTDATA("pic/4x4-alpha.png") << QString() << true
|
||||
<< QImage::Format_ARGB32 << true;
|
||||
|
||||
QTest::newRow("4x4 with alpha raw")
|
||||
<< QFINDTESTDATA("pic/4x4-alpha-uncompressed.pic")
|
||||
<< QFINDTESTDATA("pic/4x4-alpha.png")
|
||||
<< QString()
|
||||
<< true
|
||||
<< QImage::Format_ARGB32
|
||||
<< false;
|
||||
QTest::newRow("4x4 with alpha raw") << QFINDTESTDATA("pic/4x4-alpha-uncompressed.pic") << QFINDTESTDATA("pic/4x4-alpha.png") << QString() << true
|
||||
<< QImage::Format_ARGB32 << false;
|
||||
}
|
||||
|
||||
private Q_SLOTS:
|
||||
@ -106,13 +72,8 @@ private Q_SLOTS:
|
||||
// so there is no actual data loss in converting to RGB16.
|
||||
// This just tests that the pic plugin can deal with different
|
||||
// input formats.
|
||||
QTest::newRow("altered format")
|
||||
<< QFINDTESTDATA("pic/4x4-simple-color.pic")
|
||||
<< QFINDTESTDATA("pic/4x4-simple-color.png")
|
||||
<< QString()
|
||||
<< false
|
||||
<< QImage::Format_RGB16
|
||||
<< true;
|
||||
QTest::newRow("altered format") << QFINDTESTDATA("pic/4x4-simple-color.pic") << QFINDTESTDATA("pic/4x4-simple-color.png") << QString() << false
|
||||
<< QImage::Format_RGB16 << true;
|
||||
}
|
||||
|
||||
void testRead_data()
|
||||
@ -148,17 +109,12 @@ private Q_SLOTS:
|
||||
imgWriter.write(pngImage);
|
||||
|
||||
if (expData != picData) {
|
||||
QString fileNameBase = QUuid::createUuid().toString()
|
||||
.remove(QLatin1Char('{'))
|
||||
.remove(QLatin1Char('}'));
|
||||
QString fileNameBase = QUuid::createUuid().toString().remove(QLatin1Char('{')).remove(QLatin1Char('}'));
|
||||
QFile dumpFile(fileNameBase + QStringLiteral(".pic"));
|
||||
QVERIFY2(dumpFile.open(QIODevice::WriteOnly), qPrintable(dumpFile.errorString()));
|
||||
dumpFile.write(picData);
|
||||
QString msg = QStringLiteral("Written data (")
|
||||
+ dumpFile.fileName()
|
||||
+ QStringLiteral(") differed from expected data (")
|
||||
+ picfile
|
||||
+ QLatin1Char(')');
|
||||
QString msg =
|
||||
QStringLiteral("Written data (") + dumpFile.fileName() + QStringLiteral(") differed from expected data (") + picfile + QLatin1Char(')');
|
||||
QFAIL(qPrintable(msg));
|
||||
}
|
||||
}
|
||||
@ -182,29 +138,20 @@ private Q_SLOTS:
|
||||
QCOMPARE(inputImage.width(), expImage.width());
|
||||
QCOMPARE(inputImage.height(), expImage.height());
|
||||
QCOMPARE(inputImage.hasAlphaChannel(), alpha);
|
||||
QCOMPARE(inputImage.format(), alpha ? QImage::Format_ARGB32
|
||||
: QImage::Format_RGB32);
|
||||
QCOMPARE(inputImage.format(), alpha ? QImage::Format_ARGB32 : QImage::Format_RGB32);
|
||||
|
||||
expImage = expImage.convertToFormat(pngformat);
|
||||
expImage = expImage.convertToFormat(alpha ? QImage::Format_ARGB32
|
||||
: QImage::Format_RGB32);
|
||||
expImage = expImage.convertToFormat(alpha ? QImage::Format_ARGB32 : QImage::Format_RGB32);
|
||||
if (inputImage != expImage) {
|
||||
QString fileNameBase = QUuid::createUuid().toString()
|
||||
.remove(QLatin1Char('{'))
|
||||
.remove(QLatin1Char('}'));
|
||||
QString fileNameBase = QUuid::createUuid().toString().remove(QLatin1Char('{')).remove(QLatin1Char('}'));
|
||||
QFile picDumpFile(fileNameBase + QStringLiteral("-expected.data"));
|
||||
QVERIFY2(picDumpFile.open(QIODevice::WriteOnly), qPrintable(picDumpFile.errorString()));
|
||||
picDumpFile.write(reinterpret_cast<const char *>(inputImage.bits()),
|
||||
inputImage.sizeInBytes());
|
||||
picDumpFile.write(reinterpret_cast<const char *>(inputImage.bits()), inputImage.sizeInBytes());
|
||||
QFile pngDumpFile(fileNameBase + QStringLiteral("-actual.data"));
|
||||
QVERIFY2(pngDumpFile.open(QIODevice::WriteOnly), qPrintable(pngDumpFile.errorString()));
|
||||
pngDumpFile.write(reinterpret_cast<const char *>(expImage.bits()),
|
||||
expImage.sizeInBytes());
|
||||
QString msg = QStringLiteral("Read image (")
|
||||
+ picDumpFile.fileName()
|
||||
+ QStringLiteral(") differed from expected image (")
|
||||
+ pngDumpFile.fileName()
|
||||
+ QLatin1Char(')');
|
||||
pngDumpFile.write(reinterpret_cast<const char *>(expImage.bits()), expImage.sizeInBytes());
|
||||
QString msg = QStringLiteral("Read image (") + picDumpFile.fileName() + QStringLiteral(") differed from expected image (") + pngDumpFile.fileName()
|
||||
+ QLatin1Char(')');
|
||||
QFAIL(qPrintable(msg));
|
||||
}
|
||||
}
|
||||
@ -252,8 +199,7 @@ private Q_SLOTS:
|
||||
|
||||
QImageReader inputReader(picfile, "pic");
|
||||
|
||||
QCOMPARE(inputReader.imageFormat(),
|
||||
alpha ? QImage::Format_ARGB32 : QImage::Format_RGB32);
|
||||
QCOMPARE(inputReader.imageFormat(), alpha ? QImage::Format_ARGB32 : QImage::Format_RGB32);
|
||||
}
|
||||
};
|
||||
|
||||
|
BIN
autotests/read/avci/eco_kde_gray.avci
Normal file
BIN
autotests/read/avci/eco_kde_gray.png
Normal file
After Width: | Height: | Size: 250 KiB |
BIN
autotests/read/avif/bw.avif
Normal file
After Width: | Height: | Size: 629 B |
Before Width: | Height: | Size: 743 B After Width: | Height: | Size: 743 B |
BIN
autotests/read/avif/bwa.avif
Normal file
After Width: | Height: | Size: 823 B |
Before Width: | Height: | Size: 574 B After Width: | Height: | Size: 574 B |
BIN
autotests/read/avif/metadata.avif
Normal file
After Width: | Height: | Size: 18 KiB |
59
autotests/read/avif/metadata.avif.json
Normal file
@ -0,0 +1,59 @@
|
||||
[
|
||||
{
|
||||
"fileName" : "metadata.png",
|
||||
"metadata" : [
|
||||
{
|
||||
"key" : "ModificationDate",
|
||||
"value" : "2025-02-19T08:27:22+01:00"
|
||||
},
|
||||
{
|
||||
"key" : "Software" ,
|
||||
"value" : "GIMP 3.0.0-RC3"
|
||||
},
|
||||
{
|
||||
"key" : "Altitude",
|
||||
"value" : "34"
|
||||
},
|
||||
{
|
||||
"key" : "Author",
|
||||
"value" : "KDE Project"
|
||||
},
|
||||
{
|
||||
"key" : "Copyright",
|
||||
"value" : "@2025 KDE Project"
|
||||
},
|
||||
{
|
||||
"key" : "Description",
|
||||
"value" : "TV broadcast test image."
|
||||
},
|
||||
{
|
||||
"key" : "Latitude",
|
||||
"value" : "44.6478"
|
||||
},
|
||||
{
|
||||
"key" : "LensManufacturer",
|
||||
"value" : "KDE Glasses"
|
||||
},
|
||||
{
|
||||
"key" : "LensModel",
|
||||
"value" : "A1234"
|
||||
},
|
||||
{
|
||||
"key" : "Longitude",
|
||||
"value" : "10.9254"
|
||||
},
|
||||
{
|
||||
"key" : "Manufacturer",
|
||||
"value" : "KFramework"
|
||||
},
|
||||
{
|
||||
"key" : "Model",
|
||||
"value" : "KImageFormats"
|
||||
}
|
||||
],
|
||||
"resolution" : {
|
||||
"dotsPerMeterX" : 11811,
|
||||
"dotsPerMeterY" : 5905
|
||||
}
|
||||
}
|
||||
]
|
BIN
autotests/read/avif/metadata.png
Normal file
After Width: | Height: | Size: 24 KiB |
BIN
autotests/read/avif/rgb.avif
Normal file
After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
BIN
autotests/read/avif/rgba.avif
Normal file
After Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 1.2 KiB 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/dds/earth-cubemap.dds
Normal file
2
autotests/read/dds/earth-cubemap.license
Normal file
@ -0,0 +1,2 @@
|
||||
SPDX-FileCopyrightText: Copyright (c) 2006 - 2010 The Open Toolkit library.
|
||||
SPDX-License-Identifier: MIT
|
BIN
autotests/read/dds/earth-cubemap.png
Normal file
After Width: | Height: | Size: 956 KiB |
BIN
autotests/read/dds/gray8.dds
Normal file
BIN
autotests/read/dds/gray8.png
Normal file
After Width: | Height: | Size: 2.1 KiB |
BIN
autotests/read/dds/indexed.dds
Normal file
BIN
autotests/read/dds/indexed.png
Normal file
After Width: | Height: | Size: 3.1 KiB |
BIN
autotests/read/dds/r16.dds
Normal file
BIN
autotests/read/dds/r16.png
Normal file
After Width: | Height: | Size: 2.2 KiB |
BIN
autotests/read/dds/r16dx10.dds
Normal file
BIN
autotests/read/dds/r16dx10.png
Normal file
After Width: | Height: | Size: 2.2 KiB |
BIN
autotests/read/dds/r32.dds
Normal file
BIN
autotests/read/dds/r32.png
Normal file
After Width: | Height: | Size: 2.2 KiB |
BIN
autotests/read/dds/r32dx10.dds
Normal file
BIN
autotests/read/dds/r32dx10.png
Normal file
After Width: | Height: | Size: 2.2 KiB |
BIN
autotests/read/dds/rg16.dds
Normal file
BIN
autotests/read/dds/rg16.png
Normal file
After Width: | Height: | Size: 2.6 KiB |
BIN
autotests/read/dds/rg16dx10.dds
Normal file
BIN
autotests/read/dds/rg16dx10.png
Normal file
After Width: | Height: | Size: 2.6 KiB |
BIN
autotests/read/dds/rg32.dds
Normal file
BIN
autotests/read/dds/rg32.png
Normal file
After Width: | Height: | Size: 2.6 KiB |
BIN
autotests/read/dds/rg32dx10.dds
Normal file
BIN
autotests/read/dds/rg32dx10.png
Normal file
After Width: | Height: | Size: 2.6 KiB |
BIN
autotests/read/dds/rgba.dds
Normal file
BIN
autotests/read/dds/rgba.png
Normal file
After Width: | Height: | Size: 4.7 KiB |
BIN
autotests/read/dds/rgba102.dds
Normal file
BIN
autotests/read/dds/rgba102.png
Normal file
After Width: | Height: | Size: 4.3 KiB |
BIN
autotests/read/dds/rgba16dx10.dds
Normal file
7
autotests/read/dds/rgba16dx10.dds.json
Normal file
@ -0,0 +1,7 @@
|
||||
[
|
||||
{
|
||||
"fileName" : "rgba16dx10.png",
|
||||
"fuzziness" : 1,
|
||||
"description" : "Minimum fuzziness value to pass the test on all architectures."
|
||||
}
|
||||
]
|
BIN
autotests/read/dds/rgba16dx10.png
Normal file
After Width: | Height: | Size: 4.3 KiB |
BIN
autotests/read/dds/rgba32dx10.dds
Normal file
BIN
autotests/read/dds/rgba32dx10.png
Normal file
After Width: | Height: | Size: 4.3 KiB |
BIN
autotests/read/dds/rgba4.dds
Normal file
BIN
autotests/read/dds/rgba4.png
Normal file
After Width: | Height: | Size: 3.1 KiB |
BIN
autotests/read/dds/rgba5551.dds
Normal file
BIN
autotests/read/dds/rgba5551.png
Normal file
After Width: | Height: | Size: 3.3 KiB |
BIN
autotests/read/dds/rgba_abgr.dds
Normal file
BIN
autotests/read/dds/rgba_abgr.png
Normal file
After Width: | Height: | Size: 4.7 KiB |
BIN
autotests/read/dds/rgba_bc1.dds
Normal file
BIN
autotests/read/dds/rgba_bc1.png
Normal file
After Width: | Height: | Size: 4.6 KiB |
BIN
autotests/read/dds/rgba_bc2.dds
Normal file
BIN
autotests/read/dds/rgba_bc2.png
Normal file
After Width: | Height: | Size: 5.2 KiB |
BIN
autotests/read/dds/rgba_bc3.dds
Normal file
BIN
autotests/read/dds/rgba_bc3.png
Normal file
After Width: | Height: | Size: 5.3 KiB |