|
Krita Source Code Documentation
|
#include <KoColorConversionSystem.h>
Inheritance diagram for KoColorConversionSystem:Classes | |
| struct | Node |
| struct | NodeKey |
| struct | Path |
| struct | RegistryInterface |
| struct | Vertex |
Public Member Functions | |
| QString | bestPathToDot (const QString &srcKey, const QString &dstKey) const |
| KoColorConversionTransformation * | createColorConverter (const KoColorSpace *srcColorSpace, const KoColorSpace *dstColorSpace, KoColorConversionTransformation::Intent renderingIntent, KoColorConversionTransformation::ConversionFlags conversionFlags) const |
| void | createColorConverters (const KoColorSpace *colorSpace, const QList< QPair< KoID, KoID > > &possibilities, KoColorConversionTransformation *&fromCS, KoColorConversionTransformation *&toCS) const |
| bool | existsGoodPath (const QString &srcModelId, const QString &srcDepthId, const QString &srcProfileName, const QString &dstModelId, const QString &dstDepthId, const QString &dstProfileName) const |
| bool | existsPath (const QString &srcModelId, const QString &srcDepthId, const QString &srcProfileName, const QString &dstModelId, const QString &dstDepthId, const QString &dstProfileName) const |
| Path | findBestPath (const NodeKey &src, const NodeKey &dst) const |
| Path | findBestPath (const QString &srcModelId, const QString &srcDepthId, const QString &srcProfileName, const QString &dstModelId, const QString &dstDepthId, const QString &dstProfileName) const |
| void | insertColorProfile (const KoColorProfile *profile) |
| void | insertColorSpace (const KoColorSpaceFactory *csf) |
| KoColorConversionSystem (RegistryInterface *registryInterface) | |
| Private (RegistryInterface *_registryInterface) | |
| QList< KoColorProfileQuery > | requiredConnectionProfilesFor (const KoColorProfile *profile) |
| QList< KoColorProfileQuery > | requiredConnectionProfilesFor (const KoColorSpaceFactory *csf) |
| QString | toDot () const |
| ~KoColorConversionSystem () | |
Public Member Functions inherited from Private | |
| Private (KisCanvas2 *c) | |
Public Attributes | |
| QHash< NodeKey, Node * > | graph |
| RegistryInterface * | registryInterface |
| QList< Vertex * > | vertexes |
Public Attributes inherited from Private | |
| KisCanvas2 * | canvas |
| int | displayedFrame |
| int | intendedFrame |
Private Member Functions | |
| void | connectToEngine (Node *_node, Node *_engine) |
| Node * | createNode (const QString &_modelId, const QString &_depthId, const QString &_profileName) |
| KoColorConversionTransformation * | createTransformationFromPath (const KoColorConversionSystem::Path &path, const KoColorSpace *srcColorSpace, const KoColorSpace *dstColorSpace, KoColorConversionTransformation::Intent renderingIntent, KoColorConversionTransformation::ConversionFlags conversionFlags) const |
| Vertex * | createVertex (Node *srcNode, Node *dstNode) |
| const KoColorSpace * | defaultColorSpaceForNode (const Node *node) const |
| void | deletePaths (QList< KoColorConversionSystem::Path * > paths) const |
| Path | findBestPath (const Node *srcNode, const Node *dstNode) const |
| Node * | insertEngine (const KoColorSpaceEngine *engine) |
| const Node * | nodeFor (const KoColorSpace *) const |
| Node * | nodeFor (const NodeKey &key) |
| const Node * | nodeFor (const NodeKey &key) const |
| Node * | nodeFor (const QString &colorModelId, const QString &colorDepthId, const QString &_profileName) |
| const Node * | nodeFor (const QString &colorModelId, const QString &colorDepthId, const QString &_profileName) const |
| QList< Node * > | nodesFor (const QString &_modelId, const QString &_depthId) |
| Vertex * | vertexBetween (Node *srcNode, Node *dstNode) |
| QString | vertexToDot (Vertex *v, const QString &options) const |
Private Attributes | |
| Private *const | d |
Friends | |
| uint | qHash (const KoColorConversionSystem::NodeKey &key) |
This class hold the logic related to pigment's Color Conversion System. It's basically a graph containing all the possible color transformation between the color spaces. The most useful functions are createColorConverter to create a color conversion between two color spaces, and insertColorSpace which is called by KoColorSpaceRegistry each time a new color space is added to the registry.
This class is not part of public API, and can be changed without notice.
Definition at line 33 of file KoColorConversionSystem.h.
| KoColorConversionSystem::KoColorConversionSystem | ( | RegistryInterface * | registryInterface | ) |
Construct a Color Conversion System, leave to the KoColorSpaceRegistry to create it.
Definition at line 22 of file KoColorConversionSystem.cpp.
| KoColorConversionSystem::~KoColorConversionSystem | ( | ) |
| QString KoColorConversionSystem::bestPathToDot | ( | const QString & | srcKey, |
| const QString & | dstKey ) const |
This function return a text that can be compiled using dot to display the graph of color conversion connection, with a red link to show the path of the best color conversion.
Definition at line 445 of file KoColorConversionSystem.cpp.
References d, findBestPath(), KoColorConversionSystem::Node::id(), p, and vertexToDot().
Initialise a node for ICC color spaces
Definition at line 34 of file KoColorConversionSystem.cpp.
References createVertex().
| KoColorConversionTransformation * KoColorConversionSystem::createColorConverter | ( | const KoColorSpace * | srcColorSpace, |
| const KoColorSpace * | dstColorSpace, | ||
| KoColorConversionTransformation::Intent | renderingIntent, | ||
| KoColorConversionTransformation::ConversionFlags | conversionFlags ) const |
This function is called by the color space to create a color conversion between two color space. This function search in the graph of transformations the best possible path between the two color space.
Definition at line 265 of file KoColorConversionSystem.cpp.
References createTransformationFromPath(), dbgPigmentCCS, KoColorConversionTransformation::dstColorSpace, findBestPath(), KoColorSpace::id, KoColorProfile::name, nodeFor(), KoColorSpace::profile(), and KoColorConversionTransformation::srcColorSpace.
| void KoColorConversionSystem::createColorConverters | ( | const KoColorSpace * | colorSpace, |
| const QList< QPair< KoID, KoID > > & | possibilities, | ||
| KoColorConversionTransformation *& | fromCS, | ||
| KoColorConversionTransformation *& | toCS ) const |
This function creates two transformations, one from the color space and one to the color space. The destination color space is picked from a list of color space, such as the conversion between the two color space is of the best quality.
The typical use case of this function is for KoColorTransformationFactory which doesn't support all color spaces, so unsupported color space have to find an acceptable conversion in order to use that KoColorTransformationFactory.
| colorSpace | the source color space |
| possibilities | a list of color space among which we need to find the best conversion |
| fromCS | the conversion from the source color space will be affected to this variable |
| toCS | the revert conversion to the source color space will be affected to this variable |
Definition at line 285 of file KoColorConversionSystem.cpp.
References KoColorSpaceFactory::colorDepthId(), KoColorSpaceFactory::colorModelId(), createTransformationFromPath(), d, defaultColorSpaceForNode(), KoColorSpaceFactory::defaultProfile(), KoColorConversionTransformation::dstColorSpace, KoColorConversionSystem::Path::endNode(), findBestPath(), KoID::id(), KoColorConversionTransformation::internalConversionFlags(), KoColorConversionTransformation::internalRenderingIntent(), KoColorConversionSystem::Path::isEmpty(), KoColorConversionSystem::Path::isGood, PathQualityChecker::isGoodPath(), PathQualityChecker::lessWorseThan(), nodeFor(), KoColorConversionSystem::Node::referenceDepth, and KoColorConversionTransformation::srcColorSpace.
|
private |
Create a new node
Definition at line 210 of file KoColorConversionSystem.cpp.
References d, KoColorConversionSystem::Node::depthId, KoColorConversionSystem::Node::modelId, and KoColorConversionSystem::Node::profileName.
|
private |
Definition at line 319 of file KoColorConversionSystem.cpp.
References KoMultipleColorConversionTransformation::appendTransfo(), KoColorSpace::colorDepthId(), KoColorSpace::colorModelId(), dbgPigmentCCS, defaultColorSpaceForNode(), and KoID::id().
|
private |
create a vertex between two nodes and return it.
Definition at line 372 of file KoColorConversionSystem.cpp.
References d, KoColorConversionSystem::Node::outputVertexes, and v.
|
private |
Query the registry to get the color space associated with this node. (default profile)
Definition at line 205 of file KoColorConversionSystem.cpp.
References d, KoColorConversionSystem::Node::depthId, KoColorConversionSystem::Node::modelId, and KoColorConversionSystem::Node::profileName.
|
private |
Delete all the paths of the list given in argument.
| bool KoColorConversionSystem::existsGoodPath | ( | const QString & | srcModelId, |
| const QString & | srcDepthId, | ||
| const QString & | srcProfileName, | ||
| const QString & | dstModelId, | ||
| const QString & | dstDepthId, | ||
| const QString & | dstProfileName ) const |
Definition at line 410 of file KoColorConversionSystem.cpp.
References findBestPath(), and nodeFor().
| bool KoColorConversionSystem::existsPath | ( | const QString & | srcModelId, |
| const QString & | srcDepthId, | ||
| const QString & | srcProfileName, | ||
| const QString & | dstModelId, | ||
| const QString & | dstDepthId, | ||
| const QString & | dstProfileName ) const |
Definition at line 397 of file KoColorConversionSystem.cpp.
References dbgPigmentCCS, findBestPath(), and nodeFor().
|
private |
looks for the best path between two nodes
Definition at line 473 of file KoColorConversionSystem.cpp.
References KoColorConversionSystem::Path::appendVertex(), KoColorConversionSystem::Path::cost, dbgPigmentCCS, KoColorConversionSystem::Path::endNode(), errorPigment, KoColorConversionSystem::Node::id(), KoColorConversionSystem::Path::isEmpty(), KoColorConversionSystem::Path::isGood, PathQualityChecker::isGoodPath(), KIS_ASSERT, KoColorConversionSystem::Path::length(), PathQualityChecker::lessWorseThan(), KoColorConversionSystem::Node::outputVertexes, p, p2, KoColorConversionSystem::Node::referenceDepth, KoColorConversionSystem::Path::referenceDepth, KoColorConversionSystem::Path::startNode(), v, and warnPigment.
| KoColorConversionSystem::Path KoColorConversionSystem::findBestPath | ( | const NodeKey & | src, |
| const NodeKey & | dst ) const |
Definition at line 433 of file KoColorConversionSystem.cpp.
References findBestPath(), KIS_ASSERT, and nodeFor().
| KoColorConversionSystem::Path KoColorConversionSystem::findBestPath | ( | const QString & | srcModelId, |
| const QString & | srcDepthId, | ||
| const QString & | srcProfileName, | ||
| const QString & | dstModelId, | ||
| const QString & | dstDepthId, | ||
| const QString & | dstProfileName ) const |
Definition at line 422 of file KoColorConversionSystem.cpp.
References findBestPath(), KIS_ASSERT, and nodeFor().
| void KoColorConversionSystem::insertColorProfile | ( | const KoColorProfile * | profile | ) |
Add a profile to the graph of transformation. The new node will be added for each known color space compatible with this profile.
Make sure you call requiredConnectionProfilesFor(profile) and add all the required connection profiles into the registry before inserting the actual profile profile. Otherwise the created node will not be able to connect itself into the graph (due to a missing connection point).
Definition at line 160 of file KoColorConversionSystem.cpp.
References KoColorSpaceFactory::colorConversionLinks(), KoColorSpaceFactory::colorConversionLinksFromProfile(), KoColorSpaceFactory::colorDepthId(), KoColorSpaceFactory::colorModelId(), KoColorSpaceFactory::colorSpaceEngine(), connectToEngine(), createVertex(), d, dbgPigmentCCS, KoColorConversionSystem::Node::depthId, KoColorConversionTransformationFactory::dstColorDepthId(), KoColorConversionTransformationFactory::dstColorModelId(), KoColorConversionTransformationFactory::dstProfile, KoGenericRegistry< T >::get(), KoID::id(), KoColorSpaceEngine::id, KoColorConversionSystem::Node::init(), KoColorSpaceEngineRegistry::instance(), KoColorConversionSystem::Node::modelId, KoColorProfile::name, nodeFor(), KoColorConversionTransformationFactory::srcColorDepthId(), KoColorConversionTransformationFactory::srcColorModelId(), KoColorConversionTransformationFactory::srcProfile, KoColorSpaceEngine::supportsColorSpace(), v, and vertexBetween().
| void KoColorConversionSystem::insertColorSpace | ( | const KoColorSpaceFactory * | csf | ) |
Add a color space to a graph of transformation. The new node will be added for each known compatible profile.
Make sure you call requiredConnectionProfilesFor(csf) and add all the required connection profiles into the registry before inserting the actual color space csf. Otherwise the created node will not be able to connect itself into the graph (due to a missing connection point).
Definition at line 77 of file KoColorConversionSystem.cpp.
References KoColorSpaceFactory::colorConversionLinks(), KoColorSpaceFactory::colorConversionLinksFromProfile(), KoColorSpaceFactory::colorDepthId(), KoColorSpaceFactory::colorModelId(), KoColorSpaceFactory::colorSpaceEngine(), connectToEngine(), createVertex(), d, dbgPigment, KoColorConversionSystem::Node::depthId, KoColorConversionTransformationFactory::dstColorDepthId(), KoColorConversionTransformationFactory::dstColorModelId(), KoColorConversionTransformationFactory::dstProfile, KoGenericRegistry< T >::get(), KoID::id(), KoColorSpaceEngine::id, KoColorSpaceFactory::id(), KoColorConversionSystem::Node::init(), insertEngine(), KoColorSpaceEngineRegistry::instance(), KoColorConversionSystem::Node::modelId, KoColorProfile::name, KoColorSpaceFactory::name(), nodeFor(), KoColorConversionTransformationFactory::srcColorDepthId(), KoColorConversionTransformationFactory::srcColorModelId(), KoColorConversionTransformationFactory::srcProfile, KoColorSpaceEngine::supportsColorSpace(), v, and vertexBetween().
|
private |
Insert an engine.
Definition at line 43 of file KoColorConversionSystem.cpp.
References d, KoColorConversionSystem::Node::depthId, KoColorSpaceEngine::id, KoColorConversionSystem::Node::init(), KoColorConversionSystem::Node::modelId, KoColorConversionSystem::Node::profileName, and KoColorConversionSystem::Node::referenceDepth.
|
private |
Definition at line 220 of file KoColorConversionSystem.cpp.
References KoColorSpace::colorDepthId(), KoColorSpace::colorModelId(), KoID::id(), KoColorProfile::name, nodeFor(), and KoColorSpace::profile().
|
private |
Definition at line 244 of file KoColorConversionSystem.cpp.
References createNode(), d, KoColorConversionSystem::NodeKey::depthId, KoColorConversionSystem::NodeKey::modelId, and KoColorConversionSystem::NodeKey::profileName.
|
private |
Definition at line 233 of file KoColorConversionSystem.cpp.
References d, dbgPigmentCCS, KoColorConversionSystem::NodeKey::depthId, KoColorConversionSystem::NodeKey::modelId, and KoColorConversionSystem::NodeKey::profileName.
|
private |
Definition at line 239 of file KoColorConversionSystem.cpp.
References nodeFor().
|
private |
Definition at line 227 of file KoColorConversionSystem.cpp.
References dbgPigmentCCS, and nodeFor().
|
private |
Definition at line 254 of file KoColorConversionSystem.cpp.
References d, KoColorConversionSystem::Node::depthId, and KoColorConversionSystem::Node::modelId.
|
inline |
Definition at line 326 of file KoColorConversionSystem_p.h.
| QList< KoColorProfileQuery > KoColorConversionSystem::requiredConnectionProfilesFor | ( | const KoColorProfile * | profile | ) |
Some color space nodes may require custom profiles to be connected to the color conversion system. I.e. Display P3 PQ space will require a Display P3 Linear profile to connect itself to the color conversion system through.
This function returns a list of such connection profiles.
Connection profiles should be requested and added to the registry before adding the profile profile into the color conversion system with insertColorProfile(csf).
Definition at line 139 of file KoColorConversionSystem.cpp.
References d, and KoColorSpaceFactory::requiredConnectionProfiles().
| QList< KoColorProfileQuery > KoColorConversionSystem::requiredConnectionProfilesFor | ( | const KoColorSpaceFactory * | csf | ) |
Some color space nodes may require custom profiles to be connected to the color conversion system. I.e. Display P3 PQ space will require a Display P3 Linear profile to connect itself to the color conversion system through.
This function returns a list of such connection profiles.
Connection profiles should be requested and added to the registry before adding the color space csf into the color conversion system with insertColorSpace(csf).
Definition at line 56 of file KoColorConversionSystem.cpp.
References d, and KoColorSpaceFactory::requiredConnectionProfiles().
| QString KoColorConversionSystem::toDot | ( | ) | const |
This function return a text that can be compiled using dot to display the graph of color conversion connection.
Definition at line 387 of file KoColorConversionSystem.cpp.
References d, and vertexToDot().
|
private |
Definition at line 362 of file KoColorConversionSystem.cpp.
References KoColorConversionSystem::Vertex::dstNode, and KoColorConversionSystem::Node::outputVertexes.
|
private |
Definition at line 382 of file KoColorConversionSystem.cpp.
References v.
|
friend |
Definition at line 319 of file KoColorConversionSystem_p.h.
|
private |
Definition at line 231 of file KoColorConversionSystem.h.
Definition at line 328 of file KoColorConversionSystem_p.h.
| RegistryInterface* KoColorConversionSystem::registryInterface |
Definition at line 330 of file KoColorConversionSystem_p.h.
Definition at line 329 of file KoColorConversionSystem_p.h.