Skip to content

armgit / krita

Public Imported from GitHub
0

Krita is a free and open source cross-platform application that offers an end-to-end solution for creating digital art files from scratch built on the KDE and Qt frameworks.

C++

Also ifdef the color picking code and buffer pasting code to not manage itself in qt5

Wolthera van Hövell tot Westerfliere08b82176588
diff --git a/libs/ui/KisReferenceImage.cpp b/libs/ui/KisReferenceImage.cpp
index 56d18518b3..571ad373cc 100644
--- a/libs/ui/KisReferenceImage.cpp
+++ b/libs/ui/KisReferenceImage.cpp
@@ -213,12 +213,16 @@ KisReferenceImage::fromPaintDevice(KisPaintDeviceSP src, const KisCoordinatesCon
}
auto *reference = new KisReferenceImage();
+#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
if (src->colorSpace()->colorModelId() == RGBAColorModelID) {
reference->d->image = src->convertToQImage(src->colorSpace()->profile());
reference->d->image.setColorSpace(KoColorSpaceRegistry::instance()->QColorSpaceForProfile(src->colorSpace()->profile()));
} else {
reference->d->image = src->convertToQImage(KoColorSpaceRegistry::instance()->p709SRGBProfile());
}
+#else
+ reference->d->image = src->convertToQImage(KoColorSpaceRegistry::instance()->p709SRGBProfile());
+#endif
QRect r = QRect(QPoint(), reference->d->image.size());
QSizeF size = converter.imageToDocument(r).size();
@@ -360,14 +364,18 @@ KoColor KisReferenceImage::getPixel(QPointF position)
d->updateCache();
}
+#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
const KoColorProfile *profile = KoColorSpaceRegistry::instance()->profileForQColorSpace(d->image.colorSpace());
const KoColorSpace *cs = KoColorSpaceRegistry::instance()->colorSpace(RGBAColorModelID.id(), Integer16BitsColorDepthID.id(), profile);
-
+#else
+ const KoColorSpace *cs = KoColorSpaceRegistry::instance()->rgb8(KoColorSpaceRegistry::instance()->p709SRGBProfile());
+#endif
KoColor c(cs);
QColor pixel = d->cachedImage.pixelColor(localPosition.toPoint());
QVector<float> channels = {pixel.blueF(), pixel.greenF(), pixel.redF(), 1.0};
cs->fromNormalisedChannelsValue( c.data(),channels);
+
return c;
}