Commit 84247e41 authored by Till Theato's avatar Till Theato
Browse files

Use RGB plane as Curve Widget background:

http://kdenlive.org/mantis/view.php?id=1757

svn path=/trunk/kdenlive/; revision=4742
parent bb35ba42
......@@ -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">
......
......@@ -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.
......
......@@ -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;
......
......@@ -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;
......
......@@ -168,7 +168,6 @@ void KisCurveWidget::setCurveGuide(const QColor & color)
{
d->m_guideVisible = true;
d->m_colorGuide = color;
}
void KisCurveWidget::setPixmap(const QPixmap & pix)
......
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