12#include <QReadWriteLock>
63 QWriteLocker locker(&
d->lock);
65 if (profile->
valid()) {
66 d->profileMap[profile->
name()] = profile;
67 if (
d->profileUniqueIdMap.contains(profile->
uniqueId())) {
69 d->duplicates.append(
d->profileUniqueIdMap[profile->
uniqueId()]);
71 d->profileUniqueIdMap.insert(profile->
uniqueId(), profile);
77 QWriteLocker locker(&
d->lock);
79 d->profileMap.remove(profile->
name());
80 d->profileUniqueIdMap.remove(profile->
uniqueId());
81 d->duplicates.removeAll(profile);
86 QReadLocker l(&
d->lock);
87 return d->profileMap.contains(profile->
name());
92 QWriteLocker l(&
d->lock);
93 d->profileAlias[name] = to;
98 QWriteLocker l(&
d->lock);
99 d->profileAlias.remove(name);
104 QReadLocker l(&
d->lock);
109 return d->profileMap.contains(name) ? name :
d->profileAlias.value(name, name);
114 QReadLocker l(&
d->lock);
119 if (
d->profileMap.contains(name)) {
120 return d->profileMap[name];
123 return d->profileMap.value(
d->profileAlias.value(name, name), 0);
128 QWriteLocker l(&
lock);
136 QByteArray
id = profile->
uniqueId();
147 QReadLocker l(&
d->lock);
148 if (
d->profileUniqueIdMap.isEmpty()) {
150 d->populateUniqueIdMap();
153 return d->profileUniqueIdMap.value(
id, 0);
160 if (!csf)
return profiles;
162 QReadLocker l(&
d->lock);
164 QHash<QString, KoColorProfile * >::ConstIterator it;
165 for (it =
d->profileMap.constBegin(); it !=
d->profileMap.constEnd(); ++it) {
170 profiles.push_back(profile);
184 QReadLocker l(&
d->lock);
190 if (
int(profile->getColorPrimaries()) == query.
primaries) {
191 colorantTypeMatch =
true;
195 if (
int(profile->getTransferCharacteristics()) == query.
transfer) {
196 transferMatch =
true;
202 if (profile->getColorantsxyY().size() == query.
rgbColorants.size()) {
210 if (!colorantMatch) {
214 for (
int i = 0; i < col.size(); i++) {
215 colorantMatch = (std::fabs(col[i].x - query.
rgbColorants[i].x) < error) && (std::fabs(col[i].y - query.
rgbColorants[i].y) < error);
216 if (!colorantMatch) {
222 colorantMatch =
true;
227 if (transferMatch && colorantMatch && colorantTypeMatch) {
228 profiles.push_back(profile);
const KoColorProfile * profileByName(const QString &name) const
QList< const KoColorProfile * > profilesFor(const KoColorSpaceFactory *csf) const
void removeProfileAlias(const QString &name)
QString profileAlias(const QString &name) const
void removeProfile(KoColorProfile *profile)
bool containsProfile(const KoColorProfile *profile)
containsProfile shows if a profile is registered in the storage
const KoColorProfile * profileByUniqueId(const QByteArray &id) const
const QScopedPointer< Private > d
void addProfileAlias(const QString &name, const QString &to)
void addProfile(KoColorProfile *profile)
The KoColorProfileQuery struct.
TransferCharacteristics transfer
CICP-compatible enum value representing the white point and primaries.
ColorPrimaries primaries
Rgb Primaries of the profile. When empty, this is a query for a greyscale profile.
bool isValid() const
CICP-compatible enum value representing the transfer function.
QList< KoColorimetryUtils::xy > rgbColorants
The desired white point of the profile.
KoColorimetryUtils::xy whitePoint
QHash< QByteArray, KoColorProfile * > profileUniqueIdMap
QList< KoColorProfile * > duplicates
QHash< QString, KoColorProfile * > profileMap
QHash< QString, QString > profileAlias
void populateUniqueIdMap()
virtual QByteArray uniqueId() const =0
virtual bool valid() const =0
virtual bool profileIsCompatible(const KoColorProfile *profile) const =0