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 }

Generated for HippoDraw Class Library by doxygen