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

#include <KisToneGamutMapFilter.h>

+ Inheritance diagram for KisToneGamutMapWidget:

Public Member Functions

KisPropertiesConfigurationSP configuration () const
 
 KisToneGamutMapWidget (QWidget *parent, KisPaintDeviceSP dev)
 
void setConfiguration (const KisPropertiesConfigurationSP config)
 
 ~KisToneGamutMapWidget ()
 
- Public Member Functions inherited from KisConfigWidget
virtual KoCanvasResourcesInterfaceSP canvasResourcesInterface () const
 
virtual void setCanvasResourcesInterface (KoCanvasResourcesInterfaceSP canvasResourcesInterface)
 
virtual void setView (KisViewManager *view)
 
 ~KisConfigWidget () override
 

Private Attributes

Ui::KisToneGamutMapWidget * ui
 

Additional Inherited Members

- Signals inherited from KisConfigWidget
void sigConfigurationItemChanged ()
 
void sigConfigurationUpdated ()
 
void sigDropLockedConfig (KisPropertiesConfigurationSP p)
 
void sigSaveLockedConfig (KisPropertiesConfigurationSP p)
 
- Protected Member Functions inherited from KisConfigWidget
 KisConfigWidget (QWidget *parent=0, Qt::WindowFlags f=Qt::WindowFlags(), int delay=200)
 

Detailed Description

Definition at line 40 of file KisToneGamutMapFilter.h.

Constructor & Destructor Documentation

◆ KisToneGamutMapWidget()

KisToneGamutMapWidget::KisToneGamutMapWidget ( QWidget * parent,
KisPaintDeviceSP dev )
explicit

Definition at line 145 of file KisToneGamutMapFilter.cpp.

146 : KisConfigWidget(parent)
147 , ui(new Ui::KisToneGamutMapWidget)
148{
149 Q_ASSERT(dev);
150 ui->setupUi(this);
151
152 ui->targetGamut->showDepth(false);
153 ui->targetGamut->showColorBrowserButton(false);
154
155 ui->cmbMappingModel->addItem(i18n("LAB"), KoGamutMappingUtils::LAB);
156 ui->cmbMappingModel->addItem(i18n("XYZ (ICtCp)"), KoGamutMappingUtils::ICtCp);
157 ui->cmbMappingModel->addItem(i18n("XYZ (OkLAB)"), KoGamutMappingUtils::OkLAB);
158
159 ui->cmbToneCurveType->addItem(i18n("Reinhard"), KoGamutMappingUtils::Reinhard);
160 ui->cmbToneCurveType->addItem(i18n("Piecewise Filmic"), KoGamutMappingUtils::PiecewiseFilmic);
161
162 ui->cmbGamutMapMethod->addItem(i18n("Use Chroma-Lightness Cusp Map"), "CUSP_MAP");
163 ui->cmbGamutMapMethod->addItem(i18n("Minimum Delta E"), "MINDE");
164
165 ui->cmbGamutMapMethod->setItemData(0, i18nc("@info:tooltip", "Use a chroma-lightness cusp map for a faster,"
166 " if more inaccurate gamut mapping. Only works for RGB and CMYK profiles,"
167 " will fall back on Minimum Delta E."), Qt::ToolTipRole);
168 ui->cmbGamutMapMethod->setItemData(1, i18nc("@info:tooltip", "Will use the Minimum Delta E method,"
169 " where colors are brought into gamut until they minimally different from the transformed color."
170 " Slow but accurate."), Qt::ToolTipRole);
171
172 connect(ui->cmbMappingModel, SIGNAL(activated(int)), SIGNAL(sigConfigurationItemChanged()));
173 connect(ui->cmbToneCurveType, SIGNAL(activated(int)), ui->stkToneMap, SLOT(setCurrentIndex(int)));
174 connect(ui->cmbToneCurveType, SIGNAL(activated(int)), SIGNAL(sigConfigurationItemChanged()));
175
176 connect(ui->chkToneMap, SIGNAL(toggled(bool)), SIGNAL(sigConfigurationItemChanged()));
177
178 connect(ui->spnMaxWhite, SIGNAL(valueChanged(double)), SIGNAL(sigConfigurationItemChanged()));
179
180 connect(ui->spnToeStrength, SIGNAL(valueChanged(double)), SIGNAL(sigConfigurationItemChanged()));
181 connect(ui->spnToeLength, SIGNAL(valueChanged(double)), SIGNAL(sigConfigurationItemChanged()));
182 connect(ui->spnShoulderStrength, SIGNAL(valueChanged(double)), SIGNAL(sigConfigurationItemChanged()));
183 connect(ui->spnShoulderLength, SIGNAL(valueChanged(double)), SIGNAL(sigConfigurationItemChanged()));
184 connect(ui->spnShoulderAngle, SIGNAL(valueChanged(double)), SIGNAL(sigConfigurationItemChanged()));
185
186 connect(ui->chkGamutMap, SIGNAL(toggled(bool)), SIGNAL(sigConfigurationItemChanged()));
187 connect(ui->targetGamut, SIGNAL(colorSpaceChanged(const KoColorSpace*)), SIGNAL(sigConfigurationItemChanged()));
188 connect(ui->cmbGamutMapMethod, SIGNAL(activated(int)), SIGNAL(sigConfigurationItemChanged()));
189
190 QStringList yAxisValues;
191 for (int i = 0; i < 10; i++) {
192 yAxisValues << QString::number(float(i)/10.0, 'f', 1);
193 }
194 ui->toneCurvePreview->setYAxisValues(yAxisValues, 64);
195
196}
void sigConfigurationItemChanged()
KisConfigWidget(QWidget *parent=0, Qt::WindowFlags f=Qt::WindowFlags(), int delay=200)
Ui::KisToneGamutMapWidget * ui

