]> git.sesse.net Git - kdenlive/commitdiff
Use RGB plane as Curve Widget background:
authorTill Theato <root@ttill.de>
Sat, 21 Aug 2010 20:48:34 +0000 (20:48 +0000)
committerTill Theato <root@ttill.de>
Sat, 21 Aug 2010 20:48:34 +0000 (20:48 +0000)
http://kdenlive.org/mantis/view.php?id=1757

svn path=/trunk/kdenlive/; revision=4742

effects/frei0r_curves.xml
src/colortools.h
src/effectstackedit.cpp
src/effectstackedit.h
src/kis_curve_widget.cpp

index 23aa124f25ebeca86d3d437b3becbe708be021fb..adb522c17314b538dfb640764e38f695e7412a8a 100644 (file)
@@ -6,7 +6,7 @@
        <parameter type="list" name="Channel" default="0" paramlist="0,1,2,3" paramlistdisplay="Red,Green,Blue,Luma">
                <name>Channel</name>
        </parameter>
-       <parameter type="curve" default="0" number="Curve point number" inpoints="Point %i input value" outpoints="Point %i output value" min="1" max="5">
+       <parameter type="curve" default="0" depends="Channel" number="Curve point number" inpoints="Point %i input value" outpoints="Point %i output value" min="1" max="5">
                 <name>Curve Widget</name>
         </parameter>
        <parameter type="fixed" name="Curve point number" default="2" min="2" max="5">
index 1b2eb1a21d18d5841f41608602557a3a4e8b6d44..0afabe0bce56c422cac93fdca0b0daa449e2ee8e 100644 (file)
@@ -51,7 +51,7 @@ public:
       color defines the color to modify on the y axis. The other two components will be increased
       in equal terms (linear as well) on the x axis.
      */
-    QImage rgbCurvePlane(const QSize &size, const ColorTools::ColorsRGB &color);
+    static QImage rgbCurvePlane(const QSize &size, const ColorTools::ColorsRGB &color);
     /**
       @brief Draws a YPbPr plane with Pb on the x axis and Pr on the y axis.
       Y is the Y value to use.
index 2c20c8fd4e558388f91913f1bfea92d5823eb97e..a95bcf6dc0987da24d25ca3201d77744be191bd7 100644 (file)
@@ -32,6 +32,7 @@
 #include "kis_cubic_curve.h"
 #include "choosecolorwidget.h"
 #include "geometrywidget.h"
+#include "colortools.h"
 
 #include <KDebug>
 #include <KLocale>
@@ -142,6 +143,20 @@ void EffectStackEdit::updateTimecodeFormat()
     }
 }
 
+void EffectStackEdit::meetDependency(const QString& name, QString type, QString value)
+{
+    if (type == "curve") {
+        KisCurveWidget *curve = (KisCurveWidget*)m_valueItems[name];
+        if (curve) {
+            int color = value.toInt();
+            if (color < 3)
+                curve->setPixmap(QPixmap::fromImage(ColorTools::rgbCurvePlane(curve->size(), (ColorTools::ColorsRGB)color)));
+            else
+                curve->setPixmap(QPixmap());
+        }
+    }
+}
+
 void EffectStackEdit::updateProjectFormat(MltVideoProfile profile, Timecode t)
 {
     m_profile = profile;
@@ -348,8 +363,13 @@ void EffectStackEdit::transferParamDesc(const QDomElement d, int pos, int in, in
             m_vbox->addWidget(curve);
             m_vbox->addWidget(spinin);
             m_vbox->addWidget(spinout);
+
             connect(curve, SIGNAL(modified()), this, SLOT(collectAllParameters()));
             m_valueItems[paramName] = curve;
+
+            QString depends = pa.attribute("depends");
+            if (!depends.isEmpty())
+                meetDependency(paramName, type, EffectsList::parameter(e, depends));
         } else if (type == "wipe") {
             Wipeval *wpval = new Wipeval;
             wpval->setupUi(toFillin);
@@ -601,6 +621,9 @@ void EffectStackEdit::collectAllParameters()
                 EffectsList::setParameter(newparam, in, QString::number(points.at(j).x()));
                 EffectsList::setParameter(newparam, out, QString::number(points.at(j).y()));
             }
+            QString depends = pa.attributes().namedItem("depends").nodeValue();
+            if (!depends.isEmpty())
+                meetDependency(paramName, type, EffectsList::parameter(newparam, depends));
         } else if (type == "wipe") {
             Wipeval *wp = (Wipeval*)m_valueItems.value(paramName);
             wipeInfo info;
index fa1f1f4459a528c3abcc46bb797c659cb298ff90..a737616cf2515d0dce6d062816b78eef41991837 100644 (file)
@@ -55,14 +55,20 @@ public:
 
 private:
     void clearAllItems();
+    void createSliderItem(const QString& name, int val , int min, int max, const QString);
+    wipeInfo getWipeInfo(QString value);
+    QString getWipeString(wipeInfo info);
+    /** @brief Updates parameter @param name according to new value of dependency.
+    * @param name Name of the parameter which will be updated
+    * @param type Type of the parameter which will be updated
+    * @param value Value of the dependency parameter */
+    void meetDependency(const QString& name, QString type, QString value);
+
     QVBoxLayout *m_vbox;
     QList<QWidget*> m_uiItems;
     QWidget *m_baseWidget;
     QDomElement m_params;
     QMap<QString, QWidget*> m_valueItems;
-    void createSliderItem(const QString& name, int val , int min, int max, const QString);
-    wipeInfo getWipeInfo(QString value);
-    QString getWipeString(wipeInfo info);
     MltVideoProfile m_profile;
     Timecode m_timecode;
     int m_in;
index 228373c019df5e286ddd84fb7c2f212e70c34968..230271e5717c69c38dc91657d906e3a7508ce2e5 100644 (file)
@@ -168,7 +168,6 @@ void KisCurveWidget::setCurveGuide(const QColor & color)
 {
     d->m_guideVisible = true;
     d->m_colorGuide   = color;
-
 }
 
 void KisCurveWidget::setPixmap(const QPixmap & pix)