Changeset 2174:f9e43b5cc617 in lemon-0.x for lemon/color.h
- Timestamp:
- 08/10/06 15:52:56 (19 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@2889
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
lemon/color.h
r2172 r2174 44 44 45 45 namespace lemon { 46 47 /// \addtogroup misc 48 /// @{ 46 49 47 50 ///Data structure representing RGB colors. … … 73 76 }; 74 77 78 /// White color constant 79 extern const Color WHITE; 80 /// Black color constant 81 extern const Color BLACK; 82 /// Red color constant 83 extern const Color RED; 84 /// Green color constant 85 extern const Color GREEN; 86 /// Blue color constant 87 extern const Color BLUE; 88 /// Yellow color constant 89 extern const Color YELLOW; 90 /// Magenta color constant 91 extern const Color MAGENTA; 92 /// Cyan color constant 93 extern const Color CYAN; 94 /// Grey color constant 95 extern const Color GREY; 96 /// Dark red color constant 97 extern const Color DARK_RED; 98 /// Dark green color constant 99 extern const Color DARK_GREEN; 100 /// Drak blue color constant 101 extern const Color DARK_BLUE; 102 /// Dark yellow color constant 103 extern const Color DARK_YELLOW; 104 /// Dark magenta color constant 105 extern const Color DARK_MAGENTA; 106 /// Dark cyan color constant 107 extern const Color DARK_CYAN; 108 75 109 ///Maps <tt>int</tt>s to different \ref Color "Color"s 76 110 … … 92 126 ///amongst the provided color (\c true) or not (\c false). If it is true, 93 127 ///white will be assigned to \c 0. 94 ///\param num the number of the allocated colors. If it is \c 0 95 ///the default color configuration is set up (26 color plus the whi le).128 ///\param num the number of the allocated colors. If it is \c 0, 129 ///the default color configuration is set up (26 color plus the white). 96 130 ///If \c num is less then 26/27 then the default color list is cut. Otherwise 97 131 ///the color list is filled repeatedly with the default color list. … … 168 202 ///Returns black for light colors and white for the dark ones. 169 203 inline Color distantBW(const Color &c){ 170 double v=(.2125*c.red()+.7154*c.green()+.0721*c.blue())<.5?1:0; 171 return Color(v,v,v); 204 return (.2125*c.red()+.7154*c.green()+.0721*c.blue())<.5 ? WHITE : BLACK; 172 205 } 173 206 207 /// @} 208 174 209 } //END OF NAMESPACE LEMON 175 210
Note: See TracChangeset
for help on using the changeset viewer.