pnm.h

00001 
00002 /***************************************************************************
00003  *  pnm.h - Header for tool to write PNM,
00004  *  for more information on the different available image formats see the
00005  *  NetPBM documentation.
00006  *
00007  *  Generated: Mon Feb 06 19:18:03 2006
00008  *  Copyright  2005-2007  Tim Niemueller [www.niemueller.de]
00009  *
00010  ****************************************************************************/
00011 
00012 /*  This program is free software; you can redistribute it and/or modify
00013  *  it under the terms of the GNU General Public License as published by
00014  *  the Free Software Foundation; either version 2 of the License, or
00015  *  (at your option) any later version. A runtime exception applies to
00016  *  this software (see LICENSE.GPL_WRE file mentioned below for details).
00017  *
00018  *  This program is distributed in the hope that it will be useful,
00019  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00020  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00021  *  GNU Library General Public License for more details.
00022  *
00023  *  Read the full text in the LICENSE.GPL_WRE file in the doc directory.
00024  */
00025 
00026 #ifndef __FIREVISION_FVUTILS_WRITERS_PNM_H_
00027 #define __FIREVISION_FVUTILS_WRITERS_PNM_H_
00028 
00029 
00030 #include <fvutils/color/colorspaces.h>
00031 #include <fvutils/writers/writer.h>
00032 
00033 namespace firevision {
00034 #if 0 /* just to make Emacs auto-indent happy */
00035 }
00036 #endif
00037 
00038 /** PNM subtype. */
00039 typedef enum {
00040   PNM_PBM,              /**< PBM, B/W */
00041   PNM_PBM_ASCII,        /**< PBM, B/W, ASCII */
00042   PNM_PGM,              /**< PGM, grey */
00043   PNM_PGM_ASCII,        /**< PGM, grey, ASCII */
00044   PNM_PPM,              /**< PPM, color */
00045   PNM_PPM_ASCII         /**< PPM, color, ASCII */
00046 } PNMFormat;
00047 
00048 
00049 class PNMWriter : public Writer
00050 {
00051  public:
00052   PNMWriter(PNMFormat format);
00053   PNMWriter(PNMFormat format, const char *filename, unsigned int width, unsigned int height);
00054 
00055   virtual void set_buffer(colorspace_t cspace, unsigned char *buffer);
00056   virtual void write();
00057 
00058  private:
00059 
00060   unsigned int calc_buffer_size();
00061 
00062   unsigned int write_header(bool simulate = false);
00063   const char * format2string(PNMFormat format);
00064 
00065   PNMFormat      format;
00066   unsigned int   buffer_size;
00067   unsigned char *buffer;
00068   unsigned char *buffer_start;
00069   unsigned int   width;
00070   unsigned int   height;
00071 };
00072 
00073 } // end namespace firevision
00074 
00075 #endif

Generated on Tue Feb 22 13:32:16 2011 for Fawkes API by  doxygen 1.4.7