]> git.sesse.net Git - kdenlive/blobdiff - src/vectorscope.h
Display Jpeg exif data in clip properties metadata
[kdenlive] / src / vectorscope.h
index e57bf36b8d62904de51c9e0091687e99b5313bee..0a85045c302622fac3402c5eaf15f85ada87bcb6 100644 (file)
 #include <QtCore>
 #include "renderer.h"
 #include "monitor.h"
+#include "colorplaneexport.h"
+#include "colortools.h"
 #include "ui_vectorscope_ui.h"
 
 class Render;
 class Monitor;
 class Vectorscope_UI;
 
-enum PAINT_MODE { GREEN = 0, ORIG = 1, CHROMA = 2 };
+enum PAINT_MODE { PAINT_GREEN = 0, PAINT_ORIG = 1, PAINT_CHROMA = 2, PAINT_YUV = 3, PAINT_BLACK = 4, PAINT_GREEN2 = 5 };
+enum BACKGROUND_MODE { BG_NONE = 0, BG_YUV = 1, BG_CHROMA = 2 };
 
 class Vectorscope : public QWidget, public Ui::Vectorscope_UI {
     Q_OBJECT
@@ -34,19 +37,32 @@ protected:
     void resizeEvent(QResizeEvent *event);
     void mousePressEvent(QMouseEvent *);
     void mouseMoveEvent(QMouseEvent *event);
+    void raise();
 
 private:
     Monitor *m_projMonitor;
     Monitor *m_clipMonitor;
     Render *m_activeRender;
 
+    ColorTools *m_colorTools;
+    ColorPlaneExport *m_colorPlaneExport;
+
+    QAction *m_aExportBackground;
+    QAction *m_aAxisEnabled;
+    QAction *m_a75PBox;
+    QAction *m_aRealtime;
+
     /** How to represent the pixels on the scope (green, original color, ...) */
     int iPaintMode;
 
-    float scaling;
+    /** Custom scaling of the vectorscope */
+    float m_scaling;
 
+    /** Number of pixels to skip for getting realtime updates */
+    int m_skipPixels;
 
     QPoint mapToCanvas(QRect inside, QPointF point);
+    QPoint centerPoint, pR75, pG75, pB75, pCy75, pMg75, pYl75;
 
     bool circleEnabled;
     QPoint mousePos;
@@ -61,14 +77,22 @@ private:
     /** The vectorscope color distribution.
         Class variable as calculated by a thread. */
     QImage m_scope;
+    QImage m_wheel;
 
     void calculateScope();
     QFuture<void> m_scopeCalcThread;
+    QFuture<QImage> m_wheelCalcThread;
+
+    /** This semaphore that guards QFuture m_scopeCalcThread is necessary for avoiding
+        deadlocks. If not present, then an incoming new frame might trigger a new thread
+        at the wrong point in time, causing a deadlock. Nasty ;) */
+    QSemaphore semaphore;
 
     /** Prods the Scope calculation thread. If it is running, do nothing. If it is not,
       run a new thread.
       Returns true if a new thread has been started. */
     bool prodCalcThread();
+    bool prodWheelThread();
 
     /** Counts the number of frames that have been rendered in one of the monitors.
       The frame number will be reset when the vectorscope starts calculating the
@@ -79,17 +103,22 @@ private:
       are generated, but the scope has to be updated in any case (also if auto-update
       is not enabled). */
     QAtomicInt newChanges;
+    /** Counts the number of changes concerning the background wheel */
+    QAtomicInt newWheelChanges;
 
 signals:
-    void signalScopeCalculationFinished();
+    void signalScopeCalculationFinished(const unsigned int &mseconds, const unsigned int &skipPixels);
 
 private slots:
     void slotMagnifyChanged();
+    void slotBackgroundChanged();
     void slotActiveMonitorChanged(bool isClipMonitor);
     void slotRenderZoneUpdated();
-    void slotScopeCalculationFinished();
+    void slotScopeCalculationFinished(unsigned int mseconds, unsigned int skipPixels);
+    void slotWheelCalculationFinished();
     void slotUpdateScope();
-
+    void slotUpdateWheel();
+    void slotExportBackground();
 };
 
 #endif // VECTORSCOPE_H