Engauge Digitizer  2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ColorFilterStrategyIntensity.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"
9 #include <QColor>
10 #include <qmath.h>
11 
13 {
14 }
15 
17 {
18 }
19 
21  QRgb /* rgbBackground */) const
22 {
23  double distance = qSqrt (pow (double (pixel.red()) , 2) +
24  pow (double (pixel.green()), 2) +
25  pow (double (pixel.blue()) , 2));
26  return distance / qSqrt (255.0 * 255.0 + 255.0 * 255.0 + 255.0 * 255.0);
27 }
28 
30 {
31  return qFloor (INTENSITY_MIN + s * (INTENSITY_MAX - INTENSITY_MIN));
32 }
virtual double pixelToZeroToOne(const QColor &pixel, QRgb rgbBackground) const
Return a normalized value of 0 to 1 given input pixel.
virtual int zeroToOneToValue(double s) const
Return the low value normalized to 0 to 1.
const int INTENSITY_MIN
Constants for use by CurveFilter and other curve-related classes.
ColorFilterStrategyIntensity()
Single constructor.
const int INTENSITY_MAX