Engauge Digitizer  2
ColorFilterSettings.h
1 /******************************************************************************************************
2  * (C) 2014 markummitchell@github.com. This file is part of Engauge Digitizer, which is released *
3  * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file *
4  * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. *
5  ******************************************************************************************************/
6 
7 #ifndef COLOR_FILTER_SETTINGS_H
8 #define COLOR_FILTER_SETTINGS_H
9 
10 #include "ColorFilterSettingsStrategyAbstractBase.h"
11 #include "ColorFilterMode.h"
12 #include <QMap>
13 
14 class QTextStream;
15 class QXmlStreamReader;
16 class QXmlStreamWriter;
17 
20 {
21 public:
24 
26  ColorFilterSettings (ColorFilterMode colorFilterMode,
27  int intensityLow,
28  int intensityHigh,
29  int foregroundLow,
30  int foregroundHigh,
31  int hueLow,
32  int hueHigh,
33  int saturationLow,
34  int saturationHigh,
35  int valueLow,
36  int valueHigh);
37 
40 
42  ColorFilterSettings (QXmlStreamReader &reader);
43 
46 
48  ColorFilterMode colorFilterMode() const;
49 
52 
54  int foregroundHigh () const;
55 
57  int foregroundLow () const;
58 
61  double high () const;
62 
64  int hueHigh () const;
65 
67  int hueLow () const;
68 
70  int intensityHigh () const;
71 
73  int intensityLow () const;
74 
76  void loadXml(QXmlStreamReader &reader);
77 
80  double low () const;
81 
83  void printStream (QString indentation,
84  QTextStream &str) const;
85 
87  int saturationHigh () const;
88 
90  int saturationLow () const;
91 
93  void saveXml(QXmlStreamWriter &writer,
94  const QString &curveName) const;
95 
97  void setColorFilterMode(ColorFilterMode colorFilterMode);
98 
100  void setForegroundHigh (int foregroundHigh);
101 
103  void setForegroundLow (int foregroundLow);
104 
106  void setHigh (double s0To1);
107 
109  void setHueHigh (int hueHigh);
110 
112  void setHueLow (int hueLow);
113 
115  void setIntensityHigh (int intensityHigh);
116 
118  void setIntensityLow (int intensityLow);
119 
121  void setLow (double s0To1);
122 
124  void setSaturationHigh (int saturationHigh);
125 
127  void setSaturationLow (int saturationLow);
128 
130  void setValueHigh (int valueHigh);
131 
133  void setValueLow (int valueLow);
134 
136  int valueHigh () const;
137 
139  int valueLow () const;
140 
141 private:
142 
143  void createStrategies ();
144 
145  ColorFilterMode m_colorFilterMode;
146  int m_intensityLow;
147  int m_intensityHigh;
148  int m_foregroundLow;
149  int m_foregroundHigh;
150  int m_hueLow;
151  int m_hueHigh;
152  int m_saturationLow;
153  int m_saturationHigh;
154  int m_valueLow;
155  int m_valueHigh;
156 
157  // Strategies for mode-specific computations
158  QMap<ColorFilterMode, ColorFilterSettingsStrategyAbstractBase*> m_strategies;
159 };
160 
161 #endif // COLOR_FILTER_SETTINGS_H
void setSaturationLow(int saturationLow)
Set method for saturation low.
void setLow(double s0To1)
Set the low value for the current filter mode.
int valueHigh() const
Get method for value high.
void setHueLow(int hueLow)
Set method for hue lower bound.
Color filter parameters for one curve. For a class, this is handled the same as LineStyle and PointSt...
int hueHigh() const
Get method for hue higher bound.
void setColorFilterMode(ColorFilterMode colorFilterMode)
Set method for filter mode.
int foregroundLow() const
Get method for foreground lower bound.
double high() const
High value of foreground, hue, intensity, saturation or value according to current filter mode...
ColorFilterSettings & operator=(const ColorFilterSettings &other)
Assignment operator.
void setForegroundLow(int foregroundLow)
Set method for foreground lower bound.
double low() const
Low value of foreground, hue, intensity, saturation or value according to current filter mode...
void setHigh(double s0To1)
Set the high value for the current filter mode.
void setHueHigh(int hueHigh)
Set method for hue higher bound.
void printStream(QString indentation, QTextStream &str) const
Debugging method that supports print method of this class and printStream method of some other class(...
void setForegroundHigh(int foregroundHigh)
Set method for foreground higher bound.
int foregroundHigh() const
Get method for foreground higher bound.
static ColorFilterSettings defaultFilter()
Initial default for any Curve.
int intensityHigh() const
Get method for intensity higher bound.
void setIntensityHigh(int intensityHigh)
Set method for intensity higher bound.
int intensityLow() const
Get method for intensity lower bound.
int saturationHigh() const
Get method for saturation higher bound.
void setValueHigh(int valueHigh)
Set method for value high.
void setIntensityLow(int intensityLow)
Set method for intensity lower bound.
int valueLow() const
Get method for value low.
void setValueLow(int valueLow)
Set method for value low.
ColorFilterMode colorFilterMode() const
Get method for filter mode.
void setSaturationHigh(int saturationHigh)
Set method for saturation high.
void loadXml(QXmlStreamReader &reader)
Load curve filter to stream.
void saveXml(QXmlStreamWriter &writer, const QString &curveName) const
Save curve filter to stream.
ColorFilterSettings()
Default constructor only for use when this class is being stored by a container that requires the def...
int hueLow() const
Get method for hue lower bound.
int saturationLow() const
Get method for saturation lower bound.