File indexing completed on 2024-04-28 04:52:23
0001 /* 0002 SPDX-FileCopyrightText: 2010 Simon Andreas Eugster <simon.eu@gmail.com> 0003 This file is part of kdenlive. See www.kdenlive.org. 0004 0005 SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 0006 */ 0007 0008 #pragma once 0009 0010 #include "abstractgfxscopewidget.h" 0011 #include "ui_vectorscope_ui.h" 0012 0013 class ColorTools; 0014 0015 class Vectorscope_UI; 0016 class VectorscopeGenerator; 0017 0018 enum BACKGROUND_MODE { BG_NONE = 0, BG_YUV = 1, BG_CHROMA = 2, BG_YPbPr = 3 }; 0019 0020 /** 0021 * @brief Displays the vectorscope of a frame. 0022 * 0023 * @see VectorscopeGenerator for more details about the vectorscope. 0024 */ 0025 class Vectorscope : public AbstractGfxScopeWidget 0026 { 0027 Q_OBJECT 0028 0029 public: 0030 explicit Vectorscope(QWidget *parent = nullptr); 0031 ~Vectorscope() override; 0032 0033 QString widgetName() const override; 0034 0035 protected: 0036 ///// Implemented methods ///// 0037 QRect scopeRect() override; 0038 QImage renderHUD(uint accelerationFactor) override; 0039 QImage renderGfxScope(uint accelerationFactor, const QImage &) override; 0040 QImage renderBackground(uint accelerationFactor) override; 0041 bool isHUDDependingOnInput() const override; 0042 bool isScopeDependingOnInput() const override; 0043 bool isBackgroundDependingOnInput() const override; 0044 void readConfig() override; 0045 0046 ///// Other ///// 0047 void writeConfig(); 0048 0049 private: 0050 Ui::Vectorscope_UI *m_ui; 0051 0052 ColorTools *m_colorTools; 0053 0054 QActionGroup *m_agColorSpace; 0055 QAction *m_aColorSpace_YUV; 0056 QAction *m_aColorSpace_YPbPr; 0057 QAction *m_aExportBackground; 0058 QAction *m_aAxisEnabled; 0059 QAction *m_a75PBox; 0060 QAction *m_aIQLines; 0061 0062 VectorscopeGenerator *m_vectorscopeGenerator; 0063 0064 /** How to represent the pixels on the scope (green, original color, ...) */ 0065 int m_iPaintMode; 0066 0067 /** Custom scaling of the vectorscope */ 0068 float m_gain{1}; 0069 0070 QPoint m_centerPoint, m_pR75, m_pG75, m_pB75, m_pCy75, m_pMg75, m_pYl75; 0071 QPoint m_qR75, m_qG75, m_qB75, m_qCy75, m_qMg75, m_qYl75; 0072 /** Unlike the scopeRect, this rect represents the overall visible rectangle 0073 and not only the square touching the Vectorscope's circle. */ 0074 QRect m_visibleRect; 0075 0076 /** Updates the dimension. Only necessary when the widget has been resized. */ 0077 void updateDimensions(); 0078 int m_cw; 0079 0080 private Q_SLOTS: 0081 void slotGainChanged(int); 0082 void slotBackgroundChanged(); 0083 void slotExportBackground(); 0084 void slotColorSpaceChanged(); 0085 };