Finishing filters: Vignette, Bloom / Glow, Tonal Contrast (12.9a)
This commit is contained in:
1 parent
96ce546508
commit
fdb62978c5
20 files changed
+756
-35
No files matched your search
@@ -0,0 +1,50 @@
|
||||
#include "UI/ColorPaletteControls.h"
|
||||
#include "UI/FilterSheet.h"
|
||||
#include <QHBoxLayout>
|
||||
#include <QLabel>
|
||||
#include <QSlider>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
// Swift's finishing filters: Vignette, Bloom / Glow, Tonal Contrast.
|
||||
void FilterSheet::finishing(FilterKind kind)
|
||||
{
|
||||
const auto key = [](double FilterSettings::*field) { return [field](FilterSettings &settings) -> double & { return settings.*field; }; };
|
||||
const auto help = [this](const QString &words) { m_controls.back().slider->parentWidget()->setToolTip(words); };
|
||||
if (kind == FilterKind::vignette) {
|
||||
auto *box = new QWidget(this);
|
||||
auto *row = new QHBoxLayout(box);
|
||||
row->setContentsMargins(0, 0, 0, 0);
|
||||
row->setSpacing(8);
|
||||
auto *title = new QLabel(QStringLiteral("Color"), box);
|
||||
title->setFixedWidth(95);
|
||||
m_vignetteSwatch = new SwatchButton([this] {
|
||||
const AdjustmentColor colour = settings().vignetteColor;
|
||||
return PaletteColor{colour.red, colour.green, colour.blue};
|
||||
}, 6, 1.5, 1, box);
|
||||
m_vignetteSwatch->setObjectName(QStringLiteral("vignetteSwatch"));
|
||||
m_vignetteSwatch->setFixedSize(24, 24);
|
||||
m_vignetteSwatch->setToolTip(QStringLiteral("Choose the vignette color"));
|
||||
m_vignetteSwatch->setAccessibleName(QStringLiteral("Vignette color"));
|
||||
connect(m_vignetteSwatch, &QAbstractButton::clicked, this, [this] { m_session.openVignetteColorPicker(); });
|
||||
row->addWidget(title);
|
||||
row->addWidget(m_vignetteSwatch);
|
||||
row->addStretch(1);
|
||||
m_column->addWidget(box);
|
||||
control(QStringLiteral("Amount"), key(&FilterSettings::vignetteAmount), 0, 100, QStringLiteral("%"), 0, false);
|
||||
help(QStringLiteral("Blend the chosen color into the edges while keeping the center unchanged"));
|
||||
control(QStringLiteral("Midpoint"), key(&FilterSettings::vignetteMidpoint), 0, 100, QStringLiteral("%"), 0, false);
|
||||
control(QStringLiteral("Roundness"), key(&FilterSettings::vignetteRoundness), -100, 100, QString(), 0, false);
|
||||
control(QStringLiteral("Feather"), key(&FilterSettings::vignetteFeather), 0, 100, QStringLiteral("%"), 0, false);
|
||||
control(QStringLiteral("Highlights"), key(&FilterSettings::vignetteHighlights), 0, 100, QStringLiteral("%"), 0, false);
|
||||
help(QStringLiteral("Protect bright areas near the edge"));
|
||||
} else if (kind == FilterKind::bloomGlow) {
|
||||
control(QStringLiteral("Amount"), key(&FilterSettings::bloomAmount), 0, 100, QStringLiteral("%"), 0, false);
|
||||
control(QStringLiteral("Radius"), key(&FilterSettings::bloomRadius), 1, 150, QStringLiteral("px"), 0, true);
|
||||
} else {
|
||||
control(QStringLiteral("Amount"), key(&FilterSettings::tonalAmount), 0, 100, QStringLiteral("%"), 0, false);
|
||||
control(QStringLiteral("Shadows"), key(&FilterSettings::tonalShadows), -100, 100, QStringLiteral("%"), 0, false);
|
||||
control(QStringLiteral("Midtones"), key(&FilterSettings::tonalMidtones), -100, 100, QStringLiteral("%"), 0, false);
|
||||
control(QStringLiteral("Highlights"), key(&FilterSettings::tonalHighlights), -100, 100, QStringLiteral("%"), 0, false);
|
||||
control(QStringLiteral("Radius"), key(&FilterSettings::tonalRadius), 1, 100, QStringLiteral("px"), 0, true);
|
||||
}
|
||||
}
|
||||
@@ -201,6 +201,9 @@ FilterSheet::FilterSheet(EditorSession &session, QWidget *parent)
|
||||
control(QStringLiteral("Amount"), key(&FilterSettings::amount), 0.1, 400, QStringLiteral("%"), 1, true);
|
||||
noise();
|
||||
break;
|
||||
case FilterKind::vignette:
|
||||
case FilterKind::bloomGlow:
|
||||
case FilterKind::tonalContrast: finishing(m_session.filterEdit()->kind); break;
|
||||
case FilterKind::lensCorrection:
|
||||
control(QStringLiteral("Remove Distortion"), key(&FilterSettings::distortion), -100, 100, QString(), 0, false);
|
||||
m_column->addWidget(words(QStringLiteral("Positive straightens lines that bow outward (barrel); negative, lines that bow inward (pincushion)."),
|
||||
@@ -388,7 +391,10 @@ void FilterSheet::synchronize()
|
||||
if (picked != m_pickerColour) {
|
||||
m_pickerColour = picked;
|
||||
m_session.previewGradientMapColor();
|
||||
m_session.previewVignetteColor();
|
||||
}
|
||||
if (m_vignetteSwatch)
|
||||
m_vignetteSwatch->update();
|
||||
const FilterEdit &edit = m_session.filterEdit().value();
|
||||
for (Control &control : m_controls) {
|
||||
FilterSettings copy = edit.settings;
|
||||
|
||||
@@ -53,6 +53,8 @@ private:
|
||||
void control(const QString &title, std::function<double &(FilterSettings &)> key, double low, double high, const QString &unit,
|
||||
int decimals, bool logarithmic);
|
||||
void noise();
|
||||
// Vignette's colour and rows, Bloom / Glow's, Tonal Contrast's.
|
||||
void finishing(FilterKind kind);
|
||||
// Remove Background's words, Quality, and Advanced's three rows.
|
||||
void background();
|
||||
// Black & White's six families and Tint; Color Balance's nine.
|
||||
@@ -72,6 +74,7 @@ private:
|
||||
std::vector<Control> m_controls;
|
||||
CurvesControls *m_curves = nullptr;
|
||||
GradientMapControls *m_gradientMap = nullptr;
|
||||
SwatchButton *m_vignetteSwatch = nullptr;
|
||||
QButtonGroup *m_distribution = nullptr;
|
||||
QCheckBox *m_monochromatic = nullptr;
|
||||
QButtonGroup *m_quality = nullptr;
|
||||
|
||||
Reference in new issue
Block a user