Engauge Digitizer 2
Loading...
Searching...
No Matches
ColorFilterSettingsStrategyValue.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"
10#include <qmath.h>
11#include <QTextStream>
12
16
20
21double ColorFilterSettingsStrategyValue::high (const ColorFilterSettings &colorFilterSettings) const
22{
23 return double (colorFilterSettings.valueHigh () - VALUE_MIN) /
24 double (VALUE_MAX - VALUE_MIN);
25}
26
27double ColorFilterSettingsStrategyValue::low (const ColorFilterSettings &colorFilterSettings) const
28{
29 return double (colorFilterSettings.valueLow () - VALUE_MIN) /
30 double (VALUE_MAX - VALUE_MIN);
31}
32
34 QString indentation,
35 QTextStream &str) const
36{
37 str << indentation << "valueLow=" << colorFilterSettings.valueLow () << "\n";
38 str << indentation << "valueHigh=" << colorFilterSettings.valueHigh () << "\n";
39}
40
42 double s0To1)
43{
44 colorFilterSettings.setValueHigh (qFloor (VALUE_MIN + s0To1 * (VALUE_MAX - VALUE_MIN)));
45}
46
48 double s0To1)
49{
50 colorFilterSettings.setValueLow (qFloor (VALUE_MIN + s0To1 * (VALUE_MAX - VALUE_MIN)));
51}
const int VALUE_MAX
const int VALUE_MIN
virtual void setLow(ColorFilterSettings &colorFilterSettings, double s0To1)
Set the low value given the normalized value.
virtual void printStream(const ColorFilterSettings &colorFilterSettings, QString indentation, QTextStream &str) const
Print the low and high values.
virtual double low(const ColorFilterSettings &colorFilterSettings) const
Return the low value normalized to 0 to 1.
virtual double high(const ColorFilterSettings &colorFilterSettings) const
Return the high value normalized to 0 to 1.
virtual void setHigh(ColorFilterSettings &colorFilterSettings, double s0To1)
Set the high value given the normalized value.
Color filter parameters for one curve. For a class, this is handled the same as LineStyle and PointSt...
void setValueLow(int valueLow)
Set method for value low.
void setValueHigh(int valueHigh)
Set method for value high.
int valueLow() const
Get method for value low.
int valueHigh() const
Get method for value high.