mirror of
https://invent.kde.org/frameworks/kimageformats.git
synced 2025-07-14 19:04:17 -04:00
Compare commits
28 Commits
Author | SHA1 | Date | |
---|---|---|---|
e3afec9e75 | |||
b040cf0f96 | |||
7be2757c36 | |||
a8562a8471 | |||
252b639638 | |||
b0c8c40dec | |||
1afb7681b7 | |||
740fe5df0e | |||
e4aa067bd2 | |||
9f77675d91 | |||
8a8ef69b7c | |||
95e14f8f60 | |||
1fca298a20 | |||
09b1ac5a16 | |||
7f852d241a | |||
5fdcdff6e3 | |||
60b5866b77 | |||
f42c1b7423 | |||
ede3a4a3f3 | |||
1d2aed54fa | |||
b019a2a57e | |||
a4de98aa4f | |||
172c494cff | |||
e8da107189 | |||
0ae43f7d35 | |||
36b67d38bb | |||
c1164e4eda | |||
8630653eff |
@ -1,9 +1,9 @@
|
|||||||
cmake_minimum_required(VERSION 2.8.12)
|
cmake_minimum_required(VERSION 3.0)
|
||||||
|
|
||||||
project(KImageFormats)
|
project(KImageFormats)
|
||||||
|
|
||||||
include(FeatureSummary)
|
include(FeatureSummary)
|
||||||
find_package(ECM 5.20.0 NO_MODULE)
|
find_package(ECM 5.35.0 NO_MODULE)
|
||||||
set_package_properties(ECM PROPERTIES TYPE REQUIRED DESCRIPTION "Extra CMake Modules." URL "https://projects.kde.org/projects/kdesupport/extra-cmake-modules")
|
set_package_properties(ECM PROPERTIES TYPE REQUIRED DESCRIPTION "Extra CMake Modules." URL "https://projects.kde.org/projects/kdesupport/extra-cmake-modules")
|
||||||
feature_summary(WHAT REQUIRED_PACKAGES_NOT_FOUND FATAL_ON_MISSING_REQUIRED_PACKAGES)
|
feature_summary(WHAT REQUIRED_PACKAGES_NOT_FOUND FATAL_ON_MISSING_REQUIRED_PACKAGES)
|
||||||
|
|
||||||
@ -11,13 +11,13 @@ feature_summary(WHAT REQUIRED_PACKAGES_NOT_FOUND FATAL_ON_MISSING_REQUIRED_PACKA
|
|||||||
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})
|
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})
|
||||||
|
|
||||||
include(KDEInstallDirs)
|
include(KDEInstallDirs)
|
||||||
include(KDEFrameworkCompilerSettings)
|
include(KDEFrameworkCompilerSettings NO_POLICY_SCOPE)
|
||||||
include(KDECMakeSettings)
|
include(KDECMakeSettings)
|
||||||
|
|
||||||
|
|
||||||
include(CheckIncludeFiles)
|
include(CheckIncludeFiles)
|
||||||
|
|
||||||
set(REQUIRED_QT_VERSION 5.3.0)
|
set(REQUIRED_QT_VERSION 5.6.0)
|
||||||
find_package(Qt5Gui ${REQUIRED_QT_VERSION} REQUIRED NO_MODULE)
|
find_package(Qt5Gui ${REQUIRED_QT_VERSION} REQUIRED NO_MODULE)
|
||||||
|
|
||||||
find_package(KF5Archive)
|
find_package(KF5Archive)
|
||||||
|
@ -4,9 +4,15 @@ tier: 2
|
|||||||
type: functional
|
type: functional
|
||||||
platforms:
|
platforms:
|
||||||
- name: Linux
|
- name: Linux
|
||||||
|
- name: FreeBSD
|
||||||
- name: MacOSX
|
- name: MacOSX
|
||||||
- name: Windows
|
- name: Windows
|
||||||
note: No EPS support on Windows
|
note: No EPS support on Windows
|
||||||
|
- name: Android
|
||||||
portingAid: false
|
portingAid: false
|
||||||
deprecated: false
|
deprecated: false
|
||||||
release: true
|
release: true
|
||||||
|
|
||||||
|
public_lib: true
|
||||||
|
group: Frameworks
|
||||||
|
subgroup: Tier 2
|
||||||
|
@ -15,12 +15,8 @@
|
|||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
#include <QTemporaryFile>
|
#include <QTemporaryFile>
|
||||||
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0)
|
|
||||||
// logging category for this framework, default: log stuff >= warning
|
// logging category for this framework, default: log stuff >= warning
|
||||||
Q_LOGGING_CATEGORY(EPSPLUGIN, "epsplugin", QtWarningMsg)
|
Q_LOGGING_CATEGORY(EPSPLUGIN, "epsplugin", QtWarningMsg)
|
||||||
#else
|
|
||||||
Q_LOGGING_CATEGORY(EPSPLUGIN, "epsplugin")
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//#define EPS_PERFORMANCE_DEBUG 1
|
//#define EPS_PERFORMANCE_DEBUG 1
|
||||||
|
|
||||||
@ -341,10 +337,10 @@ QImageIOPlugin::Capabilities EPSPlugin::capabilities(QIODevice *device, const QB
|
|||||||
return Capabilities(CanRead | CanWrite);
|
return Capabilities(CanRead | CanWrite);
|
||||||
}
|
}
|
||||||
if (!format.isEmpty()) {
|
if (!format.isEmpty()) {
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
if (!device->isOpen()) {
|
if (!device->isOpen()) {
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
Capabilities cap;
|
Capabilities cap;
|
||||||
|
@ -218,10 +218,10 @@ QImageIOPlugin::Capabilities EXRPlugin::capabilities(QIODevice *device, const QB
|
|||||||
return Capabilities(CanRead);
|
return Capabilities(CanRead);
|
||||||
}
|
}
|
||||||
if (!format.isEmpty()) {
|
if (!format.isEmpty()) {
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
if (!device->isOpen()) {
|
if (!device->isOpen()) {
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
Capabilities cap;
|
Capabilities cap;
|
||||||
|
@ -66,10 +66,10 @@ QImageIOPlugin::Capabilities KraPlugin::capabilities(QIODevice *device, const QB
|
|||||||
return Capabilities(CanRead);
|
return Capabilities(CanRead);
|
||||||
}
|
}
|
||||||
if (!format.isEmpty()) {
|
if (!format.isEmpty()) {
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
if (!device->isOpen()) {
|
if (!device->isOpen()) {
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
Capabilities cap;
|
Capabilities cap;
|
||||||
|
@ -29,11 +29,10 @@ class KraPlugin : public QImageIOPlugin
|
|||||||
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QImageIOHandlerFactoryInterface" FILE "kra.json")
|
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QImageIOHandlerFactoryInterface" FILE "kra.json")
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Capabilities capabilities(QIODevice *device, const QByteArray &format) const;
|
Capabilities capabilities(QIODevice *device, const QByteArray &format) const Q_DECL_OVERRIDE;
|
||||||
QImageIOHandler *create(QIODevice *device, const QByteArray &format = QByteArray()) const;
|
QImageIOHandler *create(QIODevice *device, const QByteArray &format = QByteArray()) const Q_DECL_OVERRIDE;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -65,10 +65,10 @@ QImageIOPlugin::Capabilities OraPlugin::capabilities(QIODevice *device, const QB
|
|||||||
return Capabilities(CanRead);
|
return Capabilities(CanRead);
|
||||||
}
|
}
|
||||||
if (!format.isEmpty()) {
|
if (!format.isEmpty()) {
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
if (!device->isOpen()) {
|
if (!device->isOpen()) {
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
Capabilities cap;
|
Capabilities cap;
|
||||||
|
@ -667,10 +667,10 @@ QImageIOPlugin::Capabilities PCXPlugin::capabilities(QIODevice *device, const QB
|
|||||||
return Capabilities(CanRead | CanWrite);
|
return Capabilities(CanRead | CanWrite);
|
||||||
}
|
}
|
||||||
if (!format.isEmpty()) {
|
if (!format.isEmpty()) {
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
if (!device->isOpen()) {
|
if (!device->isOpen()) {
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
Capabilities cap;
|
Capabilities cap;
|
||||||
|
@ -449,10 +449,10 @@ QImageIOPlugin::Capabilities SoftimagePICPlugin::capabilities(QIODevice *device,
|
|||||||
return Capabilities(CanRead | CanWrite);
|
return Capabilities(CanRead | CanWrite);
|
||||||
}
|
}
|
||||||
if (!format.isEmpty()) {
|
if (!format.isEmpty()) {
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
if (!device->isOpen()) {
|
if (!device->isOpen()) {
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
Capabilities cap;
|
Capabilities cap;
|
||||||
|
@ -120,19 +120,19 @@ static quint8 readPixel(QDataStream &stream) {
|
|||||||
quint8 pixel;
|
quint8 pixel;
|
||||||
stream >> pixel;
|
stream >> pixel;
|
||||||
return pixel;
|
return pixel;
|
||||||
};
|
}
|
||||||
static QRgb updateRed(QRgb oldPixel, quint8 redPixel) {
|
static QRgb updateRed(QRgb oldPixel, quint8 redPixel) {
|
||||||
return qRgba(redPixel, qGreen(oldPixel), qBlue(oldPixel), qAlpha(oldPixel));
|
return qRgba(redPixel, qGreen(oldPixel), qBlue(oldPixel), qAlpha(oldPixel));
|
||||||
};
|
}
|
||||||
static QRgb updateGreen(QRgb oldPixel, quint8 greenPixel) {
|
static QRgb updateGreen(QRgb oldPixel, quint8 greenPixel) {
|
||||||
return qRgba(qRed(oldPixel), greenPixel, qBlue(oldPixel), qAlpha(oldPixel));
|
return qRgba(qRed(oldPixel), greenPixel, qBlue(oldPixel), qAlpha(oldPixel));
|
||||||
};
|
}
|
||||||
static QRgb updateBlue(QRgb oldPixel, quint8 bluePixel) {
|
static QRgb updateBlue(QRgb oldPixel, quint8 bluePixel) {
|
||||||
return qRgba(qRed(oldPixel), qGreen(oldPixel), bluePixel, qAlpha(oldPixel));
|
return qRgba(qRed(oldPixel), qGreen(oldPixel), bluePixel, qAlpha(oldPixel));
|
||||||
};
|
}
|
||||||
static QRgb updateAlpha(QRgb oldPixel, quint8 alphaPixel) {
|
static QRgb updateAlpha(QRgb oldPixel, quint8 alphaPixel) {
|
||||||
return qRgba(qRed(oldPixel), qGreen(oldPixel), qBlue(oldPixel), alphaPixel);
|
return qRgba(qRed(oldPixel), qGreen(oldPixel), qBlue(oldPixel), alphaPixel);
|
||||||
};
|
}
|
||||||
typedef QRgb(*channelUpdater)(QRgb,quint8);
|
typedef QRgb(*channelUpdater)(QRgb,quint8);
|
||||||
|
|
||||||
// Load the PSD image.
|
// Load the PSD image.
|
||||||
@ -300,10 +300,10 @@ QImageIOPlugin::Capabilities PSDPlugin::capabilities(QIODevice *device, const QB
|
|||||||
return Capabilities(CanRead);
|
return Capabilities(CanRead);
|
||||||
}
|
}
|
||||||
if (!format.isEmpty()) {
|
if (!format.isEmpty()) {
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
if (!device->isOpen()) {
|
if (!device->isOpen()) {
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
Capabilities cap;
|
Capabilities cap;
|
||||||
|
@ -282,10 +282,10 @@ QImageIOPlugin::Capabilities RASPlugin::capabilities(QIODevice *device, const QB
|
|||||||
return Capabilities(CanRead);
|
return Capabilities(CanRead);
|
||||||
}
|
}
|
||||||
if (!format.isEmpty()) {
|
if (!format.isEmpty()) {
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
if (!device->isOpen()) {
|
if (!device->isOpen()) {
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
Capabilities cap;
|
Capabilities cap;
|
||||||
|
@ -111,8 +111,8 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
SGIImage::SGIImage(QIODevice *io) :
|
SGIImage::SGIImage(QIODevice *io) :
|
||||||
_starttab(0),
|
_starttab(nullptr),
|
||||||
_lengthtab(0)
|
_lengthtab(nullptr)
|
||||||
{
|
{
|
||||||
_dev = io;
|
_dev = io;
|
||||||
_stream.setDevice(_dev);
|
_stream.setDevice(_dev);
|
||||||
@ -714,10 +714,10 @@ QImageIOPlugin::Capabilities RGBPlugin::capabilities(QIODevice *device, const QB
|
|||||||
return Capabilities(CanRead | CanWrite);
|
return Capabilities(CanRead | CanWrite);
|
||||||
}
|
}
|
||||||
if (!format.isEmpty()) {
|
if (!format.isEmpty()) {
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
if (!device->isOpen()) {
|
if (!device->isOpen()) {
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
Capabilities cap;
|
Capabilities cap;
|
||||||
|
@ -145,6 +145,9 @@ struct TgaHeaderInfo {
|
|||||||
switch (tga.image_type) {
|
switch (tga.image_type) {
|
||||||
case TGA_TYPE_RLE_INDEXED:
|
case TGA_TYPE_RLE_INDEXED:
|
||||||
rle = true;
|
rle = true;
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(5,8,0)
|
||||||
|
Q_FALLTHROUGH();
|
||||||
|
#endif
|
||||||
// no break is intended!
|
// no break is intended!
|
||||||
case TGA_TYPE_INDEXED:
|
case TGA_TYPE_INDEXED:
|
||||||
pal = true;
|
pal = true;
|
||||||
@ -152,6 +155,9 @@ struct TgaHeaderInfo {
|
|||||||
|
|
||||||
case TGA_TYPE_RLE_RGB:
|
case TGA_TYPE_RLE_RGB:
|
||||||
rle = true;
|
rle = true;
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(5,8,0)
|
||||||
|
Q_FALLTHROUGH();
|
||||||
|
#endif
|
||||||
// no break is intended!
|
// no break is intended!
|
||||||
case TGA_TYPE_RGB:
|
case TGA_TYPE_RGB:
|
||||||
rgb = true;
|
rgb = true;
|
||||||
@ -159,6 +165,9 @@ struct TgaHeaderInfo {
|
|||||||
|
|
||||||
case TGA_TYPE_RLE_GREY:
|
case TGA_TYPE_RLE_GREY:
|
||||||
rle = true;
|
rle = true;
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(5,8,0)
|
||||||
|
Q_FALLTHROUGH();
|
||||||
|
#endif
|
||||||
// no break is intended!
|
// no break is intended!
|
||||||
case TGA_TYPE_GREY:
|
case TGA_TYPE_GREY:
|
||||||
grey = true;
|
grey = true;
|
||||||
@ -414,10 +423,10 @@ QImageIOPlugin::Capabilities TGAPlugin::capabilities(QIODevice *device, const QB
|
|||||||
return Capabilities(CanRead | CanWrite);
|
return Capabilities(CanRead | CanWrite);
|
||||||
}
|
}
|
||||||
if (!format.isEmpty()) {
|
if (!format.isEmpty()) {
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
if (!device->isOpen()) {
|
if (!device->isOpen()) {
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
Capabilities cap;
|
Capabilities cap;
|
||||||
|
@ -107,7 +107,7 @@ private:
|
|||||||
//! copied in different ways.
|
//! copied in different ways.
|
||||||
void (*assignBytes)(Layer &layer, uint i, uint j);
|
void (*assignBytes)(Layer &layer, uint i, uint j);
|
||||||
|
|
||||||
Layer(void) : name(0) {}
|
Layer(void) : name(nullptr) {}
|
||||||
~Layer(void)
|
~Layer(void)
|
||||||
{
|
{
|
||||||
delete[] name;
|
delete[] name;
|
||||||
@ -416,7 +416,7 @@ bool XCFImageFormat::loadImageProperties(QDataStream &xcf_io, XCFImage &xcf_imag
|
|||||||
property.readBytes(tag, size);
|
property.readBytes(tag, size);
|
||||||
|
|
||||||
quint32 flags;
|
quint32 flags;
|
||||||
char *data = 0;
|
char *data = nullptr;
|
||||||
property >> flags >> data;
|
property >> flags >> data;
|
||||||
|
|
||||||
if (tag && strncmp(tag, "gimp-comment", strlen("gimp-comment")) == 0) {
|
if (tag && strncmp(tag, "gimp-comment", strlen("gimp-comment")) == 0) {
|
||||||
@ -474,7 +474,7 @@ bool XCFImageFormat::loadProperty(QDataStream &xcf_io, PropType &type, QByteArra
|
|||||||
xcf_io >> foo;
|
xcf_io >> foo;
|
||||||
type = PropType(foo); // TODO urks
|
type = PropType(foo); // TODO urks
|
||||||
|
|
||||||
char *data = 0;
|
char *data = nullptr;
|
||||||
quint32 size;
|
quint32 size;
|
||||||
|
|
||||||
// The colormap property size is not the correct number of bytes:
|
// The colormap property size is not the correct number of bytes:
|
||||||
@ -1323,7 +1323,9 @@ bool XCFImageFormat::initializeImage(XCFImage &xcf_image)
|
|||||||
image.fill(qRgb(255, 255, 255));
|
image.fill(qRgb(255, 255, 255));
|
||||||
break;
|
break;
|
||||||
} // else, fall through to 32-bit representation
|
} // else, fall through to 32-bit representation
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(5,8,0)
|
||||||
|
Q_FALLTHROUGH();
|
||||||
|
#endif
|
||||||
case RGBA_GIMAGE:
|
case RGBA_GIMAGE:
|
||||||
image = QImage(xcf_image.width, xcf_image.height, QImage::Format_ARGB32);
|
image = QImage(xcf_image.width, xcf_image.height, QImage::Format_ARGB32);
|
||||||
if (image.isNull()) {
|
if (image.isNull()) {
|
||||||
@ -1343,7 +1345,9 @@ bool XCFImageFormat::initializeImage(XCFImage &xcf_image)
|
|||||||
image.fill(255);
|
image.fill(255);
|
||||||
break;
|
break;
|
||||||
} // else, fall through to 32-bit representation
|
} // else, fall through to 32-bit representation
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(5,8,0)
|
||||||
|
Q_FALLTHROUGH();
|
||||||
|
#endif
|
||||||
case GRAYA_GIMAGE:
|
case GRAYA_GIMAGE:
|
||||||
image = QImage(xcf_image.width, xcf_image.height, QImage::Format_ARGB32);
|
image = QImage(xcf_image.width, xcf_image.height, QImage::Format_ARGB32);
|
||||||
if (image.isNull()) {
|
if (image.isNull()) {
|
||||||
@ -1442,7 +1446,7 @@ void XCFImageFormat::copyLayerToImage(XCFImage &xcf_image)
|
|||||||
{
|
{
|
||||||
Layer &layer(xcf_image.layer);
|
Layer &layer(xcf_image.layer);
|
||||||
QImage &image(xcf_image.image);
|
QImage &image(xcf_image.image);
|
||||||
PixelCopyOperation copy = 0;
|
PixelCopyOperation copy = nullptr;
|
||||||
|
|
||||||
switch (layer.type) {
|
switch (layer.type) {
|
||||||
case RGB_GIMAGE:
|
case RGB_GIMAGE:
|
||||||
@ -1725,7 +1729,7 @@ void XCFImageFormat::mergeLayerIntoImage(XCFImage &xcf_image)
|
|||||||
Layer &layer(xcf_image.layer);
|
Layer &layer(xcf_image.layer);
|
||||||
QImage &image(xcf_image.image);
|
QImage &image(xcf_image.image);
|
||||||
|
|
||||||
PixelMergeOperation merge = 0;
|
PixelMergeOperation merge = nullptr;
|
||||||
|
|
||||||
if (!layer.opacity) {
|
if (!layer.opacity) {
|
||||||
return; // don't bother doing anything
|
return; // don't bother doing anything
|
||||||
@ -2686,10 +2690,10 @@ QImageIOPlugin::Capabilities XCFPlugin::capabilities(QIODevice *device, const QB
|
|||||||
return Capabilities(CanRead);
|
return Capabilities(CanRead);
|
||||||
}
|
}
|
||||||
if (!format.isEmpty()) {
|
if (!format.isEmpty()) {
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
if (!device->isOpen()) {
|
if (!device->isOpen()) {
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
Capabilities cap;
|
Capabilities cap;
|
||||||
|
Reference in New Issue
Block a user