BinToGreyScale.cxx
Go to the documentation of this file.
1 
12 #include "BinToGreyScale.h"
13 
14 using namespace hippodraw;
15 
17 BinToGreyScale ( const char * name )
18  : BinToColor ( name )
19 {
20 }
21 
23  : BinToColor ( bin_to_color )
24 {
25 }
26 
28 {
29  return new BinToGreyScale ( *this );
30 }
31 
32 void
34 doubleToColor ( double value, Color & color ) const
35 {
36  int red=color.getRed();
37  int green=color.getGreen();
38  int blue=color.getBlue();
39 
40  double tmp = ( value - m_vmin ) / m_dv ;
41  double red_tmp = 255. - tmp * ( 255. - static_cast < double > ( red) );
42  double green_tmp = 255. - tmp * ( 255. - static_cast < double > ( green ) );
43  double blue_tmp = 255. - tmp * ( 255. - static_cast < double > ( blue ) );
44 
45  int ired_tmp = static_cast< int> ( red_tmp );
46  int igreen_tmp = static_cast< int> ( green_tmp );
47  int iblue_tmp = static_cast< int> ( blue_tmp );
48 
49  color.setColor ( ired_tmp, igreen_tmp, iblue_tmp );
50 }
51 
52 bool
55 {
56  return true;
57 }
BinToGreyScale class interface.
The base class for the value to the color transformation.
Definition: BinToColor.h:30
void setColor(const std::string &)
Sets the color.
Definition: Color.cxx:112
The class derived from the BinToColor class.
int getRed() const
Definition: Color.cxx:164
double m_vmin
The minimum value expected.
Definition: BinToColor.h:54
A Color class for creating the color object following the standard RGB color space.
Definition: Color.h:37
int getGreen() const
Definition: Color.cxx:169
BinToColor * clone() const
Creates a copy of itself.
virtual void doubleToColor(double value, Color &color) const
This function does the actual calculation that transforms the given value into a color using the curr...
virtual bool acceptChangeColor() const
Returns true if object can accept changing color,i.e.
double m_dv
The distance of the expected values, i.e.
Definition: BinToColor.h:50
int getBlue() const
Definition: Color.cxx:174
BinToGreyScale(const char *)
The constructor.

Generated for HippoDraw Class Library by doxygen