00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef PNMREADER_H
00016 #define PNMREADER_H
00017
00018 #include "pandabase.h"
00019
00020 #include "pnmImageHeader.h"
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 class EXPCL_PANDA_PNMIMAGE PNMReader : public PNMImageHeader {
00032 protected:
00033 INLINE PNMReader(PNMFileType *type, istream *file, bool owns_file);
00034
00035 public:
00036 virtual ~PNMReader();
00037 INLINE void set_read_size(int x_size, int y_size);
00038
00039 INLINE PNMFileType *get_type() const;
00040
00041 virtual void prepare_read();
00042 virtual int read_data(xel *array, xelval *alpha);
00043 virtual bool supports_read_row() const;
00044 virtual bool read_row(xel *array, xelval *alpha, int x_size, int y_size);
00045
00046 virtual bool supports_stream_read() const;
00047
00048 INLINE bool is_valid() const;
00049
00050 private:
00051 int get_reduction_shift(int orig_size, int new_size);
00052
00053 protected:
00054 PNMFileType *_type;
00055 bool _owns_file;
00056 istream *_file;
00057 bool _is_valid;
00058
00059 int _read_x_size, _read_y_size;
00060 bool _has_read_size;
00061
00062 int _x_shift, _y_shift;
00063 int _orig_x_size, _orig_y_size;
00064 };
00065
00066 #include "pnmReader.I"
00067
00068 #endif