Krita Source Code Documentation
Loading...
Searching...
No Matches
KoColorSpaceRegistry.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2003 Patrick Julien <freak@codepimps.org>
3 * SPDX-FileCopyrightText: 2004, 2010 Cyrille Berger <cberger@cberger.net>
4 *
5 * SPDX-License-Identifier: LGPL-2.1-or-later
6*/
7
8#ifndef KOCOLORSPACEREGISTRY_H
9#define KOCOLORSPACEREGISTRY_H
10
11#include <QObject>
12#include <QList>
13#include <QString>
14#include "kritapigment_export.h"
15
16#include <KoGenericRegistry.h>
17#include <KoColorSpace.h>
18#include <KoColorSpaceFactory.h>
19#include <KoConfig.h>
21
22class KoColorProfile;
26class QColorSpace;
28
53class KRITAPIGMENT_EXPORT KoColorSpaceRegistry
54{
55public:
57
59 OnlyUserVisible = 1,
60 AllColorSpaces = 4
61 };
63 OnlyDefaultProfile = 1,
64 AllProfiles = 4
65 };
66
72
73 virtual ~KoColorSpaceRegistry();
74
75public:
80 void add(KoColorSpaceFactory* item);
81
87 void remove(KoColorSpaceFactory* item);
88
94 void addProfileToMap(KoColorProfile *p);
95
101 void addProfile(KoColorProfile* profile);
102 void addProfile(const KoColorProfile* profile); // TODO why ?
103 void removeProfile(KoColorProfile* profile);
104
113 void addProfileAlias(const QString& name, const QString& to);
114
118 void removeProfileAlias(const QString& name);
119
123 QString profileAlias(const QString& name) const;
124
128 const KoColorProfile *createColorProfile(const QString & colorModelId, const QString & colorDepthId, const QByteArray& rawData);
129
130 using CustomProfileNameAlias = QHash<QString, QString>;
131 const KoColorProfile *createColorProfile(const QString & colorModelId, const QString & colorDepthId, const QByteArray& rawData, CustomProfileNameAlias customProfileNameAlias);
132
140 const KoColorProfile * profileByName(const QString & name) const ;
141
142
150 const KoColorProfile *profileByUniqueId(const QByteArray &id) const;
151
152 bool profileIsCompatible(const KoColorProfile* profile, const QString &colorSpaceId);
153
162 QList<const KoColorProfile *> profilesFor(const QString& csID) const;
163 QString defaultProfileForColorSpace(const QString &colorSpaceId) const;
164
170 KoColorConversionTransformation* createColorConverter(const KoColorSpace * srcColorSpace, const KoColorSpace * dstColorSpace, KoColorConversionTransformation::Intent renderingIntent, KoColorConversionTransformation::ConversionFlags conversionFlags) const;
171
189 void createColorConverters(const KoColorSpace* colorSpace, const QList< QPair<KoID, KoID> >& possibilities, KoColorConversionTransformation*& fromCS, KoColorConversionTransformation*& toCS) const;
190
197 const KoColorSpace * colorSpace(const QString & colorModelId, const QString & colorDepthId, const KoColorProfile *profile);
198
204 const KoColorSpace * colorSpace(const QString & colorModelId, const QString & colorDepthId, const QString &profileName);
205
206 const KoColorSpace * colorSpace(const QString & colorModelId, const QString & colorDepthId);
207
214 QString colorSpaceId(const QString & colorModelId, const QString & colorDepthId) const;
222 QString colorSpaceId(const KoID& colorModelId, const KoID& colorDepthId) const;
223
230 KoID colorSpaceColorModelId(const QString & _colorSpaceId) const;
231
238 KoID colorSpaceColorDepthId(const QString & _colorSpaceId) const;
239
243 const KoColorSpace *alpha8();
244 const KoColorSpace *alpha16();
245#ifdef HAVE_OPENEXR
246 const KoColorSpace *alpha16f();
247#endif
248 const KoColorSpace *alpha32f();
249
256 const KoColorSpace *graya8(const QString &profile = QString());
257
264 const KoColorSpace *graya8(const KoColorProfile *profile);
265
272 const KoColorSpace *graya16(const QString &profile = QString());
273
280 const KoColorSpace *graya16(const KoColorProfile *profile);
281
282
289 const KoColorSpace * rgb8(const QString &profileName = QString());
290
296 const KoColorSpace * rgb8(const KoColorProfile * profile);
297
304 const KoColorSpace * rgb16(const QString &profileName = QString());
305
311 const KoColorSpace * rgb16(const KoColorProfile * profile);
312
319 const KoColorSpace * lab16(const QString &profileName = QString());
320
326 const KoColorSpace * lab16(const KoColorProfile * profile);
327
332 const KoColorProfile *p2020G10Profile() const;
333
337 const KoColorProfile *p2020PQProfile() const;
338
343 const KoColorProfile *p709G10Profile() const;
344
349 const KoColorProfile *p709SRGBProfile() const;
350
358 const KoColorProfile *profileFor(const KoColorProfileQuery &query, const bool generate = true) const;
359
369 const KoColorProfile *profileForQColorSpace(const QColorSpace &space);
370
378 QColorSpace QColorSpaceForProfile(const KoColorProfile *profile) const;
382 QList<KoID> colorModelsList(ColorSpaceListVisibility option) const;
383
387 QList<KoID> colorDepthList(const KoID& colorModelId, ColorSpaceListVisibility option) const;
388
392 QList<KoID> colorDepthList(const QString & colorModelId, ColorSpaceListVisibility option) const;
393
398
403 const KoColorSpace* permanentColorspace(const KoColorSpace* _colorSpace);
404
409 QList<KoID> listKeys() const;
410
411private:
412
413 friend class KisCsConversionTest;
414 friend class KisIteratorTest;
415 friend class KisIteratorNGTest;
416 friend class KisPainterTest;
417 friend class KisCrashFilterTest;
419 friend class TestKoColorSpaceSanity;
420 friend class TestColorConversionSystem;
421 friend struct FriendOfColorSpaceRegistry;
422
427
436
437private:
440 void init();
441
442private:
443 struct Private;
444 Private * const d;
445};
446
447#endif // KOCOLORSPACEREGISTRY_H
const Params2D p
PythonPluginManager * instance
Definition KoID.h:30
The KoColorProfileQuery struct.
const KoColorConversionSystem * colorConversionSystem() const
QHash< QString, QString > CustomProfileNameAlias
KoColorConversionCache * colorConversionCache() const
KoColorSpaceRegistry operator=(const KoColorSpaceRegistry &)
KoColorSpaceRegistry(const KoColorSpaceRegistry &)