References KoGamutMappingUtils::ICtCp, KoGamutMappingUtils::LAB, KoGamutMappingUtils::OkLAB, KoGamutMappingUtils::PiecewiseFilmic, KoGamutMappingUtils::Reinhard, KisConfigWidget::sigConfigurationItemChanged(), and ui.

◆ ~KisToneGamutMapWidget()

KisToneGamutMapWidget::~KisToneGamutMapWidget ( )

Definition at line 198 of file KisToneGamutMapFilter.cpp.

199{
200 delete ui;
201}

References ui.

Member Function Documentation

◆ configuration()

KisPropertiesConfigurationSP KisToneGamutMapWidget::configuration ( ) const
virtual
Returns
the configuration

Implements KisConfigWidget.

Definition at line 255 of file KisToneGamutMapFilter.cpp.

256{
258 config->setProperty(MAPPING_MODEL, ui->cmbMappingModel->currentData());
259
260 config->setProperty(TONE_MAP_ENABLED, ui->chkToneMap->isChecked());
261 config->setProperty(TONE_MAP_MAX_WHITE, ui->spnMaxWhite->value());
262
263 config->setProperty(TONE_MAP_TYPE, ui->cmbToneCurveType->currentData());
264
265 config->setProperty(TONE_PIECE_WISE_TOE_STRENGTH, ui->spnToeStrength->value());
266 config->setProperty(TONE_PIECE_WISE_TOE_LENGTH, ui->spnToeLength->value());
267 config->setProperty(TONE_PIECE_WISE_SHOULDER_STRENGTH, ui->spnShoulderStrength->value());
268 config->setProperty(TONE_PIECE_WISE_SHOULDER_LENGTH, ui->spnShoulderLength->value());
269 config->setProperty(TONE_PIECE_WISE_SHOULDER_ANGLE, ui->spnShoulderAngle->value());
270
271
272 if (ui->cmbToneCurveType->currentData() == KoGamutMappingUtils::PiecewiseFilmic) {
274 = KoGamutMappingUtils::PiecewiseFilmicCurve::fromUserParams(ui->spnToeStrength->value(), ui->spnToeLength->value(), ui->spnShoulderStrength->value(), ui->spnShoulderLength->value(), ui->spnShoulderAngle->value());
275 QPolygonF poly;
276 const float white = 1.0/curve.inverseMaxWhite;
277 QStringList xAxisValues;
278 for (int x = 0; x < 20; x++) {
279 const float val = (float(x)/19.0)*white;
280 const float y = curve.evalCurve(val);
281 if (x%2 == 0) {
282 xAxisValues << QString::number(val, 'f', 1);
283
284 }
285 poly.append(QPointF(val/white, y));
286 }
287 ui->toneCurvePreview->setGreyscaleCurve(poly);
288 ui->toneCurvePreview->setProfileDataAvailable(true);
289 ui->toneCurvePreview->setToolTip(i18n("Current Maximum White: %1", QString::number(white, 'f', 2)));
290 ui->toneCurvePreview->setXAxisValues(xAxisValues);
291 ui->toneCurvePreview->update();
292 } else {
293 QPolygonF poly;
294 const float white = ui->spnMaxWhite->value();
295 QStringList xAxisValues;
296 for (int x = 0; x < 20; x++) {
297 const float val = (float(x)/19.0)*white;
298 const float y = KoGamutMappingUtils::reinhardToneMapping(val, white);
299 if (x%2 == 0) {
300 xAxisValues << QString::number(val, 'f', 1);
301 }
302 poly.append(QPointF(val/white, y));
303 }
304 ui->toneCurvePreview->setGreyscaleCurve(poly);
305 ui->toneCurvePreview->setProfileDataAvailable(true);
306 ui->toneCurvePreview->setToolTip(i18n("Current Maximum White: %1", QString::number(white, 'f', 2)));
307 ui->toneCurvePreview->setXAxisValues(xAxisValues);
308 ui->toneCurvePreview->update();
309 }
310
311 config->setProperty(GAMUT_MAP_ENABLED, ui->chkGamutMap->isChecked());
312 if (ui->targetGamut->currentColorSpace()) {
313 config->setProperty(GAMUT_MAP_TARGET_PROFILE, ui->targetGamut->currentColorSpace()->profile()->name());
314 }
315 config->setProperty(GAMUT_MAP_METHOD, ui->cmbGamutMapMethod->currentData());
316 return config;
317}
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
static KisResourcesInterfaceSP instance()
float KRITAPIGMENT_EXPORT reinhardToneMapping(const float linearY, const float maxY)
reinhardToneMapping Implements 'extended' reinhard tonemapping.
The piecewiseFilmicCurve class Implement's Hable's piecewise filmic curve. https://filmicworlds....
static PiecewiseFilmicCurve fromUserParams(float toeStrength=0.5, float toeLength=0.5, float shoulderStrength=2.0, float shoulderLength=0.5, float shoulderAngle=1.0)

