Fawkes API
Fawkes Development Version
|
00001 00002 /************************************************************************** 00003 * cmfile.h - FVFF Colormap File Format 00004 * 00005 * Created: Sat Mar 29 12:49:48 2008 00006 * Copyright 2005-2008 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_FVUTILS_COLORMAP_CMFILE_H_ 00025 #define __FIREVISION_FVUTILS_COLORMAP_CMFILE_H_ 00026 00027 #include <fvutils/fileformat/fvfile.h> 00028 #include <fvutils/colormap/cmfile_block.h> 00029 #include <vector> 00030 #include <string> 00031 #include <stdint.h> 00032 00033 namespace firevision { 00034 #if 0 /* just to make Emacs auto-indent happy */ 00035 } 00036 #endif 00037 00038 class Colormap; 00039 00040 #define CMFILE_MAGIC_TOKEN 0xFF01 00041 #define CMFILE_CUR_VERSION 2 00042 00043 #define CMFILE_TYPE_YUV 1 00044 00045 #pragma pack(push,4) 00046 /** Block header for a Colormap header block in a ColormapFile. */ 00047 typedef struct { 00048 uint16_t depth; /**< Y resolution */ 00049 uint16_t width; /**< U resolution */ 00050 uint16_t height; /**< V resolution */ 00051 uint16_t reserved; /**< reserved for future use, padding */ 00052 } cmfile_header_t; 00053 #pragma pack(pop) 00054 00055 class ColormapFile : public FireVisionDataFile 00056 { 00057 public: 00058 ColormapFile(); 00059 ColormapFile(uint16_t depth, uint16_t width, uint16_t height); 00060 00061 class ColormapBlockVector : public std::vector<ColormapFileBlock *> 00062 { 00063 public: 00064 ~ColormapBlockVector(); 00065 }; 00066 00067 void add_colormap(Colormap *colormap); 00068 ColormapBlockVector * colormap_blocks(); 00069 Colormap * get_colormap(); 00070 00071 uint16_t get_depth(); 00072 uint16_t get_width(); 00073 uint16_t get_height(); 00074 00075 static bool is_colormap_file(const char *filename); 00076 static std::string compose_filename(const std::string format); 00077 00078 virtual void clear(); 00079 00080 private: 00081 inline void assert_header(); 00082 private: 00083 cmfile_header_t *__header; 00084 }; 00085 00086 } // end namespace firevision 00087 00088 #endif