00001 #ifndef GLT_COLMAP_H 00002 #define GLT_COLMAP_H 00003 00004 /* 00005 00006 GLT OpenGL C++ Toolkit 00007 Copyright (C) 2000-2002 Nigel Stewart 00008 Email: nigels.com@gmail.com WWW: http://www.nigels.com/glt/ 00009 00010 This library is free software; you can redistribute it and/or 00011 modify it under the terms of the GNU Lesser General Public 00012 License as published by the Free Software Foundation; either 00013 version 2.1 of the License, or (at your option) any later version. 00014 00015 This library is distributed in the hope that it will be useful, 00016 but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00018 Lesser General Public License for more details. 00019 00020 You should have received a copy of the GNU Lesser General Public 00021 License along with this library; if not, write to the Free Software 00022 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00023 00024 */ 00025 00039 #include <glt/color.h> 00040 00041 #include <list> 00042 00048 class GltColorMap 00049 { 00050 public: 00052 GltColorMap(); 00054 ~GltColorMap(); 00055 00057 void addEntry(const real t,const GltColor &color); 00059 void addEntry(const real t,const GltColor &color,const real alpha); 00060 00062 void clear(); 00063 00065 GltColor lookup(const double t) const; 00067 double lookup(const int i) const; 00068 00070 const int size() const; 00072 const real start() const; 00074 const real end() const; 00076 const real duration() const; 00077 00079 GltColorMap &operator+=(const real x); 00081 GltColorMap &operator-=(const real x); 00083 GltColorMap &operator*=(const real x); 00085 GltColorMap &operator/=(const real x); 00086 00087 private: 00088 00089 typedef std::list< std::pair<real,GltColor> > map; 00090 typedef GltColorMap::map::iterator iterator; 00091 typedef GltColorMap::map::const_iterator const_iterator; 00092 00093 map _map; 00094 }; 00095 00096 #endif