Engauge Digitizer  2
ColorFilterStrategyHue.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 "ColorFilterStrategyHue.h"
9 #include <QColor>
10 #include <qmath.h>
11 
13 {
14 }
15 
16 ColorFilterStrategyHue::~ColorFilterStrategyHue ()
17 {
18 }
19 
20 double ColorFilterStrategyHue::pixelToZeroToOne (const QColor &pixel,
21  QRgb /* rgbBackground */) const
22 {
23  double s = pixel.hueF();
24  if (s < 0) {
25  // Color is achromatic (r=g=b) so it has no hue
26  }
27 
28  return s;
29 }
30 
32 {
33  return HUE_MIN + s * (HUE_MAX - HUE_MIN);
34 }
ColorFilterStrategyHue()
Single constructor.
virtual int zeroToOneToValue(double s) const
Return the low value normalized to 0 to 1.
virtual double pixelToZeroToOne(const QColor &pixel, QRgb rgbBackground) const
Return a normalized value of 0 to 1 given input pixel.