Krita Source Code Documentation
Loading...
Searching...
No Matches
KoColorSpaceFactory Class Referenceabstract

#include <KoColorSpaceFactory.h>

+ Inheritance diagram for KoColorSpaceFactory:

Public Member Functions

virtual QList< KoColorConversionTransformationFactory * > colorConversionLinks () const =0
 
virtual QList< KoColorConversionTransformationFactory * > colorConversionLinksFromProfile (const KoColorProfile *profile) const
 colorConversionLinksFromProfile Sometimes, we need to generate special color conversion links based on the properties of the profile. The Perceptual Quantizer profiles are an example of this. This function is called inside the color conversion system.
 
virtual KoID colorDepthId () const =0
 
virtual KoID colorModelId () const =0
 
virtual QString colorSpaceEngine () const =0
 
virtual KoColorProfilecreateColorProfile (const QByteArray &rawData) const =0
 
virtual int crossingCost () const =0
 
virtual QString defaultProfile () const =0
 
const KoColorSpacegrabColorSpace (const KoColorProfile *profile)
 
virtual QString id () const =0
 
virtual bool isHdr () const =0
 
virtual QString name () const =0
 
virtual bool profileIsCompatible (const KoColorProfile *profile) const =0
 
virtual int referenceDepth () const =0
 
virtual QList< KoColorProfileQueryrequiredConnectionProfiles (const KoColorProfile *profile) const
 
virtual bool userVisible () const =0
 
virtual ~KoColorSpaceFactory ()
 
- Public Member Functions inherited from Private
 Private (KisCanvas2 *c)
 

Public Attributes

QHash< QString, KoColorSpace * > availableColorspaces
 
QMutex mutex
 
QHash< KoColorSpace *, QString > stackInformation
 
- Public Attributes inherited from Private
KisCanvas2canvas
 
int displayedFrame
 
int intendedFrame
 

Protected Member Functions

virtual KoColorSpacecreateColorSpace (const KoColorProfile *) const =0
 
 KoColorSpaceFactory ()
 

Private Attributes

Private *const d
 

Detailed Description

This class is used to create color spaces.

Definition at line 21 of file KoColorSpaceFactory.cpp.

Constructor & Destructor Documentation

◆ KoColorSpaceFactory()

KoColorSpaceFactory::KoColorSpaceFactory ( )
protected

Definition at line 29 of file KoColorSpaceFactory.cpp.

29 : d(new Private)
30{
31}

◆ ~KoColorSpaceFactory()

KoColorSpaceFactory::~KoColorSpaceFactory ( )
virtual

Definition at line 33 of file KoColorSpaceFactory.cpp.

34{
35#ifndef NDEBUG
36 // Check that all color spaces have been released
37 int count = 0;
38 count += d->availableColorspaces.size();
39
40 for(QHash<KoColorSpace*, QString>::const_iterator it = d->stackInformation.constBegin();
41 it != d->stackInformation.constEnd(); ++it)
42 {
43 errorPigment << "*******************************************";
44 errorPigment << it.key()->id() << " still in used, and grabbed in: ";
45 errorPigment << it.value();
46 }
47#endif
48 delete d;
49}
#define errorPigment

References d, and errorPigment.

Member Function Documentation

◆ colorConversionLinks()

virtual QList< KoColorConversionTransformationFactory * > KoColorSpaceFactory::colorConversionLinks ( ) const
pure virtual
Returns
the list of color conversion provided by this colorspace, the factories constructed by this functions are owned by the caller of the function

Implemented in KoAlphaColorSpaceFactoryImpl< _CSTrait >, KoSimpleColorSpaceFactory, and LcmsColorSpaceFactory.

◆ colorConversionLinksFromProfile()

virtual QList< KoColorConversionTransformationFactory * > KoColorSpaceFactory::colorConversionLinksFromProfile ( const KoColorProfile * profile) const
inlinevirtual

colorConversionLinksFromProfile Sometimes, we need to generate special color conversion links based on the properties of the profile. The Perceptual Quantizer profiles are an example of this. This function is called inside the color conversion system.

Parameters
profile– the profile for which to create the links for.

Reimplemented in RgbF16ColorSpaceFactory, RgbF32ColorSpaceFactory, RgbU16ColorSpaceFactory, and RgbU8ColorSpaceFactory.

Definition at line 121 of file KoColorSpaceFactory.h.

121 {
122 Q_UNUSED(profile)
124 }

◆ colorDepthId()

◆ colorModelId()

◆ colorSpaceEngine()

virtual QString KoColorSpaceFactory::colorSpaceEngine ( ) const
pure virtual
Returns
the name of the color space engine for this color space, or "" if none

Implemented in KoSimpleColorSpaceFactory, and LcmsColorSpaceFactory.

◆ createColorProfile()

virtual KoColorProfile * KoColorSpaceFactory::createColorProfile ( const QByteArray & rawData) const
pure virtual

Create a color profile from a memory array, if possible, otherwise return 0.

Implemented in KoSimpleColorSpaceFactory, and LcmsColorSpaceFactory.

◆ createColorSpace()

◆ crossingCost()

virtual int KoColorSpaceFactory::crossingCost ( ) const
pure virtual
Returns
the cost of the usage of the colorspace in the conversion graph. The higher the cost, the less probably the color space will be chosen for the conversion.

Implemented in KoSimpleColorSpaceFactory, and LcmsColorSpaceFactory.

◆ defaultProfile()

◆ grabColorSpace()

const KoColorSpace * KoColorSpaceFactory::grabColorSpace ( const KoColorProfile * profile)

Create or reuse the existing colorspace for the given profile.

This will call the descendant's createColorSpace

Definition at line 51 of file KoColorSpaceFactory.cpp.

52{
53 QMutexLocker l(&d->mutex);
54 Q_ASSERT(profile);
55 auto it = d->availableColorspaces.find(profile->name());
56 KoColorSpace* cs;
57
58 if (it == d->availableColorspaces.end()) {
59 cs = createColorSpace(profile);
60 KIS_ASSERT_X(cs != nullptr, "KoColorSpaceFactory::grabColorSpace", "createColorSpace returned nullptr.");
61 if (cs) {
62 d->availableColorspaces[profile->name()] = cs;
63 }
64 }
65 else {
66 cs = it.value();
67 }
68
69 return cs;
70}
#define KIS_ASSERT_X(cond, where, what)
Definition kis_assert.h:40
virtual KoColorSpace * createColorSpace(const KoColorProfile *) const =0

References createColorSpace(), d, KIS_ASSERT_X, and KoColorProfile::name.

◆ id()

◆ isHdr()

◆ name()

◆ profileIsCompatible()

virtual bool KoColorSpaceFactory::profileIsCompatible ( const KoColorProfile * profile) const
pure virtual
Parameters
profilea pointer to a color profile
Returns
true if the color profile can be used by a color space created by this factory

Implemented in KoSimpleColorSpaceFactory, and LcmsColorSpaceFactory.

◆ referenceDepth()

virtual int KoColorSpaceFactory::referenceDepth ( ) const
pure virtual
Returns
the reference depth, that is for a color space where all channels have the same depth, this is the depth of one channel, for a color space with different bit depth for each channel, it's usually the highest bit depth. This value is used by the Color Conversion System to check if a lost of bit depth during a color conversion is acceptable, for instance when converting from RGB32bit to XYZ16bit, it's acceptable to go through a conversion to RGB16bit, while it's not the case for RGB32bit to XYZ32bit.

Implemented in KoSimpleColorSpaceFactory, CmykF32ColorSpaceFactory, CmykU16ColorSpaceFactory, CmykU8ColorSpaceFactory, GrayF16ColorSpaceFactory, GrayF32ColorSpaceFactory, GrayAU16ColorSpaceFactory, GrayAU8ColorSpaceFactory, LabF32ColorSpaceFactory, LabU16ColorSpaceFactory, LabU8ColorSpaceFactory, RgbF16ColorSpaceFactory, RgbF32ColorSpaceFactory, RgbU16ColorSpaceFactory, RgbU8ColorSpaceFactory, XyzF16ColorSpaceFactory, XyzF32ColorSpaceFactory, XyzU16ColorSpaceFactory, XyzU8ColorSpaceFactory, YCbCrF32ColorSpaceFactory, YCbCrU16ColorSpaceFactory, and YCbCrU8ColorSpaceFactory.

◆ requiredConnectionProfiles()

QList< KoColorProfileQuery > KoColorSpaceFactory::requiredConnectionProfiles ( const KoColorProfile * profile) const
virtual

Reimplemented in RgbF16ColorSpaceFactory, RgbF32ColorSpaceFactory, RgbU16ColorSpaceFactory, and RgbU8ColorSpaceFactory.

Definition at line 72 of file KoColorSpaceFactory.cpp.

73{
74 Q_UNUSED(profile)
75 return {};
76}

◆ userVisible()

Member Data Documentation

◆ availableColorspaces

QHash<QString, KoColorSpace* > KoColorSpaceFactory::availableColorspaces

Definition at line 22 of file KoColorSpaceFactory.cpp.

◆ d

Private* const KoColorSpaceFactory::d
private

Definition at line 135 of file KoColorSpaceFactory.h.

◆ mutex

QMutex KoColorSpaceFactory::mutex

Definition at line 23 of file KoColorSpaceFactory.cpp.

◆ stackInformation

QHash<KoColorSpace*, QString> KoColorSpaceFactory::stackInformation

Definition at line 25 of file KoColorSpaceFactory.cpp.


The documentation for this class was generated from the following files: