Krita Source Code Documentation
Loading...
Searching...
No Matches
KisGamutMapClipAdjustmentFactory Class Reference

The KisGamutMapClipAdjustment class. More...

#include <kis_gamutmap_clip_adjustment.h>

+ Inheritance diagram for KisGamutMapClipAdjustmentFactory:

Public Member Functions

KoColorTransformation * createTransformation (const KoColorSpace *colorSpace, QHash< QString, QVariant > parameters) const override
 
 KisGamutMapClipAdjustmentFactory ()
 
QList< QPair< KoID, KoID > > supportedModels () const override
 
- Public Member Functions inherited from KoColorTransformationFactory
QString id () const
 
 KoColorTransformationFactory (const QString &id)
 
virtual ~KoColorTransformationFactory ()
 
- Public Member Functions inherited from Private
 Private (KisCanvas2 *c)
 

Additional Inherited Members

- Public Attributes inherited from KoColorTransformationFactory
QString id
 
- Public Attributes inherited from Private
KisCanvas2 * canvas
 
int displayedFrame
 
int intendedFrame
 

Detailed Description

The KisGamutMapClipAdjustment class.

Normally, in the ICC workflow, a profile is supossed to handle any kind of gamut mapping. This includes dealing with clipping values that are out of gamut.

This KoColorTransformation takes colors, converts them to an opponent space, like Lab or ICtCp, and then desaturates the colors until they are inside the target color gamut.

There's more complex gamut mapping algorithms available, but this particular transform focuses on simplicity and speed.

Definition at line 27 of file kis_gamutmap_clip_adjustment.h.

Constructor & Destructor Documentation

◆ KisGamutMapClipAdjustmentFactory()

KisGamutMapClipAdjustmentFactory::KisGamutMapClipAdjustmentFactory ( )

Definition at line 266 of file kis_gamutmap_clip_adjustment.cpp.

267 : KoColorTransformationFactory("gamutmap_clip_adjustment")
268{
269
270}

Member Function Documentation

◆ createTransformation()

KoColorTransformation * KisGamutMapClipAdjustmentFactory::createTransformation ( const KoColorSpace * colorSpace,
QHash< QString, QVariant > parameters ) const
overridevirtual

Implements KoColorTransformationFactory.

Definition at line 286 of file kis_gamutmap_clip_adjustment.cpp.

287{
289
290 if (colorSpace->colorModelId() == LABAColorModelID) {
292 } else if (colorSpace->colorModelId() == YCbCrAColorModelID) {
294 } else if (colorSpace->colorModelId() == XYZAColorModelID) {
295 if (parameters["mappingModel"].toInt() == KoGamutMappingUtils::OkLAB) {
297 } else {
299 }
300 } else {
301 dbgKrita << "Unsupported color space " << colorSpace->id() << " in KisGamutMapClipAdjustmentFactory::createTransformation";
302 return 0;
303 }
304
305 adj->setParameters(parameters);
306 return adj;
307}
const KoID YCbCrAColorModelID("YCbCrA", ki18n("YCbCr/Alpha"))
const KoID XYZAColorModelID("XYZA", ki18n("XYZ/Alpha"))
const KoID LABAColorModelID("LABA", ki18n("L*a*b*/Alpha"))
virtual KoID colorModelId() const =0
void setParameters(const QHash< QString, QVariant > &parameters)
#define dbgKrita
Definition kis_debug.h:49
int toInt(const QString &str, bool *ok=nullptr)

References KoColorSpace::colorModelId(), dbgKrita, KoColorSpace::id, LABAColorModelID, KoGamutMappingUtils::OkLAB, KoColorTransformation::setParameters(), XYZAColorModelID, and YCbCrAColorModelID.

◆ supportedModels()

QList< QPair< KoID, KoID > > KisGamutMapClipAdjustmentFactory::supportedModels ( ) const
overridevirtual
Returns
an empty list if the factory support all type of colorspaces models.

Implements KoColorTransformationFactory.

Definition at line 272 of file kis_gamutmap_clip_adjustment.cpp.

273{
275 l.append(QPair< KoID, KoID >(XYZAColorModelID , Float32BitsColorDepthID));
276 // While the other two work for gamut mapping, they clip HDR values.
277 l.append(QPair< KoID, KoID >(LABAColorModelID , Float32BitsColorDepthID));
278
279 // Note: Only ICtCp is really supported.
280 l.append(QPair< KoID, KoID >(YCbCrAColorModelID , Float32BitsColorDepthID));
281
282
283 return l;
284}
const KoID Float32BitsColorDepthID("F32", ki18n("32-bit float/channel"))

References Float32BitsColorDepthID, LABAColorModelID, XYZAColorModelID, and YCbCrAColorModelID.


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