pnm.h
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
00034 typedef enum {
00035 PNM_PBM,
00036 PNM_PBM_ASCII,
00037 PNM_PGM,
00038 PNM_PGM_ASCII,
00039 PNM_PPM,
00040 PNM_PPM_ASCII
00041 } PNMFormat;
00042
00043
00044 class PNMWriter : public Writer
00045 {
00046 public:
00047 PNMWriter(PNMFormat format);
00048 PNMWriter(PNMFormat format, const char *filename, unsigned int width, unsigned int height);
00049
00050 virtual void set_buffer(colorspace_t cspace, unsigned char *buffer);
00051 virtual void write();
00052
00053 private:
00054
00055 unsigned int calc_buffer_size();
00056
00057 unsigned int write_header(bool simulate = false);
00058 const char * format2string(PNMFormat format);
00059
00060 PNMFormat format;
00061 unsigned int buffer_size;
00062 unsigned char *buffer;
00063 unsigned char *buffer_start;
00064 unsigned int width;
00065 unsigned int height;
00066 };
00067
00068
00069
00070 #endif