]> git.sesse.net Git - kdenlive/commitdiff
RGB Parade updates:
authorSimon A. Eugster <simon.eu@gmail.com>
Wed, 18 Aug 2010 12:41:42 +0000 (12:41 +0000)
committerSimon A. Eugster <simon.eu@gmail.com>
Wed, 18 Aug 2010 12:41:42 +0000 (12:41 +0000)
* 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

src/colorcorrection/rgbparadegenerator.cpp
src/colorcorrection/rgbparadegenerator.h
src/rgbparade.cpp
src/rgbparade.h
src/vectorscope.cpp

index c6121487fe23b0d88c6b87a081cd728b365d143e..222749c3333cb86d32f8e6d2cc20f1c49e3061c1 100644 (file)
@@ -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;
index 19f2babc91f785c7ec529bc20e9b6bbff078d0d2..50b98c9117467f989f418b9969d84f8cb34b3b8f 100644 (file)
@@ -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;
index 0ae2ab0e16dcb3eb3c7a6e02d81e59e3e79650d2..c14ac9a0cc70c1d3e44495442b6ca836093ca6f8 100644 (file)
@@ -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;
 }
index a123339a057377995e8ccec5c0b97fea442b8027..a568e8eac4990bb303e80bc3306ff64f40a194a2 100644 (file)
@@ -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;
index c25ef10d9d41e4cd294dfaea3d8c5b64deaa1a10..329e127add8f59b03a06c7e1f952450885c1b135 100644 (file)
@@ -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()));