mirror of
https://invent.kde.org/frameworks/kimageformats.git
synced 2025-10-04 07:04:23 -04:00
EXR: Full support for gray image/colorspace
Starting with Qt 6.8, QColorSpace supports Gray and CMYK color profiles. - On saving, grayscale images are converted to linear gray profile; - On loading, a Grayscale image is stored in a QImage::Format_Grayscale16 instead a RGB one; - ScanlineConverter class was updated to gray conversions.
This commit is contained in:
committed by
Albert Astals Cid
parent
63e21ee5f3
commit
81b7263d73
@ -72,9 +72,18 @@ const uchar *ScanLineConverter::convertedScanLine(const QImage &image, qint32 y)
|
||||
if (!cs.isValid()) {
|
||||
cs = _defaultColorSpace;
|
||||
}
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 8, 0)
|
||||
if (tmp.depth() < 8 && cs.colorModel() == QColorSpace::ColorModel::Gray) {
|
||||
tmp.convertTo(QImage::Format_Grayscale8);
|
||||
}
|
||||
else if (tmp.depth() < 24 && cs.colorModel() == QColorSpace::ColorModel::Rgb) {
|
||||
tmp.convertTo(tmp.hasAlphaChannel() ? QImage::Format_ARGB32 : QImage::Format_RGB32);
|
||||
}
|
||||
#else
|
||||
if (tmp.depth() < 24) {
|
||||
tmp.convertTo(tmp.hasAlphaChannel() ? QImage::Format_ARGB32 : QImage::Format_RGB32);
|
||||
}
|
||||
#endif
|
||||
tmp.setColorSpace(cs);
|
||||
tmp.convertToColorSpace(_colorSpace);
|
||||
}
|
||||
|
Reference in New Issue
Block a user