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

#include <KisToneGamutMapFilter.h>

+ Inheritance diagram for KisToneGamutMapFilter:

Public Member Functions

KisConfigWidget * createConfigurationWidget (QWidget *parent, const KisPaintDeviceSP dev, bool useForMasks) const override
 
KoColorTransformation * createTransformation (const KoColorSpace *cs, const KisFilterConfigurationSP config) const override
 
KisFilterConfigurationSP defaultConfiguration (KisResourcesInterfaceSP resourcesInterface) const override
 
 KisToneGamutMapFilter ()
 
- Public Member Functions inherited from KisColorTransformationFilter
KisFilterConfigurationSP factoryConfiguration (KisResourcesInterfaceSP resourcesInterface) const override
 
 KisColorTransformationFilter (const KoID &id, const KoID &category, const QString &entry)
 
void processImpl (KisPaintDeviceSP device, const QRect &applyRect, const KisFilterConfigurationSP config, KoUpdater *progressUpdater) const override
 
 ~KisColorTransformationFilter () override
 
- Public Member Functions inherited from KisFilter
virtual QRect changedRect (const QRect &rect, const KisFilterConfigurationSP config, int lod) const
 
virtual bool configurationAllowedForMask (KisFilterConfigurationSP config) const
 
virtual void fixLoadedFilterConfigurationForMasks (KisFilterConfigurationSP config) const
 
 KisFilter (const KoID &id, const KoID &category, const QString &entry)
 
virtual QRect neededRect (const QRect &rect, const KisFilterConfigurationSP config, int lod) const
 
virtual bool needsTransparentPixels (const KisFilterConfigurationSP config, const KoColorSpace *cs) const
 
void process (const KisPaintDeviceSP src, KisPaintDeviceSP dst, KisSelectionSP selection, const QRect &applyRect, const KisFilterConfigurationSP config, KoUpdater *progressUpdater=0) const
 
void process (KisPaintDeviceSP device, const QRect &applyRect, const KisFilterConfigurationSP config, KoUpdater *progressUpdater=0) const
 
virtual bool supportsLevelOfDetail (const KisFilterConfigurationSP config, int lod) const
 
 ~KisFilter () override
 
- Public Member Functions inherited from KisBaseProcessor
KisBookmarkedConfigurationManager * bookmarkManager ()
 
const KisBookmarkedConfigurationManager * bookmarkManager () const
 
ColorSpaceIndependence colorSpaceIndependence () const
 
QString id () const
 
 KisBaseProcessor (const KoID &id, const KoID &category, const QString &entry)
 
KoID menuCategory () const
 
QString menuEntry () const
 
QString name () const
 
 Private ()
 
QKeySequence shortcut () const
 
bool showConfigurationWidget ()
 If true, the filter wants to show a configuration widget.
 
bool supportsAdjustmentLayers () const
 This filter can be used in adjustment layers.
 
bool supportsPainting () const
 
bool supportsThreading () const
 
virtual ~KisBaseProcessor ()
 
- Public Member Functions inherited from Private
 Private (KisCanvas2 *c)
 
- Public Member Functions inherited from KisShared
bool deref ()
 
bool ref ()
 
int refCount ()
 
QAtomicInt * sharedWeakReference ()
 

Static Public Member Functions

static KoID id ()
 

Additional Inherited Members

- Public Attributes inherited from KisBaseProcessor
KisBookmarkedConfigurationManager * bookmarkManager
 
KoID category
 
ColorSpaceIndependence colorSpaceIndependence
 
QString entry
 
KoID id
 
QKeySequence shortcut
 
bool showConfigurationWidget
 
bool supportsAdjustmentLayers
 
bool supportsPainting
 
bool supportsThreading
 
- Public Attributes inherited from Private
KisCanvas2 * canvas
 
int displayedFrame
 
int intendedFrame
 
- Protected Member Functions inherited from KisFilter
QString configEntryGroup () const
 
void setSupportsLevelOfDetail (bool value)
 
- Protected Member Functions inherited from KisBaseProcessor
void init (const QString &configEntryGroup)
 
void setColorSpaceIndependence (ColorSpaceIndependence v)
 
void setShortcut (const QKeySequence &shortcut)
 
void setShowConfigurationWidget (bool v)
 
void setSupportsAdjustmentLayers (bool v)
 
void setSupportsPainting (bool v)
 
void setSupportsThreading (bool v)
 
- Protected Member Functions inherited from KisShared
 KisShared ()
 
 ~KisShared ()
 

Detailed Description

Definition at line 20 of file KisToneGamutMapFilter.h.

Constructor & Destructor Documentation

◆ KisToneGamutMapFilter()

KisToneGamutMapFilter::KisToneGamutMapFilter ( )

While as a colortransformation this filter supports threading, Adjustment layers and painting are disabled for two reasons:

  1. There's a ton of different tone and gamut mapping algorithms. This way, we avoid being tied to a specific one, and can experiment.
  2. Some of these implementations are very slow, and thus not suited for dynamic updating.

Definition at line 55 of file KisToneGamutMapFilter.cpp.

