Engauge Digitizer 2
Loading...
Searching...
No Matches
ColorFilterStrategyForeground Class Reference

Leaf class for foreground strategy for ColorFilter. More...

#include <ColorFilterStrategyForeground.h>

Inheritance diagram for ColorFilterStrategyForeground:
Inheritance graph
Collaboration diagram for ColorFilterStrategyForeground:
Collaboration graph

Public Member Functions

 ColorFilterStrategyForeground ()
 Single constructor.
virtual ~ColorFilterStrategyForeground ()
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.
Public Member Functions inherited from ColorFilterStrategyAbstractBase
 ColorFilterStrategyAbstractBase ()
 Single constructor.
virtual ~ColorFilterStrategyAbstractBase ()

Detailed Description

Leaf class for foreground strategy for ColorFilter.

Definition at line 13 of file ColorFilterStrategyForeground.h.

Constructor & Destructor Documentation

◆ ColorFilterStrategyForeground()

ColorFilterStrategyForeground::ColorFilterStrategyForeground ( )

Single constructor.

Definition at line 12 of file ColorFilterStrategyForeground.cpp.

13{
14}

◆ ~ColorFilterStrategyForeground()

ColorFilterStrategyForeground::~ColorFilterStrategyForeground ( )
virtual

Definition at line 16 of file ColorFilterStrategyForeground.cpp.

17{
18}

Member Function Documentation

◆ pixelToZeroToOne()

double ColorFilterStrategyForeground::pixelToZeroToOne ( const QColor & pixel,
QRgb rgbBackground ) const
virtual

Return a normalized value of 0 to 1 given input pixel.

Implements ColorFilterStrategyAbstractBase.

Definition at line 20 of file ColorFilterStrategyForeground.cpp.

22{
23 double distance = qSqrt (pow (double (pixel.red()) - qRed (rgbBackground), 2) +
24 pow (double (pixel.green()) - qGreen (rgbBackground), 2) +
25 pow (double (pixel.blue()) - qBlue (rgbBackground), 2));
26 return distance / qSqrt (255.0 * 255.0 + 255.0 * 255.0 + 255.0 * 255.0);
27}

◆ zeroToOneToValue()

int ColorFilterStrategyForeground::zeroToOneToValue ( double s) const
virtual

Return the low value normalized to 0 to 1.

Implements ColorFilterStrategyAbstractBase.

Definition at line 29 of file ColorFilterStrategyForeground.cpp.

30{
31 return qFloor (FOREGROUND_MIN + s * (FOREGROUND_MAX - FOREGROUND_MIN));
32}
const int FOREGROUND_MAX
const int FOREGROUND_MIN

The documentation for this class was generated from the following files: