00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
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
00035 }
00036 #endif
00037
00038
00039 typedef enum {
00040 PNM_PBM,
00041 PNM_PBM_ASCII,
00042 PNM_PGM,
00043 PNM_PGM_ASCII,
00044 PNM_PPM,
00045 PNM_PPM_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 }
00074
00075 #endif