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;
27
52class KRITAPIGMENT_EXPORT KoColorSpaceRegistry
53{
54public:
56
58 OnlyUserVisible = 1,
59 AllColorSpaces = 4
60 };
62 OnlyDefaultProfile = 1,
63 AllProfiles = 4
64 };
65
71
72 virtual ~KoColorSpaceRegistry();
73
74public:
79 void add(KoColorSpaceFactory* item);
80
86 void remove(KoColorSpaceFactory* item);
87
93 void addProfileToMap(KoColorProfile *p);
94
100 void addProfile(KoColorProfile* profile);
101 void addProfile(const KoColorProfile* profile); // TODO why ?
102 void removeProfile(KoColorProfile* profile);
103
108 void addProfileAlias(const QString& name, const QString& to);
109
113 QString profileAlias(const QString& name) const;
114
118 const KoColorProfile *createColorProfile(const QString & colorModelId, const QString & colorDepthId, const QByteArray& rawData);
119
127 const KoColorProfile * profileByName(const QString & name) const ;
128
129
137 const KoColorProfile *profileByUniqueId(const QByteArray &id) const;
138
139 bool profileIsCompatible(const KoColorProfile* profile, const QString &colorSpaceId);
140
149 QList<const KoColorProfile *> profilesFor(const QString& csID) const;
150 QString defaultProfileForColorSpace(const QString &colorSpaceId) const;
151
157 KoColorConversionTransformation* createColorConverter(const KoColorSpace * srcColorSpace, const KoColorSpace * dstColorSpace, KoColorConversionTransformation::Intent renderingIntent, KoColorConversionTransformation::ConversionFlags conversionFlags) const;
158
176 void createColorConverters(const KoColorSpace* colorSpace, const QList< QPair<KoID, KoID> >& possibilities, KoColorConversionTransformation*& fromCS, KoColorConversionTransformation*& toCS) const;
177
184 const KoColorSpace * colorSpace(const QString & colorModelId, const QString & colorDepthId, const KoColorProfile *profile);
185
191 const KoColorSpace * colorSpace(const QString & colorModelId, const QString & colorDepthId, const QString &profileName);
192
193 const KoColorSpace * colorSpace(const QString & colorModelId, const QString & colorDepthId);
194
201 QString colorSpaceId(const QString & colorModelId, const QString & colorDepthId) const;
209 QString colorSpaceId(const KoID& colorModelId, const KoID& colorDepthId) const;
210
217 KoID colorSpaceColorModelId(const QString & _colorSpaceId) const;
218
225 KoID colorSpaceColorDepthId(const QString & _colorSpaceId) const;
226
230 const KoColorSpace *alpha8();
231 const KoColorSpace *alpha16();
232#ifdef HAVE_OPENEXR
233 const KoColorSpace *alpha16f();
234#endif
235 const KoColorSpace *alpha32f();
236
243 const KoColorSpace *graya8(const QString &profile = QString());
244
251 const KoColorSpace *graya8(const KoColorProfile *profile);
252
259 const KoColorSpace *graya16(const QString &profile = QString());
260
267 const KoColorSpace *graya16(const KoColorProfile *profile);
268
269
276 const KoColorSpace * rgb8(const QString &profileName = QString());
277
283 const KoColorSpace * rgb8(const KoColorProfile * profile);
284
291 const KoColorSpace * rgb16(const QString &profileName = QString());
292
298 const KoColorSpace * rgb16(const KoColorProfile * profile);
299
306 const KoColorSpace * lab16(const QString &profileName = QString());
307
313 const KoColorSpace * lab16(const KoColorProfile * profile);
314
319 const KoColorProfile *p2020G10Profile() const;
320
324 const KoColorProfile *p2020PQProfile() const;
325
330 const KoColorProfile *p709G10Profile() const;
331
336 const KoColorProfile *p709SRGBProfile() const;
337
348 const KoColorProfile *profileFor(const QVector<double> &colorants, ColorPrimaries colorPrimaries, TransferCharacteristics transferFunction) const;
349
359 const KoColorProfile *profileForQColorSpace(const QColorSpace &space);
360
368 QColorSpace QColorSpaceForProfile(const KoColorProfile *profile) const;
372 QList<KoID> colorModelsList(ColorSpaceListVisibility option) const;
373
377 QList<KoID> colorDepthList(const KoID& colorModelId, ColorSpaceListVisibility option) const;
378
382 QList<KoID> colorDepthList(const QString & colorModelId, ColorSpaceListVisibility option) const;
383
388
393 const KoColorSpace* permanentColorspace(const KoColorSpace* _colorSpace);
394
399 QList<KoID> listKeys() const;
400
401private:
402
403 friend class KisCsConversionTest;
404 friend class KisIteratorTest;
405 friend class KisIteratorNGTest;
406 friend class KisPainterTest;
407 friend class KisCrashFilterTest;
409 friend class TestKoColorSpaceSanity;
410 friend class TestColorConversionSystem;
411 friend struct FriendOfColorSpaceRegistry;
412
417
426
427private:
430 void init();
431
432private:
433 struct Private;
434 Private * const d;
435};
436
437#endif // KOCOLORSPACEREGISTRY_H
const Params2D p
ColorPrimaries
The colorPrimaries enum Enum of colorants, follows ITU H.273 for values 0 to 255, and has extra known...
TransferCharacteristics
The transferCharacteristics enum Enum of transfer characteristics, follows ITU H.273 for values 0 to ...
PythonPluginManager * instance
Definition KoID.h:30
const KoColorConversionSystem * colorConversionSystem() const
KoColorConversionCache * colorConversionCache() const
KoColorSpaceRegistry operator=(const KoColorSpaceRegistry &)
KoColorSpaceRegistry(const KoColorSpaceRegistry &)