Krita Source Code Documentation
Loading...
Searching...
No Matches
KisAutoLevelsWidget.cpp
Go to the documentation of this file.
1/*
2 * This file is part of Krita
3 *
4 * SPDX-FileCopyrightText: 2021 Deif Lou <ginoba@gmail.com>
5 *
6 * SPDX-License-Identifier: GPL-2.0-or-later
7 */
8
10
12
14 : QWidget(parent)
15{
16 m_ui.setupUi(this);
17
18 KisSpinBoxI18nHelper::setText(m_ui.sliderShadowsClipping,
19 i18nc("{n} is the number value, % is the percent sign", "{n}%"));
20 m_ui.sliderShadowsClipping->setRange(0.0, 10.0, 2);
21 m_ui.sliderShadowsClipping->setValue(0.1);
22 m_ui.sliderShadowsClipping->setSingleStep(0.1);
23
24 m_ui.sliderHighlightsClipping->setSuffix(m_ui.sliderShadowsClipping->suffix());
25 m_ui.sliderHighlightsClipping->setRange(0.0, 10.0, 2);
26 m_ui.sliderHighlightsClipping->setValue(0.1);
27 m_ui.sliderHighlightsClipping->setSingleStep(0.1);
28
29 m_ui.sliderShadowsAndLightsMaximumOffset->setSuffix(m_ui.sliderShadowsClipping->suffix());
30 m_ui.sliderShadowsAndLightsMaximumOffset->setRange(0.0, 100.0, 2);
31 m_ui.sliderShadowsAndLightsMaximumOffset->setValue(100.0);
32
33 m_ui.sliderMidtonesAdjustmentAmount->setSuffix(m_ui.sliderShadowsClipping->suffix());
34 m_ui.sliderMidtonesAdjustmentAmount->setRange(0.0, 100.0, 2);
35 m_ui.sliderMidtonesAdjustmentAmount->setValue(50.0);
36
37 connect(m_ui.comboBoxShadowsAndLightsMethod, SIGNAL(currentIndexChanged(int)), SIGNAL(parametersChanged()));
38 connect(m_ui.sliderShadowsClipping, SIGNAL(valueChanged(qreal)), SIGNAL(parametersChanged()));
39 connect(m_ui.sliderHighlightsClipping, SIGNAL(valueChanged(qreal)), SIGNAL(parametersChanged()));
40 connect(m_ui.sliderShadowsAndLightsMaximumOffset, SIGNAL(valueChanged(qreal)), SIGNAL(parametersChanged()));
41 connect(m_ui.comboBoxMidtonesMethod, SIGNAL(currentIndexChanged(int)), SIGNAL(parametersChanged()));
42 connect(m_ui.sliderMidtonesAdjustmentAmount, SIGNAL(valueChanged(qreal)), SIGNAL(parametersChanged()));
43 connect(m_ui.buttonShadowsColor, SIGNAL(changed(const KoColor&)), SIGNAL(parametersChanged()));
44 connect(m_ui.buttonHighlightsColor, SIGNAL(changed(const KoColor&)), SIGNAL(parametersChanged()));
45 connect(m_ui.buttonMidtonesColor, SIGNAL(changed(const KoColor&)), SIGNAL(parametersChanged()));
46}
47
50
55
57{
58 return m_ui.sliderShadowsClipping->value();
59}
60
62{
63 return m_ui.sliderHighlightsClipping->value();
64}
65
67{
68 return m_ui.sliderShadowsAndLightsMaximumOffset->value();
69}
70
75
77{
78 return m_ui.sliderMidtonesAdjustmentAmount->value();
79}
80
82{
83 return m_ui.buttonShadowsColor->color();
84}
85
87{
88 return m_ui.buttonHighlightsColor->color();
89}
90
92{
93 return m_ui.buttonMidtonesColor->color();
94}
95
97{
98 m_ui.comboBoxShadowsAndLightsMethod->setCurrentIndex(static_cast<int>(newMethod));
99}
100
101void KisAutoLevelsWidget::setShadowsClipping(qreal newShadowsClipping)
102{
103 m_ui.sliderShadowsClipping->setValue(newShadowsClipping);
104}
105
106void KisAutoLevelsWidget::setHighlightsClipping(qreal newHighlightsClipping)
107{
108 m_ui.sliderHighlightsClipping->setValue(newHighlightsClipping);
109}
110
111void KisAutoLevelsWidget::setMaximumInputBlackAndWhiteOffset(qreal newMaximumInputBlackAndWhiteOffset)
112{
113 m_ui.sliderShadowsAndLightsMaximumOffset->setValue(newMaximumInputBlackAndWhiteOffset);
114}
115
117{
118 m_ui.comboBoxMidtonesMethod->setCurrentIndex(static_cast<int>(newMethod));
119}
120
121void KisAutoLevelsWidget::setMidtonesAdjustmentAmount(qreal newMidtonesAdjustmentAmount)
122{
123 m_ui.sliderMidtonesAdjustmentAmount->setValue(newMidtonesAdjustmentAmount);
124}
125
127{
128 m_ui.buttonShadowsColor->setColor(newShadowsColor);
129}
130
132{
133 m_ui.buttonHighlightsColor->setColor(newHighlightsColor);
134}
135
137{
138 m_ui.buttonMidtonesColor->setColor(newMidtonesColor);
139}
140
142{
143 m_ui.comboBoxShadowsAndLightsMethod->setEnabled(false);
144}
145
147{
148 m_ui.comboBoxShadowsAndLightsMethod->setEnabled(true);
149}
connect(this, SIGNAL(optionsChanged()), this, SLOT(saveOptions()))
KisAutoLevels::MidtonesAdjustmentMethod midtonesAdjustmentMethod() const
Get the method used to adjust the midtones.
void setMidtonesAdjustmentAmount(qreal newMidtonesAdjustmentAmount)
Set how much the reference midtone point is deviated from the center of the histogram to the median/m...
void setMidtonesColor(const KoColor &newMidtonesColor)
Set the color used to move the midtones towards.
KoColor outputMidtonesColor() const
Get the color used to move the midtones towards.
Ui_KisAutoLevelsWidget m_ui
void setHighlightsClipping(qreal newHighlightsClipping)
Set the normalized percentage used to clip the highlights.
KisAutoLevels::ShadowsAndHighlightsAdjustmentMethod shadowsAndHighlightsAdjustmentMethod() const
Get the method used to adjust the contrast.
void unlockShadowsAndHighlightsAdjustmentMethod()
Enables the contrast method combo box, allowing the user to choose any of the methods.
void setShadowsColor(const KoColor &newShadowsColor)
Set the color used to move the shadows towards.
void setMaximumInputBlackAndWhiteOffset(qreal newMaximumInputBlackAndWhiteOffset)
Set the normalized maximum value that the black/white point can be moved from the default position of...
void setShadowsClipping(qreal newShadowsClipping)
Set the normalized percentage used to clip the shadows.
qreal midtonesAdjustmentAmount() const
Get how much the reference midtone point is deviated from the center of the histogram to the median/m...
KisAutoLevelsWidget(QWidget *parent)
KoColor outputShadowsColor() const
Get the color used to move the shadows towards.
KoColor outputHighlightsColor() const
Get the color used to move the highlights towards.
qreal highlightsClipping() const
Get the normalized percentage used to clip the highlights.
qreal shadowsClipping() const
Get the normalized percentage used to clip the shadows.
void setShadowsAndHighlightsAdjustmentMethod(KisAutoLevels::ShadowsAndHighlightsAdjustmentMethod newMethod)
Set the method used to adjust the contrast.
void setMidtonesAdjustmentMethod(KisAutoLevels::MidtonesAdjustmentMethod newMethod)
Set the method used to adjust the midtones.
void setHighlightsColor(const KoColor &newHighlightsColor)
Set the color used to move the highlights towards.
void lockShadowsAndHighlightsAdjustmentMethod()
Disables the contrast method combo box. Use this when only one of the methods makes sense.
qreal maximumInputBlackAndWhiteOffset() const
Get the normalized maximum value that the black/white point can be moved from the default position of...
void setColor(const quint8 *data, const KoColorSpace *colorSpace=0)
Definition KoColor.cpp:186
MidtonesAdjustmentMethod
The different methods to enhance the mid tones.
ShadowsAndHighlightsAdjustmentMethod
The different methods to enhance the contrast.
void setText(QSpinBox *spinBox, const QStringView textTemplate)