56 : KisColorTransformationFilter(id(), FiltersCategoryColorId, i18n("Tone/Gamut Map..."))
57{
59
69}
KisColorTransformationFilter(const KoID &id, const KoID &category, const QString &entry)
const KoID FiltersCategoryColorId("color_filters", ki18nc("The category of color transfer filters, like color to alpha. Noun.", "Colors"))
void setSupportsThreading(bool v)
void setSupportsAdjustmentLayers(bool v)
void setSupportsPainting(bool v)

References KisBaseProcessor::setSupportsAdjustmentLayers(), KisBaseProcessor::setSupportsPainting(), and KisBaseProcessor::setSupportsThreading().

Member Function Documentation

◆ createConfigurationWidget()

KisConfigWidget * KisToneGamutMapFilter::createConfigurationWidget ( QWidget * parent,
const KisPaintDeviceSP dev,
bool useForMasks ) const
overridevirtual

Create the configuration widget for this processor.

Parameters
parentthe Qt owner widget of this widget
devthe paintdevice this filter will act on
useForMasksshown if the filer is going to be used in a mask. Some filters may provide limited options when applied as a mask (e.g. Gaussian Blur)

Reimplemented from KisBaseProcessor.

Definition at line 138 of file KisToneGamutMapFilter.cpp.

139{
140 Q_UNUSED(useForMasks)
141 return new KisToneGamutMapWidget(parent, dev);
142}

◆ createTransformation()

KoColorTransformation * KisToneGamutMapFilter::createTransformation ( const KoColorSpace * cs,
const KisFilterConfigurationSP config ) const
overridevirtual

Create the color transformation that will be applied on the device.

Implements KisColorTransformationFilter.

Definition at line 71 of file KisToneGamutMapFilter.cpp.

72{
74 if (config->getProperty(MAPPING_MODEL).toInt() != KoGamutMappingUtils::LAB) {
76 }
78
79 if (config->getProperty(TONE_MAP_ENABLED).toBool()) {
80 QHash<QString, QVariant> params;
81 params["CurveType"] = config->getProperty(TONE_MAP_TYPE);
82
83 params["maxWhite"] = config->getProperty(TONE_MAP_MAX_WHITE);
84
85 params["toeStrength"] = config->getProperty(TONE_PIECE_WISE_TOE_STRENGTH);
86 params["toeLength"] = config->getProperty(TONE_PIECE_WISE_TOE_LENGTH);
87 params["shoulderStrength"] = config->getProperty(TONE_PIECE_WISE_SHOULDER_STRENGTH);
88 params["shoulderLength"] = config->getProperty(TONE_PIECE_WISE_SHOULDER_LENGTH);
89 params["shoulderAngle"] = config->getProperty(TONE_PIECE_WISE_SHOULDER_ANGLE);
90 KoColorTransformation *toneMap = mappingCs->createColorTransformation("tonemap_adjustment", params);
91 allTransforms << toneMap;
92 }
93
94 if (config->getProperty(GAMUT_MAP_ENABLED).toBool()) {
95 QHash<QString, QVariant> params;
96 params["targetColorProfileName"] = config->getProperty(GAMUT_MAP_TARGET_PROFILE);
97
98 const KoColorProfile *targetProfile = KoColorSpaceRegistry::instance()->profileByName(config->getProperty(GAMUT_MAP_TARGET_PROFILE).toString());
99 if (targetProfile && config->getProperty(GAMUT_MAP_METHOD).toString() == "CUSP_MAP") {
100 QVariantMap cuspDescription;
101 QMap<float, QPointF> tempCuspDescription = KoGamutMappingUtils::getGamutCuspDescription(targetProfile, KoGamutMappingUtils::MappingModel(config->getProperty(MAPPING_MODEL).toInt()));
102 if (!tempCuspDescription.isEmpty()) {
103 Q_FOREACH(const float key, tempCuspDescription.keys()) {
104 cuspDescription.insert(QString::number(key), tempCuspDescription.value(key));
105 }
106 params["cuspDescription"] = cuspDescription;
107 }
108 }
109
110 params["mappingModel"] = config->getProperty(MAPPING_MODEL);
111 KoColorTransformation *gamutMap = mappingCs->createColorTransformation("gamutmap_clip_adjustment", params);
112 allTransforms << gamutMap;
113 }
114
115 if (allTransforms.isEmpty()) return nullptr;
116
118}
const QString GAMUT_MAP_METHOD
const QString GAMUT_MAP_ENABLED
bool, whether to do gamt mapping.
const QString TONE_PIECE_WISE_SHOULDER_ANGLE
const QString MAPPING_MODEL
Enum, model in which the gamut or tone mapping is done.
const QString TONE_MAP_MAX_WHITE
double, the maximum white that needs to be tonemapped.
const QString TONE_PIECE_WISE_SHOULDER_STRENGTH
const QString GAMUT_MAP_TARGET_PROFILE
QString, name of the color profile that is the target gamut.
const QString TONE_PIECE_WISE_TOE_LENGTH
const QString TONE_MAP_ENABLED
bool, whether to do tone mapping.
const QString TONE_PIECE_WISE_SHOULDER_LENGTH
const QString TONE_MAP_TYPE
String, indicates whether to use the cusp map or the MINDE method.
const QString TONE_PIECE_WISE_TOE_STRENGTH
const KoID Float32BitsColorDepthID("F32", ki18n("32-bit float/channel"))
const KoID XYZAColorModelID("XYZA", ki18n("XYZ/Alpha"))
const KoID LABAColorModelID("LABA", ki18n("L*a*b*/Alpha"))
KoColorTransformation * createColorTransformation(const QString &id, const QHash< QString, QVariant > &parameters) const
QString id() const
Definition KoID.cpp:63
QMap< float, QPointF > KRITAPIGMENT_EXPORT getGamutCuspDescription(const KoColorProfile *profile, KoGamutMappingUtils::MappingModel model, const int samplesPerChannel=5)
getGamutCuspDescription Generates a hexagonal gamut cusp description from a RGB or CMYK profile.
MappingModel
The MappingModel enum This represents the preferred model to do gamut and/or tone mapping in.
const KoColorProfile * profileByName(const QString &name) const
const KoColorSpace * colorSpace(const QString &colorModelId, const QString &colorDepthId, const KoColorProfile *profile)
static KoColorSpaceRegistry * instance()
static KoColorTransformation * createOptimizedCompositeTransform(const QVector< KoColorTransformation * > transforms)

