Engauge Digitizer 2
Loading...
Searching...
No Matches
ColorFilterSettingsStrategyHue.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 ColorFilterSettingsStrategyHue::high (const ColorFilterSettings &colorFilterSettings) const
22{
23 return double (colorFilterSettings.hueHigh () - HUE_MIN) /
24 double (HUE_MAX - HUE_MIN);
25}
26
27double ColorFilterSettingsStrategyHue::low (const ColorFilterSettings &colorFilterSettings) const
28{
29 return double (colorFilterSettings.hueLow () - HUE_MIN) /
30 double (HUE_MAX - HUE_MIN);
31}
32
34 QString indentation,
35 QTextStream &str) const
36{
37 str << indentation << "hueLow=" << colorFilterSettings.intensityLow () << "\n";
38 str << indentation << "hueHigh=" << colorFilterSettings.intensityHigh () << "\n";
39}
40
42 double s0To1)
43{
44 colorFilterSettings.setHueHigh (qFloor (HUE_MIN + s0To1 * (HUE_MAX - HUE_MIN)));
45}
46
48 double s0To1)
49{
50 colorFilterSettings.setHueLow (qFloor (HUE_MIN + s0To1 * (HUE_MAX - HUE_MIN)));
51}
const int HUE_MAX
const int HUE_MIN
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.
virtual void printStream(const ColorFilterSettings &colorFilterSettings, QString indentation, QTextStream &str) const
Print the low and high values.
virtual void setHigh(ColorFilterSettings &colorFilterSettings, double s0To1)
Set the high value given the normalized value.
virtual double high(const ColorFilterSettings &colorFilterSettings) const
Return the high value normalized to 0 to 1.
Color filter parameters for one curve. For a class, this is handled the same as LineStyle and PointSt...
void setHueLow(int hueLow)
Set method for hue lower bound.
int intensityHigh() const
Get method for intensity higher bound.
int hueHigh() const
Get method for hue higher bound.
int intensityLow() const
Get method for intensity lower bound.
void setHueHigh(int hueHigh)
Set method for hue higher bound.
int hueLow() const
Get method for hue lower bound.