00001 /****************************************************************************************************** 00002 * (C) 2014 markummitchell@github.com. This file is part of Engauge Digitizer, which is released * 00003 * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file * 00004 * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. * 00005 ******************************************************************************************************/ 00006 00007 #include "ColorConstants.h" 00008 #include "ColorFilterStrategyHue.h" 00009 #include <QColor> 00010 #include <qmath.h> 00011 00012 ColorFilterStrategyHue::ColorFilterStrategyHue () 00013 { 00014 } 00015 00016 ColorFilterStrategyHue::~ColorFilterStrategyHue () 00017 { 00018 } 00019 00020 double ColorFilterStrategyHue::pixelToZeroToOne (const QColor &pixel, 00021 QRgb /* rgbBackground */) const 00022 { 00023 double s = pixel.hueF(); 00024 if (s < 0) { 00025 // Color is achromatic (r=g=b) so it has no hue 00026 } 00027 00028 return s; 00029 } 00030 00031 int ColorFilterStrategyHue::zeroToOneToValue (double s) const 00032 { 00033 return HUE_MIN + s * (HUE_MAX - HUE_MIN); 00034 }