References KoColorSpaceRegistry::colorSpace(), KoColorSpace::createColorTransformation(), KoCompositeColorTransformation::createOptimizedCompositeTransform(), Float32BitsColorDepthID, GAMUT_MAP_ENABLED, GAMUT_MAP_METHOD, GAMUT_MAP_TARGET_PROFILE, KoGamutMappingUtils::getGamutCuspDescription(), KoID::id(), KoColorSpaceRegistry::instance(), KoGamutMappingUtils::LAB, LABAColorModelID, MAPPING_MODEL, KoColorSpaceRegistry::profileByName(), TONE_MAP_ENABLED, TONE_MAP_MAX_WHITE, TONE_MAP_TYPE, TONE_PIECE_WISE_SHOULDER_ANGLE, TONE_PIECE_WISE_SHOULDER_LENGTH, TONE_PIECE_WISE_SHOULDER_STRENGTH, TONE_PIECE_WISE_TOE_LENGTH, TONE_PIECE_WISE_TOE_STRENGTH, and XYZAColorModelID.

◆ defaultConfiguration()

KisFilterConfigurationSP KisToneGamutMapFilter::defaultConfiguration ( KisResourcesInterfaceSP resourcesInterface) const
overridevirtual

Return the configuration set as the default by the user or the default configuration from the filter writer as returned by factoryConfiguration.

This configuration is used by default for the configuration widget and given to the process function if there is no configuration widget.

Returns
the default configuration of this widget

Reimplemented from KisBaseProcessor.

Definition at line 120 of file KisToneGamutMapFilter.cpp.

121{
122 KisFilterConfigurationSP config = factoryConfiguration(resourcesInterface);
123 config->setProperty(TONE_MAP_ENABLED, true);
124 config->setProperty(TONE_MAP_MAX_WHITE, 1.0);
125
126 config->setProperty(TONE_PIECE_WISE_TOE_STRENGTH, 0.5);
127 config->setProperty(TONE_PIECE_WISE_TOE_LENGTH, 0.5);
128 config->setProperty(TONE_PIECE_WISE_SHOULDER_STRENGTH, 0.5);
129 config->setProperty(TONE_PIECE_WISE_SHOULDER_LENGTH, 2.0);
130 config->setProperty(TONE_PIECE_WISE_SHOULDER_ANGLE, 1.0);
131
132 config->setProperty(GAMUT_MAP_ENABLED, true);
133 config->setProperty(GAMUT_MAP_METHOD, "CUSP_MAP");
134 config->setProperty(GAMUT_MAP_TARGET_PROFILE, "sRGB-elle-V2-srgbtrc.icc");
135 return config;
136}
KisFilterConfigurationSP factoryConfiguration(KisResourcesInterfaceSP resourcesInterface) const override

References KisColorTransformationFilter::factoryConfiguration(), GAMUT_MAP_ENABLED, GAMUT_MAP_METHOD, GAMUT_MAP_TARGET_PROFILE, TONE_MAP_ENABLED, TONE_MAP_MAX_WHITE, TONE_PIECE_WISE_SHOULDER_ANGLE, TONE_PIECE_WISE_SHOULDER_LENGTH, TONE_PIECE_WISE_SHOULDER_STRENGTH, TONE_PIECE_WISE_TOE_LENGTH, and TONE_PIECE_WISE_TOE_STRENGTH.

◆ id()

static KoID KisToneGamutMapFilter::id ( )
inlinestatic

Definition at line 27 of file KisToneGamutMapFilter.h.

27 {
28 return KoID("tone_gamut_map", i18n("Tone/Gamut Map"));
29 }
Definition KoID.h:30

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