Commit 28b39a2d authored by Simon Eugster's avatar Simon Eugster
Browse files

RGB Parade updates:

* Disable/enable axis
* Show a reference line for a gradient (for color correction). Useful when loading a gradient image with black on the left and white on the right.

svn path=/trunk/kdenlive/; revision=4739
parent 8394f051
......@@ -26,7 +26,8 @@ RGBParadeGenerator::RGBParadeGenerator()
}
QImage RGBParadeGenerator::calculateRGBParade(const QSize &paradeSize, const QImage &image,
const RGBParadeGenerator::PaintMode paintMode, const bool &drawAxis, const uint &accelFactor)
const RGBParadeGenerator::PaintMode paintMode, const bool &drawAxis,
const bool &drawGradientRef, const uint &accelFactor)
{
Q_ASSERT(accelFactor >= 1);
......@@ -153,6 +154,13 @@ QImage RGBParadeGenerator::calculateRGBParade(const QSize &paradeSize, const QIm
}
}
}
if (drawGradientRef) {
davinci.setPen(colLight);
davinci.drawLine(0 ,partH, partW, 0);
davinci.drawLine( partW + offset,partH, 2*partW + offset,0);
davinci.drawLine(2*partW + 2*offset,partH, 3*partW + 2*offset,0);
}
const int d = 50;
......
......@@ -23,7 +23,7 @@ public:
RGBParadeGenerator();
QImage calculateRGBParade(const QSize &paradeSize, const QImage &image, const RGBParadeGenerator::PaintMode paintMode,
const bool &drawAxis, const uint &accelFactor = 1);
const bool &drawAxis, const bool &drawGradientRef, const uint &accelFactor = 1);
static const QColor colHighlight;
static const QColor colLight;
......
......@@ -8,6 +8,7 @@
* (at your option) any later version. *
***************************************************************************/
#include <QMenu>
#include <QRect>
#include <QTime>
#include "renderer.h"
......@@ -24,7 +25,20 @@ RGBParade::RGBParade(Monitor *projMonitor, Monitor *clipMonitor, QWidget *parent
ui->paintMode->addItem(i18n("RGB 2"), QVariant(RGBParadeGenerator::PaintMode_RGB2));
bool b = true;
m_menu->addSeparator();
m_aAxis = new QAction(i18n("Draw axis"), this);
m_aAxis->setCheckable(true);
m_menu->addAction(m_aAxis);
b &= connect(m_aAxis, SIGNAL(changed()), this, SLOT(forceUpdateScope()));
m_aGradRef = new QAction(i18n("Gradient reference line"), this);
m_aGradRef->setCheckable(true);
m_menu->addAction(m_aGradRef);
b &= connect(m_aGradRef, SIGNAL(changed()), this, SLOT(forceUpdateScope()));
b &= connect(ui->paintMode, SIGNAL(currentIndexChanged(int)), this, SLOT(forceUpdateScope()));
Q_ASSERT(b);
m_rgbParadeGenerator = new RGBParadeGenerator();
......@@ -37,6 +51,8 @@ RGBParade::~RGBParade()
delete ui;
delete m_rgbParadeGenerator;
delete m_aAxis;
delete m_aGradRef;
}
void RGBParade::readConfig()
......@@ -46,6 +62,8 @@ void RGBParade::readConfig()
KSharedConfigPtr config = KGlobal::config();
KConfigGroup scopeConfig(config, configName());
ui->paintMode->setCurrentIndex(scopeConfig.readEntry("paintmode", 0));
m_aAxis->setChecked(scopeConfig.readEntry("axis", true));
m_aGradRef->setChecked(scopeConfig.readEntry("gradref", false));
}
void RGBParade::writeConfig()
......@@ -53,6 +71,8 @@ void RGBParade::writeConfig()
KSharedConfigPtr config = KGlobal::config();
KConfigGroup scopeConfig(config, configName());
scopeConfig.writeEntry("paintmode", ui->paintMode->currentIndex());
scopeConfig.writeEntry("axis", m_aAxis->isChecked());
scopeConfig.writeEntry("gradref", m_aGradRef->isChecked());
scopeConfig.sync();
}
......@@ -73,7 +93,7 @@ QImage RGBParade::renderScope(uint accelerationFactor, QImage qimage)
int paintmode = ui->paintMode->itemData(ui->paintMode->currentIndex()).toInt();
QImage parade = m_rgbParadeGenerator->calculateRGBParade(m_scopeRect.size(), qimage, (RGBParadeGenerator::PaintMode) paintmode,
true, accelerationFactor);
m_aAxis->isChecked(), m_aGradRef->isChecked(), accelerationFactor);
emit signalScopeRenderingFinished(start.elapsed(), accelerationFactor);
return parade;
}
......
......@@ -36,6 +36,9 @@ private:
Ui::RGBParade_UI *ui;
RGBParadeGenerator *m_rgbParadeGenerator;
QAction *m_aAxis;
QAction *m_aGradRef;
bool isHUDDependingOnInput() const;
bool isScopeDependingOnInput() const;
bool isBackgroundDependingOnInput() const;
......
......@@ -83,13 +83,11 @@ Vectorscope::Vectorscope(Monitor *projMonitor, Monitor *clipMonitor, QWidget *pa
m_a75PBox = new QAction(i18n("75% box"), this);
m_a75PBox->setCheckable(true);
m_a75PBox->setChecked(false);
m_menu->addAction(m_a75PBox);
b &= connect(m_a75PBox, SIGNAL(changed()), this, SLOT(forceUpdateBackground()));
m_aAxisEnabled = new QAction(i18n("Draw axis"), this);
m_aAxisEnabled->setCheckable(true);
m_aAxisEnabled->setChecked(false);
m_menu->addAction(m_aAxisEnabled);
b &= connect(m_aAxisEnabled, SIGNAL(changed()), this, SLOT(forceUpdateBackground()));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment