widgets/urlval_ui.ui
widgets/vectorscope_ui.ui
widgets/colorplaneexport_ui.ui
+ widgets/waveform_ui.ui
)
set(kdenlive_SRCS
colorplaneexport.cpp
colortools.cpp
rebuildgroupcommand.cpp
+ waveform.cpp
)
add_definitions( ${KDE4_DEFINITIONS} )
tResX->setText("800");
tResY->setText("800");
- cbColorspace->addItem(i18n("YUV UV plane"), QVariant(CPE_YUV));
- cbColorspace->addItem(i18n("YUV Y plane"), QVariant(CPE_YUV_Y));
- cbColorspace->addItem(i18n("Modified YUV (Chroma)"), QVariant(CPE_YUV_MOD));
- cbColorspace->addItem(i18n("RGB plane, one component varying"), QVariant(CPE_RGB_CURVE));
+ cbColorspace->addItem(i18n("YUV UV plane"), QVariant(ColorPlaneExport::CPE_YUV));
+ cbColorspace->addItem(i18n("YUV Y plane"), QVariant(ColorPlaneExport::CPE_YUV_Y));
+ cbColorspace->addItem(i18n("Modified YUV (Chroma)"), QVariant(ColorPlaneExport::CPE_YUV_MOD));
+ cbColorspace->addItem(i18n("YCbCr CbCr plane"), QVariant(ColorPlaneExport::CPE_YPbPr));
+ cbColorspace->addItem(i18n("RGB plane, one component varying"), QVariant(ColorPlaneExport::CPE_RGB_CURVE));
sliderColor->setSliderPosition(128);
case CPE_RGB_CURVE:
img = m_colorTools->rgbCurvePlane(size, (ColorTools::ColorsRGB) (cbVariant->itemData(cbVariant->currentIndex()).toInt()));
break;
+ case CPE_YPbPr:
+ img = m_colorTools->yPbPrColorWheel(size, sliderColor->value(), m_scaling, false);
+ break;
}
img.save(kurlrequester->text());
}
switch (cbColorspace->itemData(cbColorspace->currentIndex()).toInt()) {
case CPE_YUV:
case CPE_YUV_MOD:
+ case CPE_YPbPr:
enableSliderScaling(true);
enableSliderColor(true);
enableCbVariant(false);
class ColorPlaneExport_UI;
-enum COLOR_EXPORT_MODE { CPE_YUV, CPE_YUV_Y, CPE_YUV_MOD, CPE_RGB_CURVE };
-
class ColorPlaneExport : public QDialog, public Ui::ColorPlaneExport_UI {
Q_OBJECT
public:
ColorPlaneExport(QWidget *parent = 0);
~ColorPlaneExport();
-protected:
+ enum COLOR_EXPORT_MODE { CPE_YUV, CPE_YUV_Y, CPE_YUV_MOD, CPE_RGB_CURVE, CPE_YPbPr };
private:
ColorTools *m_colorTools;
qCritical("ERROR: Size of the color wheel must not be 0!");
return wheel;
}
- wheel.fill(qRgba(0,0,0,0));
+ if (circleOnly) {
+ wheel.fill(qRgba(0,0,0,0));
+ }
double dr, dg, db, du, dv, dmax;
double ru, rv, rr;
}
}
- emit signalWheelCalculationFinished();
+ emit signalYuvWheelCalculationFinished();
return wheel;
}
double dcol, dval;
for (int x = 0; x < w; x++) {
- dval = (double)255*x/w;
+ dval = (double)255*x/(w-1);
for (int y = 0; y < h; y++) {
- dcol = (double)255*y/h;
+ dcol = (double)255*y/(h-1);
if (color == ColorTools::COL_R) {
plane.setPixel(x, (h-y-1), qRgb(dcol, dval, dval));
return plane;
}
+QImage ColorTools::yPbPrColorWheel(const QSize &size, const unsigned char &Y, const float &scaling, const bool &circleOnly)
+{
+
+ QImage wheel(size, QImage::Format_ARGB32);
+ if (size.width() == 0 || size.height() == 0) {
+ qCritical("ERROR: Size of the color wheel must not be 0!");
+ return wheel;
+ }
+ if (circleOnly) {
+ wheel.fill(qRgba(0,0,0,0));
+ }
+
+ double dr, dg, db, dpB, dpR;
+ double rB, rR, rr;
+ const int w = size.width();
+ const int h = size.height();
+ const float w2 = (float)w/2;
+ const float h2 = (float)h/2;
+
+ for (int b = 0; b < w; b++) {
+ // Transform pB from {0,...,w} to [-0.5,0.5]
+ dpB = (double) b/(w-1) - .5;
+ dpB = scaling*dpB;
+
+ for (int r = 0; r < h; r++) {
+ dpR = (double) r/(h-1) - .5;
+ dpR = scaling*dpR;
+
+ if (circleOnly) {
+ // see yuvColorWheel
+ rB = b - w2;
+ rR = r - h2;
+ rr = rB*rB/(w2*w2) + rR*rR/(h2*h2);
+ if (rr > 1) {
+ continue;
+ }
+ }
+
+ // Calculate the RGB values from YPbPr
+ dr = Y + 357.5*dpR;
+ dg = Y - 87.75*dpB - 182.1*dpR;
+ db = Y + 451.86*dpB;
+
+ // Avoid overflows (which would generate intersting patterns).
+ // Note that not all possible (y,u,v) values with u,v \in [-1,1]
+ // have a correct RGB representation, therefore some RGB values
+ // may exceed {0,...,255}.
+ if (dr < 0) dr = 0;
+ if (dg < 0) dg = 0;
+ if (db < 0) db = 0;
+ if (dr > 255) dr = 255;
+ if (dg > 255) dg = 255;
+ if (db > 255) db = 255;
+
+ wheel.setPixel(b, (h-r-1), qRgba(dr, dg, db, 255));
+ }
+ }
+
+ return wheel;
+}
+
in equal terms (linear as well) on the x axis.
*/
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.
+ scaling defines how far to zoom in (or out). Lower value = zoom in.
+ See also: http://de.wikipedia.org/wiki/YPbPr-Farbmodell and http://www.poynton.com/ColorFAQ.html
+ */
+ QImage yPbPrColorWheel(const QSize &size, const unsigned char &Y, const float &scaling, const bool &circleOnly);
signals:
- void signalWheelCalculationFinished();
+ void signalYuvWheelCalculationFinished();
};
#endif // COLORTOOLS_H
connect(backgroundMode, SIGNAL(currentIndexChanged(int)), this, SLOT(slotBackgroundChanged()));
connect(cbMagnify, SIGNAL(stateChanged(int)), this, SLOT(slotMagnifyChanged()));
connect(this, SIGNAL(signalScopeCalculationFinished(uint,uint)), this, SLOT(slotScopeCalculationFinished(uint,uint)));
- connect(m_colorTools, SIGNAL(signalWheelCalculationFinished()), this, SLOT(slotWheelCalculationFinished()));
+ connect(m_colorTools, SIGNAL(signalYuvWheelCalculationFinished()), this, SLOT(slotWheelCalculationFinished()));
connect(paintMode, SIGNAL(currentIndexChanged(int)), this, SLOT(slotUpdateScope()));
connect(cbAutoRefresh, SIGNAL(stateChanged(int)), this, SLOT(slotUpdateScope()));
--- /dev/null
+#include "waveform.h"
+
+Waveform::Waveform(QWidget *parent) :
+ QWidget(parent)
+{
+ setupUi(this);
+}
+
+Waveform::~Waveform()
+{
+}
--- /dev/null
+#ifndef WAVEFORM_H
+#define WAVEFORM_H
+
+#include <QWidget>
+
+#include "ui_waveform_ui.h"
+
+class Waveform_UI;
+
+class Waveform : public QWidget, public Ui::Waveform_UI {
+ Q_OBJECT
+
+public:
+ Waveform(QWidget *parent = 0);
+ ~Waveform();
+
+};
+
+#endif // WAVEFORM_H
<property name="windowTitle">
<string>Form</string>
</property>
- <widget class="QWidget" name="gridLayoutWidget">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>401</width>
- <height>101</height>
- </rect>
- </property>
- <layout class="QGridLayout" name="gridLayout">
- <property name="sizeConstraint">
- <enum>QLayout::SetDefaultConstraint</enum>
- </property>
- <property name="leftMargin">
- <number>5</number>
- </property>
- <property name="topMargin">
- <number>5</number>
- </property>
- <property name="rightMargin">
- <number>5</number>
- </property>
- <item row="1" column="0">
- <layout class="QVBoxLayout" name="controlsArea">
- <item>
- <layout class="QGridLayout" name="gridLayout_2">
- <property name="horizontalSpacing">
- <number>10</number>
- </property>
- <item row="1" column="1">
- <widget class="QComboBox" name="paintMode">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- </widget>
- </item>
- <item row="2" column="1">
- <widget class="QComboBox" name="backgroundMode">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="QLabel" name="lblPaintMode">
- <property name="text">
- <string>Paint mode</string>
- </property>
- </widget>
- </item>
- <item row="2" column="0">
- <widget class="QLabel" name="lblBackground">
- <property name="text">
- <string>Background</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout">
- <item>
- <widget class="QCheckBox" name="cbMagnify">
- <property name="text">
- <string>Magnify</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QCheckBox" name="cbAutoRefresh">
- <property name="text">
- <string>Auto-Refresh</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- </layout>
- </item>
- <item row="2" column="0">
- <spacer name="verticalSpacer">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>40</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </widget>
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="0" column="0">
+ <layout class="QVBoxLayout" name="controlsArea">
+ <item>
+ <layout class="QGridLayout" name="gridLayout_2">
+ <property name="horizontalSpacing">
+ <number>10</number>
+ </property>
+ <item row="1" column="1">
+ <widget class="QComboBox" name="paintMode">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1">
+ <widget class="QComboBox" name="backgroundMode">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="lblPaintMode">
+ <property name="text">
+ <string>Paint mode</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0">
+ <widget class="QLabel" name="lblBackground">
+ <property name="text">
+ <string>Background</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QCheckBox" name="cbMagnify">
+ <property name="text">
+ <string>Magnify</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="cbAutoRefresh">
+ <property name="text">
+ <string>Auto-Refresh</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </item>
+ <item row="1" column="0">
+ <spacer name="verticalSpacer">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>344</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
</widget>
<resources/>
<connections/>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>Waveform_UI</class>
+ <widget class="QWidget" name="Waveform_UI">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>400</width>
+ <height>300</height>
+ </rect>
+ </property>
+ <property name="palette">
+ <palette>
+ <active>
+ <colorrole role="WindowText">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>250</red>
+ <green>238</green>
+ <blue>226</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Button">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>40</red>
+ <green>40</green>
+ <blue>39</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Text">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>250</red>
+ <green>238</green>
+ <blue>226</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="ButtonText">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>250</red>
+ <green>238</green>
+ <blue>226</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Base">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>40</red>
+ <green>40</green>
+ <blue>39</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Window">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>40</red>
+ <green>40</green>
+ <blue>39</blue>
+ </color>
+ </brush>
+ </colorrole>
+ </active>
+ <inactive>
+ <colorrole role="WindowText">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>250</red>
+ <green>238</green>
+ <blue>226</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Button">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>40</red>
+ <green>40</green>
+ <blue>39</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Text">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>250</red>
+ <green>238</green>
+ <blue>226</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="ButtonText">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>250</red>
+ <green>238</green>
+ <blue>226</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Base">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>40</red>
+ <green>40</green>
+ <blue>39</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Window">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>40</red>
+ <green>40</green>
+ <blue>39</blue>
+ </color>
+ </brush>
+ </colorrole>
+ </inactive>
+ <disabled>
+ <colorrole role="WindowText">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>146</red>
+ <green>145</green>
+ <blue>144</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Button">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>40</red>
+ <green>40</green>
+ <blue>39</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Text">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>165</red>
+ <green>164</green>
+ <blue>164</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="ButtonText">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>151</red>
+ <green>150</green>
+ <blue>149</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Base">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>40</red>
+ <green>40</green>
+ <blue>39</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Window">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>40</red>
+ <green>40</green>
+ <blue>39</blue>
+ </color>
+ </brush>
+ </colorrole>
+ </disabled>
+ </palette>
+ </property>
+ <property name="windowTitle">
+ <string>Form</string>
+ </property>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>