00001
00002 #ifndef vil1_ras_file_format_h_
00003 #define vil1_ras_file_format_h_
00004 #ifdef VCL_NEEDS_PRAGMA_INTERFACE
00005 #pragma interface
00006 #endif
00007
00008
00009
00010
00011
00012 #include <vil1/vil1_file_format.h>
00013 #include <vil1/vil1_image_impl.h>
00014
00015 #include <vxl_config.h>
00016
00017
00018 class vil1_ras_file_format : public vil1_file_format
00019 {
00020 public:
00021 virtual char const* tag() const;
00022 virtual vil1_image_impl* make_input_image(vil1_stream* vs);
00023 virtual vil1_image_impl* make_output_image(vil1_stream* vs, int planes,
00024 int width,
00025 int height,
00026 int components,
00027 int bits_per_component,
00028 vil1_component_format format);
00029 };
00030
00031
00032 class vil1_ras_generic_image : public vil1_image_impl
00033 {
00034 vil1_stream* vs_;
00035 vxl_uint_32 width_;
00036 vxl_uint_32 height_;
00037
00038 int start_of_data_;
00039 int components_;
00040 int bits_per_component_;
00041
00042 vxl_uint_32 depth_;
00043 vxl_uint_32 length_;
00044 vxl_uint_32 type_;
00045 vxl_uint_32 map_type_;
00046 vxl_uint_32 map_length_;
00047 vxl_uint_8* col_map_;
00048
00049 bool read_header();
00050 bool write_header();
00051
00052 friend class vil1_ras_file_format;
00053 public:
00054
00055 vil1_ras_generic_image(vil1_stream* is);
00056 vil1_ras_generic_image(vil1_stream* is, int planes,
00057 int width,
00058 int height,
00059 int components,
00060 int bits_per_component,
00061 vil1_component_format format);
00062 ~vil1_ras_generic_image();
00063
00064
00065 virtual int planes() const { return 1; }
00066 virtual int width() const { return width_; }
00067 virtual int height() const { return height_; }
00068 virtual int components() const { return components_; }
00069
00070 virtual int bits_per_component() const { return bits_per_component_; }
00071 virtual enum vil1_component_format component_format() const { return VIL1_COMPONENT_FORMAT_UNSIGNED_INT; }
00072
00073
00074 virtual bool get_section(void* buf, int x0, int y0, int width, int height) const;
00075
00076 virtual bool put_section(void const* buf, int x0, int y0, int width, int height);
00077
00078 char const* file_format() const;
00079 bool get_property(char const *tag, void *prop = 0) const;
00080 vil1_image get_plane(unsigned int p) const;
00081 };
00082
00083 #endif // vil1_ras_file_format_h_