PNGGenerator.h
Go to the documentation of this file.00001
00002 #ifndef INCLUDED_PNGGenerator_h_
00003 #define INCLUDED_PNGGenerator_h_
00004
00005 #include "Vision/FilterBankGenerator.h"
00006
00007
00008
00009
00010
00011
00012
00013
00014 class PNGGenerator : public FilterBankGenerator {
00015 public:
00016 static const unsigned int PNG_HEADER_PAD=500;
00017
00018
00019 enum src_mode_t {
00020 SRC_AUTO,
00021 SRC_GRAYSCALE,
00022 SRC_COLOR
00023 };
00024
00025
00026 PNGGenerator(unsigned int mysid, FilterBankGenerator* fbg, EventBase::EventTypeID_t tid);
00027
00028 PNGGenerator(unsigned int mysid, PNGGenerator::src_mode_t sMode, FilterBankGenerator* fbg, EventBase::EventTypeID_t tid);
00029
00030
00031 virtual ~PNGGenerator();
00032
00033
00034 virtual void setSourceMode(src_mode_t mode) { srcMode=mode; if(mode!=SRC_AUTO) curMode=mode;}
00035
00036 virtual src_mode_t getSourceMode() const { return srcMode; }
00037
00038 virtual src_mode_t getCurrentSourceFormat() const { return curMode; }
00039
00040 static std::string getClassDescription() { return "Compresses its source FilterBankGenerator's data into PNG format"; }
00041
00042
00043 virtual void doEvent();
00044
00045
00046 virtual unsigned int getBinSize() const;
00047
00048 virtual unsigned int loadBuffer(const char buf[], unsigned int len, const char* filename=NULL);
00049
00050
00051 virtual unsigned int saveBuffer(char buf[], unsigned int len) const;
00052
00053
00054 virtual size_t getImageSize(unsigned int layer, unsigned int chan) const { return bytesUsed[layer][chan]; }
00055
00056 protected:
00057 virtual void setNumImages(unsigned int nLayers, unsigned int nChannels);
00058 virtual unsigned char * createImageCache(unsigned int layer, unsigned int chan) const;
00059 virtual void calcImage(unsigned int layer, unsigned int chan);
00060 virtual void destruct();
00061
00062 src_mode_t srcMode;
00063 src_mode_t curMode;
00064
00065 unsigned int ** bytesUsed;
00066
00067 private:
00068 PNGGenerator(const PNGGenerator& fbk);
00069 const PNGGenerator& operator=(const PNGGenerator& fbk);
00070 };
00071
00072
00073
00074
00075
00076
00077 #endif