Fawkes API Fawkes Development Version
|
00001 00002 /************************************************************************** 00003 * lookuptable.h - This header defines a lookup table color model 00004 * 00005 * Created: Fri Jun 10 14:16:52 2005 00006 * Copyright 2005 Tim Niemueller [www.niemueller.de] 00007 * 00008 ***************************************************************************/ 00009 00010 /* This program is free software; you can redistribute it and/or modify 00011 * it under the terms of the GNU General Public License as published by 00012 * the Free Software Foundation; either version 2 of the License, or 00013 * (at your option) any later version. A runtime exception applies to 00014 * this software (see LICENSE.GPL_WRE file mentioned below for details). 00015 * 00016 * This program is distributed in the hope that it will be useful, 00017 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00019 * GNU Library General Public License for more details. 00020 * 00021 * Read the full text in the LICENSE.GPL_WRE file in the doc directory. 00022 */ 00023 00024 #ifndef __FIREVISION_MODELS_COLOR_LOOKUPTABLE_H_ 00025 #define __FIREVISION_MODELS_COLOR_LOOKUPTABLE_H_ 00026 00027 #include <models/color/colormodel.h> 00028 00029 #include <fvutils/colormap/yuvcm.h> 00030 #include <string> 00031 00032 namespace firevision { 00033 #if 0 /* just to make Emacs auto-indent happy */ 00034 } 00035 #endif 00036 00037 class ColorModelLookupTable : public ColorModel 00038 { 00039 public: 00040 00041 ColorModelLookupTable(YuvColormap *colormap); 00042 ColorModelLookupTable(const char *file); 00043 ColorModelLookupTable(const char *file, const char *lut_id, bool destroy_on_free = false); 00044 ColorModelLookupTable(unsigned int depth, const char *lut_id, bool destroy_on_free); 00045 ColorModelLookupTable(const char *lut_id, bool destroy_on_free); 00046 00047 virtual ~ColorModelLookupTable(); 00048 00049 virtual color_t determine(unsigned int y, unsigned int u, unsigned int v) const; 00050 00051 const char * get_name(); 00052 YuvColormap * get_colormap() const; 00053 00054 void load(const char *filename); 00055 00056 void reset(); 00057 static std::string compose_filename(const std::string format); 00058 00059 ColorModelLookupTable & operator+=(const ColorModelLookupTable &cmlt); 00060 00061 private: 00062 YuvColormap *__colormap; 00063 }; 00064 00065 00066 inline color_t 00067 ColorModelLookupTable::determine(unsigned int y, unsigned int u, unsigned int v) const 00068 { 00069 return __colormap->determine(y, u, v); 00070 } 00071 00072 } // end namespace firevision 00073 00074 #endif