Engauge Digitizer  2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ColorFilterSettingsStrategyForeground.cpp
Go to the documentation of this file.
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"
10 #include <qmath.h>
11 #include <QTextStream>
12 
14 {
15 }
16 
18 {
19 }
20 
21 double ColorFilterSettingsStrategyForeground::high (const ColorFilterSettings &colorFilterSettings) const
22 {
23  return double (colorFilterSettings.foregroundHigh () - FOREGROUND_MIN) /
24  double (FOREGROUND_MAX - FOREGROUND_MIN);
25 }
26 
27 double ColorFilterSettingsStrategyForeground::low (const ColorFilterSettings &colorFilterSettings) const
28 {
29  return double (colorFilterSettings.foregroundLow () - FOREGROUND_MIN) /
30  double (FOREGROUND_MAX - FOREGROUND_MIN);
31 }
32 
34  QString indentation,
35  QTextStream &str) const
36 {
37  str << indentation << "foregroundLow=" << colorFilterSettings.intensityLow () << "\n";
38  str << indentation << "foregroundHigh=" << colorFilterSettings.intensityHigh () << "\n";
39 }
40 
42  double s0To1)
43 {
44  colorFilterSettings.setForegroundHigh (qFloor (FOREGROUND_MIN + s0To1 * (FOREGROUND_MAX - FOREGROUND_MIN)));
45 }
46 
48  double s0To1)
49 {
50  colorFilterSettings.setForegroundLow (qFloor (FOREGROUND_MIN + s0To1 * (FOREGROUND_MAX - FOREGROUND_MIN)));
51 }
Color filter parameters for one curve. For a class, this is handled the same as LineStyle and PointSt...
virtual void setLow(ColorFilterSettings &colorFilterSettings, double s0To1)
Set the low value given the normalized value.
int foregroundHigh() const
Get method for foreground higher bound.
virtual void printStream(const ColorFilterSettings &colorFilterSettings, QString indentation, QTextStream &str) const
Print the low and high values.
const int FOREGROUND_MIN
virtual double low(const ColorFilterSettings &colorFilterSettings) const
Return the low value normalized to 0 to 1.
void setForegroundLow(int foregroundLow)
Set method for foreground lower bound.
virtual double high(const ColorFilterSettings &colorFilterSettings) const
Return the high value normalized to 0 to 1.
int foregroundLow() const
Get method for foreground lower bound.
void setForegroundHigh(int foregroundHigh)
Set method for foreground higher bound.
int intensityHigh() const
Get method for intensity higher bound.
const int FOREGROUND_MAX
virtual void setHigh(ColorFilterSettings &colorFilterSettings, double s0To1)
Set the high value given the normalized value.
int intensityLow() const
Get method for intensity lower bound.