References KoGamutMappingUtils::PiecewiseFilmicCurve::evalCurve(), KoGamutMappingUtils::PiecewiseFilmicCurve::fromUserParams(), GAMUT_MAP_ENABLED, GAMUT_MAP_METHOD, GAMUT_MAP_TARGET_PROFILE, KisGlobalResourcesInterface::instance(), KoGamutMappingUtils::PiecewiseFilmicCurve::inverseMaxWhite, MAPPING_MODEL, KoGamutMappingUtils::PiecewiseFilmic, KoGamutMappingUtils::reinhardToneMapping(), 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 ui.

◆ setConfiguration()

void KisToneGamutMapWidget::setConfiguration ( const KisPropertiesConfigurationSP config)
virtual
Parameters
configthe configuration for this configuration widget.

Implements KisConfigWidget.

Definition at line 203 of file KisToneGamutMapFilter.cpp.

204{
205 QVariant value;
206
207 if (config->getProperty(MAPPING_MODEL, value)) {
208 ui->cmbMappingModel->setCurrentIndex(ui->cmbMappingModel->findData(value));
209 }
210 if (config->getProperty(TONE_MAP_TYPE, value)) {
211 ui->cmbToneCurveType->setCurrentIndex(ui->cmbToneCurveType->findData(value));
212 ui->stkToneMap->setCurrentIndex(ui->cmbToneCurveType->currentIndex());
213 }
214
215 if (config->getProperty(TONE_MAP_ENABLED, value)) {
216 ui->chkToneMap->setChecked(value.toBool());
217 }
218 if (config->getProperty(TONE_MAP_MAX_WHITE, value)) {
219 ui->spnMaxWhite->setValue(value.toDouble());
220 }
221 if (config->getProperty(TONE_PIECE_WISE_TOE_STRENGTH, value)) {
222 ui->spnToeStrength->setValue(value.toDouble());
223 }
224 if (config->getProperty(TONE_PIECE_WISE_TOE_LENGTH, value)) {
225 ui->spnToeLength->setValue(value.toDouble());
226 }
227 if (config->getProperty(TONE_PIECE_WISE_SHOULDER_STRENGTH, value)) {
228 ui->spnShoulderStrength->setValue(value.toDouble());
229 }
230 if (config->getProperty(TONE_PIECE_WISE_SHOULDER_LENGTH, value)) {
231 ui->spnShoulderLength->setValue(value.toDouble());
232 }
233 if (config->getProperty(TONE_PIECE_WISE_SHOULDER_ANGLE, value)) {
234 ui->spnShoulderAngle->setValue(value.toDouble());
235 }
236
237
238 if (config->getProperty(GAMUT_MAP_ENABLED, value)) {
239 ui->chkGamutMap->setChecked(value.toBool());
240 }
241 if (config->getProperty(GAMUT_MAP_TARGET_PROFILE, value)) {
243 if (profile) {
244 ui->targetGamut->setCurrentColorSpace(
245 KoColorSpaceRegistry::instance()->colorSpace(profile->colorModelID(),
247 profile));
248 }
249 }
250 int idx = ui->cmbGamutMapMethod->findData(config->getProperty(GAMUT_MAP_METHOD));
251 ui->cmbGamutMapMethod->setCurrentIndex(idx);
253}
float value(const T *src, size_t ch)
const KoID Integer16BitsColorDepthID("U16", ki18n("16-bit integer/channel"))
QString id() const
Definition KoID.cpp:63
virtual QString colorModelID() const
const KoColorProfile * profileByName(const QString &name) const
static KoColorSpaceRegistry * instance()

References KoColorProfile::colorModelID(), GAMUT_MAP_ENABLED, GAMUT_MAP_METHOD, GAMUT_MAP_TARGET_PROFILE, KoID::id(), KoColorSpaceRegistry::instance(), Integer16BitsColorDepthID, MAPPING_MODEL, KoColorSpaceRegistry::profileByName(), KisConfigWidget::sigConfigurationItemChanged(), 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, ui, and value().

Member Data Documentation

◆ ui

Ui::KisToneGamutMapWidget* KisToneGamutMapWidget::ui
private

Definition at line 51 of file KisToneGamutMapFilter.h.


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