color.h

Go to the documentation of this file.
00001 
00006 #ifndef COLOR_H
00007 #define COLOR_H
00008 
00009 #include <map>
00010 
00017 class Color {
00018     public:
00019         float v[3]; 
00022         Color() { v[0] = 0; v[1] = 0; v[2] = 0; }
00023 
00025         Color( float r, float g, float b ) { v[0]=r; v[1]=g; v[2]=b; }
00026 
00028         void assign( float r, float g, float b ) { v[0]=r; v[1]=g; v[2]=b; }
00029 
00030         float R() const { return v[0]; } 
00031         float G() const { return v[1]; } 
00032         float B() const { return v[2]; } 
00033         bool is_valid() const; 
00036         Color operator*(double alpha) const
00037         {
00038             return Color(v[0]*alpha,v[1]*alpha,v[2]*alpha);
00039         }
00040 
00041     Color operator+(Color other) const
00042       {
00043         return Color(v[0]+other.v[0], v[1]+other.v[1], v[2]+other.v[2]);
00044       }
00045 };
00046 
00047 /* for generating data colorings according to the visible light spectrum */
00048 Color spectrum_color(double data, double data_min, double data_max);
00049 
00050 #ifndef SWIG
00051 // std::istream& operator>>( const std::istream &stream, Color &color);
00052 // Commented by tp517 on 3/2/10 as I can't make it type correctly and it's not used
00053 #endif /* SWIG */
00054 
00055 #ifndef SWIG /* Ruby will try to garbage collect these if they are run through swig */
00056 
00057 extern Color RED;
00058 extern Color BLUE;
00059 extern Color GREEN;
00060 extern Color YELLOW;
00061 extern Color LIGHTYELLOW;
00062 extern Color CYAN;
00063 extern Color MAGENTA;
00064 extern Color WHITE;
00065 extern Color BLACK;
00066 extern Color GRAY1;
00067 extern Color GRAY2;
00068 extern Color GRAY3;
00069 extern Color GRAY4;
00070 extern Color DIMYELLOW;
00071 extern Color DIMCYAN;
00072 extern Color DIMMAGENTA;
00073 extern Color DARKRED;
00074 extern Color DARKRED2;
00075 extern Color PINK1;
00076 extern Color PINK2;
00077 
00078 extern std::map<int, Color> opengl_color_map;
00079 //extern map<int, Color> eps_rgb_map;
00080 //extern map<int, float> eps_grayscale_map;
00081 #endif /* SWIG */
00082 
00083 
00084 /* These are depericiated, are they used any more
00085  *
00086  * fix these / get rid of them
00087  */
00088 
00089 typedef  std::map<int, Color> ColorMap;
00090 typedef  std::map<int, float> GrayscaleMap;
00091 
00092 void default_opengl_color_map(ColorMap &map);
00093 void default_eps_rgb_map(ColorMap &map);
00094 void default_eps_grayscale_map(GrayscaleMap &map);
00095 //int load_map(ColorMap &map);
00096 //int load_map(GrayscaleMap &map);
00097 
00098 
00099 
00100 #endif /* COLOR_H */
00101 

Generated on Mon May 24 09:53:30 2010 for TUMBLE by  doxygen 1.5.2