Omnidome
Fulldome Mapping Software Toolkit
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ChannelCorrection.h
Go to the documentation of this file.
1 /* Copyright (c) 2014-2016 "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_PROJ_CHANNELCORRECTION_H_
20 #define OMNI_PROJ_CHANNELCORRECTION_H_
21 
22 #include <qglobal.h>
23 
24 namespace omni {
25  namespace proj {
26  /// Brightness, contrast and gamma correction for a single color channel
28  public:
29  /// Return gamma value
30  double gamma() const;
31 
32  /// Calculate gamma for given value
33  double gamma(double v) const;
34 
35  /// Set new gamma value, value is clamped between -1 and 1
36  void setGamma(double);
37 
38  /// Return brightness value
39  double brightness() const;
40 
41  /// Calculate brightness for given value
42  double brightness(double v) const;
43 
44  /// Set new brightness value, value is clamped between -1 and 1
45  void setBrightness(double);
46 
47  /// Return contrast value
48  double contrast() const;
49 
50  /// Calculate contrast for given value
51  double contrast(double v) const;
52 
53  /// Set new contrast value, value is clamped between -1 and 1
54  void setContrast(double);
55 
56  /// Value contrast, brightness and gamma are multiplied
57  double multiplier() const;
58 
59  /// Set new multiplier value
60  void setMultiplier(double _multiplier);
61 
62  /// Return corrected value, value is NOT clamped
63  double corrected(double _value) const;
64 
65  /// Test for equality
66  friend bool operator==(ChannelCorrection const&,
67  ChannelCorrection const&);
68 
69  private:
70  // Gamma between -1 and 1
71  double gamma_ = 0.0;
72 
73  /// Brightness between -1 and 1
74  double brightness_ = 0.0;
75 
76  /// Contrast between -1 and 1
77  double contrast_ = 0.0;
78 
79  /// Multiplier between 0.0 and 1.0
80  double multiplier_ = 0.5;
81  };
82  }
83 }
84 
85 QDataStream& operator>>(QDataStream&,
87 QDataStream& operator<<(QDataStream&,
89 
90 #endif /* OMNI_PROJ_CHANNELCORRECTION_H_ */
Brightness, contrast and gamma correction for a single color channel.
Definition: ChannelCorrection.h:27
double gamma_
Definition: ChannelCorrection.h:71
double multiplier_
Multiplier between 0.0 and 1.0.
Definition: ChannelCorrection.h:80
double brightness_
Brightness between -1 and 1.
Definition: ChannelCorrection.h:74
void setMultiplier(double _multiplier)
Set new multiplier value.
Definition: ChannelCorrection.cpp:76
void setContrast(double)
Set new contrast value, value is clamped between -1 and 1.
Definition: ChannelCorrection.cpp:68
double corrected(double _value) const
Return corrected value, value is NOT clamped.
Definition: ChannelCorrection.cpp:80
QDataStream & operator<<(QDataStream &, omni::proj::ChannelCorrection const &)
Definition: ChannelCorrection.cpp:110
double gamma() const
Return gamma value.
Definition: ChannelCorrection.cpp:27
double contrast_
Contrast between -1 and 1.
Definition: ChannelCorrection.h:77
double brightness() const
Return brightness value.
Definition: ChannelCorrection.cpp:35
QDataStream & operator>>(QDataStream &, omni::proj::ChannelCorrection &)
Definition: ChannelCorrection.cpp:95
double multiplier() const
Value contrast, brightness and gamma are multiplied.
Definition: ChannelCorrection.cpp:72
friend bool operator==(ChannelCorrection const &, ChannelCorrection const &)
Test for equality.
Definition: ChannelCorrection.cpp:85
void setBrightness(double)
Set new brightness value, value is clamped between -1 and 1.
Definition: ChannelCorrection.cpp:60
void setGamma(double)
Set new gamma value, value is clamped between -1 and 1.
Definition: ChannelCorrection.cpp:31
double contrast() const
Return contrast value.
Definition: ChannelCorrection.cpp:64