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
135 using CustomProfileNameAlias = QHash<QString, QString>;
136 const KoColorProfile *createColorProfile(const QString & colorModelId, const QString & colorDepthId, const QByteArray& rawData, CustomProfileNameAlias customProfileNameAlias);
137
145 const KoColorProfile * profileByName(const QString & name) const ;
146
147
155 const KoColorProfile *profileByUniqueId(const QByteArray &id) const;
156
157 bool profileIsCompatible(const KoColorProfile* profile, const QString &colorSpaceId);
158
167 QList<const KoColorProfile *> profilesFor(const QString& csID) const;
168 QString defaultProfileForColorSpace(const QString &colorSpaceId) const;
169
175 KoColorConversionTransformation* createColorConverter(const KoColorSpace * srcColorSpace, const KoColorSpace * dstColorSpace, KoColorConversionTransformation::Intent renderingIntent, KoColorConversionTransformation::ConversionFlags conversionFlags) const;
176
194 void createColorConverters(const KoColorSpace* colorSpace, const QList< QPair<KoID, KoID> >& possibilities, KoColorConversionTransformation*& fromCS, KoColorConversionTransformation*& toCS) const;
195
202 const KoColorSpace * colorSpace(const QString & colorModelId, const QString & colorDepthId, const KoColorProfile *profile);
203
209 const KoColorSpace * colorSpace(const QString & colorModelId, const QString & colorDepthId, const QString &profileName);
210
211 const KoColorSpace * colorSpace(const QString & colorModelId, const QString & colorDepthId);
212
219 QString colorSpaceId(const QString & colorModelId, const QString & colorDepthId) const;
227 QString colorSpaceId(const KoID& colorModelId, const KoID& colorDepthId) const;
228
235 KoID colorSpaceColorModelId(const QString & _colorSpaceId) const;
236
243 KoID colorSpaceColorDepthId(const QString & _colorSpaceId) const;
244
248 const KoColorSpace *alpha8();
249 const KoColorSpace *alpha16();
250#ifdef HAVE_OPENEXR
251 const KoColorSpace *alpha16f();
252#endif
253 const KoColorSpace *alpha32f();
254
261 const KoColorSpace *graya8(const QString &profile = QString());
262
269 const KoColorSpace *graya8(const KoColorProfile *profile);
270
277 const KoColorSpace *graya16(const QString &profile = QString());
278
285 const KoColorSpace *graya16(const KoColorProfile *profile);
286
287
294 const KoColorSpace * rgb8(const QString &profileName = QString());
295
301 const KoColorSpace * rgb8(const KoColorProfile * profile);
302
309 const KoColorSpace * rgb16(const QString &profileName = QString());
310
316 const KoColorSpace * rgb16(const KoColorProfile * profile);
317
324 const KoColorSpace * lab16(const QString &profileName = QString());
325
331 const KoColorSpace * lab16(const KoColorProfile * profile);
332
337 const KoColorProfile *p2020G10Profile() const;
338
342 const KoColorProfile *p2020PQProfile() const;
343
348 const KoColorProfile *p709G10Profile() const;
349
354 const KoColorProfile *p709SRGBProfile() const;
355
363 const KoColorProfile *profileFor(const KoColorProfileQuery &query, const bool generate = true) const;
364
374 const KoColorProfile *profileForQColorSpace(const QColorSpace &space);
375
383 QColorSpace QColorSpaceForProfile(const KoColorProfile *profile) const;
387 QList<KoID> colorModelsList(ColorSpaceListVisibility option) const;
388
392 QList<KoID> colorDepthList(const KoID& colorModelId, ColorSpaceListVisibility option) const;
393
397 QList<KoID> colorDepthList(const QString & colorModelId, ColorSpaceListVisibility option) const;
398
403
408 const KoColorSpace* permanentColorspace(const KoColorSpace* _colorSpace);
409
414 QList<KoID> listKeys() const;
415
416private:
417
418 friend class KisCsConversionTest;
419 friend class KisIteratorTest;
420 friend class KisIteratorNGTest;
421 friend class KisPainterTest;
422 friend class KisCrashFilterTest;
424 friend class TestKoColorSpaceSanity;
425 friend class TestColorConversionSystem;
426 friend struct FriendOfColorSpaceRegistry;
427 friend class TestProfileGeneration;
428
433
442
443 const KoColorProfile *profileForInternal(const KoColorProfileQuery &query, const bool generate) const;
444
445private:
448 void init();
449
450private:
451 struct Private;
452 Private * const d;
453};
454
455#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 &)