Omnidome
Fulldome Mapping Software Toolkit
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ColorCorrectionGraph.h
Go to the documentation of this file.
1 /* Copyright (c) 2014-2015 "Omnidome" by cr8tr
2  * Dome Mapping Projection Software (http://omnido.me).
3  * Omnidome was created by Michael Winkelmann aka Wilston Oreo (@WilstonOreo)
4  *
5  * This file is part of Omnidome.
6  *
7  * Omnidome is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU Affero General Public License as
9  * published by the Free Software Foundation, either version 3 of the
10  * License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU Affero General Public License for more details.
16  * You should have received a copy of the GNU Affero General Public License
17  * along with this program. If not, see <http://www.gnu.org/licenses/>.
18  */
19 #ifndef OMNI_UI_PROJ_COLORCORRECTIONGRAPH_H_
20 #define OMNI_UI_PROJ_COLORCORRECTIONGRAPH_H_
21 
22 #include <QColor>
23 #include <QWidget>
24 #include <QPainter>
27 
28 namespace omni {
29  namespace ui {
30  namespace proj {
31  using omni::proj::Channel;
32 
33  /// Widget which draws the graph for color corrections for each channel
35  public QWidget,
36  public mixin::UnsharedDataModel<omni::proj::ColorCorrection>{
37  Q_OBJECT
39 
40  public:
41  ColorCorrectionGraph(QWidget * = nullptr);
43 
44  /// Return selected channel
45  Channel channel() const;
46 
47  /// Set selected channel
48  void setChannel(Channel _channel);
49 
50  protected:
51  /// Paint graph event
52  void paintEvent(QPaintEvent *);
53 
54  /// Re-paint on resize
55  void resizeEvent(QResizeEvent *);
56 
57  signals:
58  void dataModelChanged();
59 
60  private:
61  /// Update widget from current color correction
62  void dataToFrontend();
63 
64  /**@brief ColorCorrectionGraph cannot change data, hence there is nothing to
65  do here
66  **/
67  inline bool frontendToData() {
68  return false;
69  }
70 
71  /// Draw selected graphs
72  void drawGraphs(QPainter& _p,
73  bool _selected) const;
74 
75  /// Draw graph for a channel correction
76  void drawGraphForChannel(QPainter&,
78  QColor _color,
79  bool _selected) const;
80 
81  /// Draw graph for a channel
82  void drawGraphForChannel(QPainter&,
83  Channel _channel) const;
84 
85  /// Draw grid lines in background
86  void drawGridLines(QPainter&);
87 
88  Channel channel_ = Channel::ALL;
89  };
90  }
91  }
92 }
93 
94 #endif /* OMNI_UI_PROJ_COLORCORRECTIONGRAPH_H_ */
bool frontendToData()
ColorCorrectionGraph cannot change data, hence there is nothing to do here.
Definition: ColorCorrectionGraph.h:67
void drawGraphs(QPainter &_p, bool _selected) const
Draw selected graphs.
Definition: ColorCorrectionGraph.cpp:78
Brightness, contrast and gamma correction for a single color channel.
Definition: ChannelCorrection.h:27
Channel
Definition: Channel.h:24
Widget which draws the graph for color corrections for each channel.
Definition: ColorCorrectionGraph.h:34
void drawGraphForChannel(QPainter &, omni::proj::ChannelCorrection const &, QColor _color, bool _selected) const
Draw graph for a channel correction.
Definition: ColorCorrectionGraph.cpp:89
Color correction for RGB color space.
Definition: ColorCorrection.h:29
void dataToFrontend()
Update widget from current color correction.
Definition: ColorCorrectionGraph.cpp:49
Channel channel_
Definition: ColorCorrectionGraph.h:88
#define OMNI_UI_UNSHARED_DATAMODEL(MODEL)
Definition: DataModel.h:219
Holds a specific data model with frontend update mechanism.
Definition: DataModel.h:87
ColorCorrectionGraph(QWidget *=nullptr)
Definition: ColorCorrectionGraph.cpp:31
Channel channel() const
Return selected channel.
Definition: ColorCorrectionGraph.cpp:45
void setChannel(Channel _channel)
Set selected channel.
Definition: ColorCorrectionGraph.cpp:41
~ColorCorrectionGraph()
Definition: ColorCorrectionGraph.cpp:35
void resizeEvent(QResizeEvent *)
Re-paint on resize.
Definition: ColorCorrectionGraph.cpp:74
void paintEvent(QPaintEvent *)
Paint graph event.
Definition: ColorCorrectionGraph.cpp:53
void drawGridLines(QPainter &)
Draw grid lines in background.
Definition: ColorCorrectionGraph.cpp:125