lemon/color.h
changeset 2174 f9e43b5cc617
parent 2172 4b25e7003868
child 2179 a3bb30be417c
     1.1 --- a/lemon/color.h	Thu Aug 10 12:26:29 2006 +0000
     1.2 +++ b/lemon/color.h	Thu Aug 10 13:52:56 2006 +0000
     1.3 @@ -44,6 +44,9 @@
     1.4  
     1.5  namespace lemon {
     1.6  
     1.7 +  /// \addtogroup misc
     1.8 +  /// @{
     1.9 +
    1.10  ///Data structure representing RGB colors.
    1.11  
    1.12  ///Data structure representing RGB colors.
    1.13 @@ -72,6 +75,37 @@
    1.14    void set(double r,double g,double b) { _r=r;_g=g;_b=b; };
    1.15  };
    1.16  
    1.17 +  /// White color constant
    1.18 +  extern const Color WHITE;  
    1.19 +  /// Black color constant
    1.20 +  extern const Color BLACK;
    1.21 +  /// Red color constant
    1.22 +  extern const Color RED;
    1.23 +  /// Green color constant
    1.24 +  extern const Color GREEN;
    1.25 +  /// Blue color constant
    1.26 +  extern const Color BLUE;
    1.27 +  /// Yellow color constant
    1.28 +  extern const Color YELLOW;
    1.29 +  /// Magenta color constant
    1.30 +  extern const Color MAGENTA;
    1.31 +  /// Cyan color constant
    1.32 +  extern const Color CYAN;
    1.33 +  /// Grey color constant
    1.34 +  extern const Color GREY;
    1.35 +  /// Dark red color constant
    1.36 +  extern const Color DARK_RED;
    1.37 +  /// Dark green color constant
    1.38 +  extern const Color DARK_GREEN;
    1.39 +  /// Drak blue color constant
    1.40 +  extern const Color DARK_BLUE;
    1.41 +  /// Dark yellow color constant
    1.42 +  extern const Color DARK_YELLOW;
    1.43 +  /// Dark magenta color constant
    1.44 +  extern const Color DARK_MAGENTA;
    1.45 +  /// Dark cyan color constant
    1.46 +  extern const Color DARK_CYAN;
    1.47 +
    1.48  ///Maps <tt>int</tt>s to different \ref Color "Color"s
    1.49  
    1.50  ///This map assigns one of the predefined \ref Color "Color"s
    1.51 @@ -91,8 +125,8 @@
    1.52    ///\param have_white indicates whether white is
    1.53    ///amongst the provided color (\c true) or not (\c false). If it is true,
    1.54    ///white will be assigned to \c 0.
    1.55 -  ///\param num the number of the allocated colors. If it is \c 0
    1.56 -  ///the default color configuration is set up (26 color plus the while).
    1.57 +  ///\param num the number of the allocated colors. If it is \c 0,
    1.58 +  ///the default color configuration is set up (26 color plus the white).
    1.59    ///If \c num is less then 26/27 then the default color list is cut. Otherwise
    1.60    ///the color list is filled repeatedly with the default color list.
    1.61    ///(The colors can be changed later on.)
    1.62 @@ -167,10 +201,11 @@
    1.63  
    1.64  ///Returns black for light colors and white for the dark ones.
    1.65  inline Color distantBW(const Color &c){
    1.66 -  double v=(.2125*c.red()+.7154*c.green()+.0721*c.blue())<.5?1:0;
    1.67 -  return Color(v,v,v);
    1.68 +  return (.2125*c.red()+.7154*c.green()+.0721*c.blue())<.5 ? WHITE : BLACK;
    1.69  }
    1.70  
    1.71 +/// @}
    1.72 +
    1.73  } //END OF NAMESPACE LEMON
    1.74  
    1.75  #endif // LEMON_COLOR_H