|
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 *) |
| void | insertColorSpace (const KoColorSpaceFactory *) |
| KoColorConversionSystem (RegistryInterface *registryInterface) | |
| Private (RegistryInterface *_registryInterface) | |
| 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 32 of file KoColorConversionSystem.h.
| KoColorConversionSystem::KoColorConversionSystem | ( | RegistryInterface * | registryInterface | ) |
Construct a Color Conversion System, leave to the KoColorSpaceRegistry to create it.
Definition at line 21 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 400 of file KoColorConversionSystem.cpp.
References d, findBestPath(), KoColorConversionSystem::Node::id(), p, and vertexToDot().
Initialise a node for ICC color spaces
Definition at line 33 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 220 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 240 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 165 of file KoColorConversionSystem.cpp.
References d, KoColorConversionSystem::Node::depthId, KoColorConversionSystem::Node::modelId, and KoColorConversionSystem::Node::profileName.
|
private |
Definition at line 274 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 327 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 160 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 365 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 352 of file KoColorConversionSystem.cpp.
References dbgPigmentCCS, findBestPath(), and nodeFor().
|
private |
looks for the best path between two nodes
Definition at line 428 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 388 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 377 of file KoColorConversionSystem.cpp.
References findBestPath(), KIS_ASSERT, and nodeFor().
| void KoColorConversionSystem::insertColorProfile | ( | const KoColorProfile * | _profile | ) |
Definition at line 116 of file KoColorConversionSystem.cpp.
References KoColorSpaceFactory::colorConversionLinks(), 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 | ) |
This function is called by the KoColorSpaceRegistry to add a new color space to the graph of transformation.
Definition at line 56 of file KoColorConversionSystem.cpp.
References KoColorSpaceFactory::colorConversionLinks(), 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 42 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 175 of file KoColorConversionSystem.cpp.
References KoColorSpace::colorDepthId(), KoColorSpace::colorModelId(), KoID::id(), KoColorProfile::name, nodeFor(), and KoColorSpace::profile().
|
private |
Definition at line 199 of file KoColorConversionSystem.cpp.
References createNode(), d, KoColorConversionSystem::NodeKey::depthId, KoColorConversionSystem::NodeKey::modelId, and KoColorConversionSystem::NodeKey::profileName.
|
private |
Definition at line 188 of file KoColorConversionSystem.cpp.
References d, dbgPigmentCCS, KoColorConversionSystem::NodeKey::depthId, KoColorConversionSystem::NodeKey::modelId, and KoColorConversionSystem::NodeKey::profileName.
|
private |
Definition at line 194 of file KoColorConversionSystem.cpp.
References nodeFor().
|
private |
Definition at line 182 of file KoColorConversionSystem.cpp.
References dbgPigmentCCS, and nodeFor().
|
private |
Definition at line 209 of file KoColorConversionSystem.cpp.
References d, KoColorConversionSystem::Node::depthId, and KoColorConversionSystem::Node::modelId.
|
inline |
Definition at line 326 of file KoColorConversionSystem_p.h.
| 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 342 of file KoColorConversionSystem.cpp.
References d, and vertexToDot().
|
private |
Definition at line 317 of file KoColorConversionSystem.cpp.
References KoColorConversionSystem::Vertex::dstNode, and KoColorConversionSystem::Node::outputVertexes.
|
private |
Definition at line 337 of file KoColorConversionSystem.cpp.
References v.
|
friend |
Definition at line 319 of file KoColorConversionSystem_p.h.
|
private |
Definition at line 176 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.