Engauge Digitizer  2
ColorFilterSettingsStrategyHue.cpp
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 #include "ColorConstants.h"
8 #include "ColorFilterSettings.h"
9 #include "ColorFilterSettingsStrategyHue.h"
10 #include <QTextStream>
11 
13 {
14 }
15 
16 ColorFilterSettingsStrategyHue::~ColorFilterSettingsStrategyHue ()
17 {
18 }
19 
20 double ColorFilterSettingsStrategyHue::high (const ColorFilterSettings &colorFilterSettings) const
21 {
22  return (double) (colorFilterSettings.hueHigh () - HUE_MIN) /
23  (double) (HUE_MAX - HUE_MIN);
24 }
25 
26 double ColorFilterSettingsStrategyHue::low (const ColorFilterSettings &colorFilterSettings) const
27 {
28  return (double) (colorFilterSettings.hueLow () - HUE_MIN) /
29  (double) (HUE_MAX - HUE_MIN);
30 }
31 
33  QString indentation,
34  QTextStream &str) const
35 {
36  str << indentation << "hueLow=" << colorFilterSettings.intensityLow () << "\n";
37  str << indentation << "hueHigh=" << colorFilterSettings.intensityHigh () << "\n";
38 }
39 
41  double s0To1)
42 {
43  colorFilterSettings.setHueHigh (HUE_MIN + s0To1 * (HUE_MAX - HUE_MIN));
44 }
45 
47  double s0To1)
48 {
49  colorFilterSettings.setHueLow (HUE_MIN + s0To1 * (HUE_MAX - HUE_MIN));
50 }
virtual void printStream(const ColorFilterSettings &colorFilterSettings, QString indentation, QTextStream &str) const
Print the low and high values.
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.
virtual void setHigh(ColorFilterSettings &colorFilterSettings, double s0To1)
Set the high value given the normalized value.
virtual void setLow(ColorFilterSettings &colorFilterSettings, double s0To1)
Set the low value given the normalized value.
virtual double low(const ColorFilterSettings &colorFilterSettings) const
Return the low value normalized to 0 to 1.
void setHueHigh(int hueHigh)
Set method for hue higher bound.
int intensityHigh() const
Get method for intensity higher bound.
int intensityLow() const
Get method for intensity lower bound.
virtual double high(const ColorFilterSettings &colorFilterSettings) const
Return the high value normalized to 0 to 1.
int hueLow() const
Get method for hue lower bound.