mirror of
https://invent.kde.org/frameworks/kimageformats.git
synced 2025-11-22 10:02:43 -05:00
Improve CMYK writing support
Closes #11 Requires MR !279 On formats that does not support CMYK and does not use the ScanLineConverter class during write operation, the CMYK images must be converted using the color space conversion functions of `QImage` (if ICC profile is valid).
This commit is contained in:
@ -24,11 +24,11 @@
|
||||
|
||||
#include <cstring>
|
||||
|
||||
#include <QList>
|
||||
#include <QMap>
|
||||
|
||||
#include <QColorSpace>
|
||||
#include <QDebug>
|
||||
#include <QImage>
|
||||
#include <QList>
|
||||
#include <QMap>
|
||||
|
||||
class RLEData : public QList<uchar>
|
||||
{
|
||||
@ -750,7 +750,14 @@ bool SGIImagePrivate::writeImage(const QImage &image)
|
||||
_dim = 3, _zsize++;
|
||||
}
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 8, 0)
|
||||
auto cs = image.colorSpace();
|
||||
if (cs.isValid() && cs.colorModel() == QColorSpace::ColorModel::Cmyk && image.format() == QImage::Format_CMYK8888) {
|
||||
img = image.convertedToColorSpace(QColorSpace(QColorSpace::SRgb), QImage::Format_RGB32);
|
||||
} else if (hasAlpha && img.format() != QImage::Format_ARGB32) {
|
||||
#else
|
||||
if (hasAlpha && img.format() != QImage::Format_ARGB32) {
|
||||
#endif
|
||||
img = img.convertToFormat(QImage::Format_ARGB32);
|
||||
} else if (!hasAlpha && img.format() != QImage::Format_RGB32) {
|
||||
img = img.convertToFormat(QImage::Format_RGB32);
|
||||
|
||||
Reference in New Issue
Block a user