Krita Source Code Documentation
Loading...
Searching...
No Matches
sRGBProfileCheck.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2016 Boudewijn Rempt <boud@valdyas.org>
3 *
4 * SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6
7#ifndef sRGBProfileCheck_H
8#define sRGBProfileCheck_H
9
11#include <KoID.h>
12#include <klocalizedstring.h>
13#include <kis_image.h>
14#include <KoColorSpace.h>
15#include <KoColorProfile.h>
16
21{
22public:
23
24 sRGBProfileCheck(const QString &id, Level level, const QString &customWarning = QString())
25 : KisExportCheckBase(id, level, customWarning)
26 {
27 if (customWarning.isEmpty()) {
28 m_warning = i18nc("image conversion warning", "The image is not tagged as <b>non-linear gamma sRGB</b>. The image will be converted to sRGB.");
29 }
30 }
31
32 bool checkNeeded(KisImageSP image) const override
33 {
34 bool sRGB = image->colorSpace()->profile()->name().contains(QLatin1String("srgb"), Qt::CaseInsensitive);
35
36 // XXX: add an isLinear function to KoColorProfile that uses the information already available through lcms
37 bool linear = image->colorSpace()->profile()->name().contains(QLatin1String("g10"), Qt::CaseInsensitive);
38
39 return (!sRGB || linear);
40 }
41
42 Level check(KisImageSP /*image*/) const override
43 {
44 return m_level;
45 }
46
47};
48
50{
51public:
52
56
58
59 KisExportCheckBase *create(KisExportCheckBase::Level level, const QString &customWarning) override
60 {
61 return new sRGBProfileCheck(id(), level, customWarning);
62 }
63
64 QString id() const override {
65 return "sRGBProfileCheck";
66 }
67};
68
69#endif // sRGBProfileCheck_H
The KisExportCheckBase class defines the interface of the individual checks of an export filter's cap...
virtual QString id() const
const KoColorSpace * colorSpace() const
virtual const KoColorProfile * profile() const =0
KisExportCheckBase * create(KisExportCheckBase::Level level, const QString &customWarning) override
QString id() const override
Level check(KisImageSP) const override
bool checkNeeded(KisImageSP image) const override
sRGBProfileCheck(const QString &id, Level level, const QString &customWarning=QString())