palette.h
Go to the documentation of this file.00001 #ifndef __UTIL__PALETTE_HPP__
00002 #define __UTIL__PALETTE_HPP__
00003
00009 #include <config.h>
00010 #include <string>
00011 #include <util/gl.h>
00012 #include <util/color.h>
00013 #include <util/watchdog.h>
00014
00015 namespace util {
00023 class Palette : public FileObject {
00024 public:
00025 typedef util::Color<GLfloat> Color;
00026
00032 Palette(std::string filename);
00033
00037 Palette();
00038
00042 void reread();
00043
00050 Color getColor(unsigned int index, double alpha = 1) const;
00060 Color getColor(unsigned int ind1, unsigned int ind2, double w, double alpha = 1) const;
00066 void useColor(unsigned int index, double alpha = 1) const;
00075 void blend(unsigned int ind1, unsigned int ind2, double w, double alpha = 1) const;
00076
00080 static Color blend(const Color& c1, const Color& c2, double w);
00081
00091 void select(unsigned int start, unsigned int end, double w, double alpha = 1) const;
00092
00101 Color selectColor(unsigned int start, unsigned int end, double w, double alpha = 1) const;
00102
00103
00104 private:
00105 Color colors[256];
00106 };
00107 }
00108
00109 #endif
00110